Tim*_*Tim 7 webdriver-io electron spectron
我正在使用spectron对我的电子应用程序运行集成测试.除了尝试测试应用程序设置在应用程序重新启动之间正确保留之外,一切正常.
在运行测试时,我的应用程序启动userData每个测试的新临时目录,以确保测试被隔离.这意味着持久性测试需要理想地在单个测试中进行,为实现这一点,我必须在测试过程中重新启动应用程序.有一种app.restart方法,所以必须得到支持吗?
我正在使用以下光谱测试代码:
// save some settings here
await app.restart();
await app.client.waitUntilWindowLoaded()
// do some more checking to ensure the app is fully loaded
// check the settings here
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
Error: waitUntilWindowLoaded Promise was rejected with the following reason:
Error: A session id is required for this command but wasn't found in the response payload
Run Code Online (Sandbox Code Playgroud)
这样做的正确方法是什么?我也尝试停止Application实例并启动一个具有类似结果的新实例.
这似乎有效
// save some settings here
await app.stop();
app = new Application({ ... });
await app.start();
await app.client.waitUntilWindowLoaded();
// do some more checking to ensure the app is fully loaded
// check the settings here
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
813 次 |
| 最近记录: |