【问题标题】:Timeout - Async callback was not invoked within the 60000ms超时 - 在 60000 毫秒内未调用异步回调
【发布时间】:2020-01-07 09:02:27
【问题描述】:
import wd from 'wd';

jest.setTimeout(60000);
const PORT = 4723;

const config = {
  platformName: 'iOS',
  deviceName: `iPhone X`,
  platformVersion: '12.2',
  app: '/path/to/my.app',
  useNewWDA: true,
  autoLaunch: false,
};
let screenshotIndex = 0
const driver = wd.promiseChainRemote('localhost', PORT);
directory = '../screenshots';`enter code here`

beforeAll(async () => {
  await driver.init(config);
  await driver.sleep(7000); // wait for app to load
});

afterEach(async () => {
  await driver.takeScreenshot().then(
    function (image, err) {
      require('fs').writeFile(`screenshot-${screenshotIndex++}.png`, image, 'base64');
    }
  );
});

test('appium renders', async () => {
  let contexts = await driver.contexts();
  console.log('contexts', contexts);
  await driver.context(contexts[1]);
  await driver.elementById('username').type('abc@example.com');
  await driver.elementById('password').type('#1234');
  await driver.elementById('Login').click();

});

//Timeout - 在 jest.setTimeout.Error 指定的 60000 毫秒超时内未调用异步回调:超时 - 在 jest.setTimeout 指定的 60000 毫秒超时内未调用异步回调。

运行此程序后,出现上述错误。不知道我哪里错了

【问题讨论】:

    标签: ios react-native automation appium simulator


    【解决方案1】:

    尝试将 setTimeout 设置为 node setTimeout 而不是默认的jest.setTimeout

    // add below after import
    global.setTimeout = require("timers").setTimeout
    

    【讨论】:

      猜你喜欢
      • 2020-05-13
      • 2019-03-11
      • 2021-05-13
      • 2018-09-18
      • 2018-12-28
      • 2018-09-11
      • 1970-01-01
      • 2020-01-15
      相关资源
      最近更新 更多