Appium Basic Test-参考:未定义
我正在尝试按照此处所述进行Appium测试, https ://blog.logrocket.com/testing-your-react-native-native-app-with-appium/
但是,我遇到了一个错误 - 如何使我的基本测试工作?
> [email protected] test /Users/user/apps/myracnative/appium
> mocha test/basic
ReferenceError: beforeAll is not defined
at Object.<anonymous> (/Users/user/apps/myracnative/appium/test/basic/index.js:16:1)
测试:
index.js
const wd = require("wd");
const jasmine = require("jasmine");
jasmine.DEFAULT_TIMEOUT_INTERVAL = 600000;
const PORT = 4723;
const config = {
platformName: "iOS",
platformVersion: "14.4",
deviceName: "iPhone 11",
app: "../../../apps/myracnative.ipa",
automationName: "XCUITest", // UiAutomator2, Espresso, or UiAutomator1 for Android
};
const driver = wd.promiseChainRemote("localhost", PORT);
beforeAll(async () => {
await driver.init(config);
});
test("Test Accessibilty Id", async () => {
expect(
await driver.hasElementByAccessibilityId("Create account")
).toBe(true);
expect(await driver.hasElementByAccessibilityId("Log in")).toBe(true);
});
这是我的测试回购的链接:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅当前脚本中的以下更改,因为
test.js
以使其在Local上执行,并setImpliticwaittimeout(50000)
50000
jestbeforeall()
函数,timeout
50000
to Mocha test,以下是您成功脚本执行的屏幕截图。
Please refer to the following changes in your current script as,
test.js
to get them executed on local,setImplicitWaitTimeout(50000)
to the driver config,timeout
of50000
to jestbeforeAll()
function,timeout
of50000
to mocha test,Following is the screenshot to your success script executions.
