【发布时间】: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