这是我第一次尝试使用Spectron为Electron应用程序创建自动化测试。这可能是我对异步编程的生疏知识,但我不知道为什么下面的代码行为不端:
it ('should allow me to create an account', function() {
return app.client
.waitUntilWindowLoaded()
.waitForExist('//a[text()="Create Free Account"]')
.click('//a[text()="Create Free Account"]')
.waitForExist('//button[text()="Create Account"]')
.setValue('#Email', "test@test.com")
.setValue('#Password', "Password1!")
.click('//button[text()="Create Account"]')
.waitForExist('//p[contains(text(),"Almost done.")]')
});测试看起来就像第一次点击(),然后它应该等待应用程序请求一个新的页面,最终显示一个"Create Account“按钮。然而,由于某些原因,应用程序本身似乎在这一点上受阻。我知道滴答声正在发生。当我手动尝试时,应用程序运行正常。
标记
发布于 2018-07-04 11:20:17
我认为你需要等到下一个页面加载
也是链条
.pause(3*1000) 单击该按钮后
(或)
.waitUntilWindowLoaded(3*1000)https://stackoverflow.com/questions/44750921
复制相似问题