【发布时间】:2021-04-09 16:13:40
【问题描述】:
我正在使用 webdriverIO v7 和 cucumber 来测试我的应用程序。
我有包含 10 个场景的功能文件。
发生的情况是,当我运行测试时,前 4 个场景无缝执行,而在第五个场景中我突然收到错误:
unknown error: java.net.ConnectException: Connection refused: connect
at Object.getErrorFromResponseBody (C:\my-project\node_modules\webdriver\build\utils.js:189:12)
at WebDriverRequest._request (C:\my-project\node_modules\webdriver\build\request.js:168:31)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at Browser.runCommandWithHooks (C:\my-project\node_modules\@wdio\sync\build\wrapCommand.js:105:25)
at Browser.runCommandWithHooks (C:\my-project\node_modules\@wdio\sync\build\wrapCommand.js:100:24)
at Browser.url (C:\my-project\node_modules\@wdio\sync\build\wrapCommand.js:67:44)
at MyPage.openImportPage (C:\my-project\src\pages\/myPage.js:32:17)
at forEach (C:\my-project\src\helpers\/helpers.js:60:21)
at Array.forEach (<anonymous>)
at Helpers.deleteWishLists (C:\my-project\src\helpers\/helpers.js:55:51)
at World.<anonymous> (C:\my-project\src\step_definitions\/config_steps.js:28:13)
at World.executeSync (C:\my-project\node_modules\@wdio\sync\build\index.js:38:22)
at World.executeSync (C:\my-project\node_modules\@wdio\sync\build\index.js:52:38)
at C:\my-project\node_modules\@wdio\sync\build\index.js:69:68
第五个场景的第一步也是在之前的场景中执行的,正常成功。
它的行为不一致 - 例如,在非无头模式下第二次运行时,所有场景都通过了(突然之间)。
在无头模式下运行,有时所有场景都会失败,但有时会失败,有时只有一些失败 - 没有规则可以注意到。
这非常令人困惑。我认为这与我的测试无关,因为有时它们都通过了,但与我的设置或互联网连接或 webdriverIO 框架及其独立模式有关...
有没有人知道为什么会发生这种情况。谁是这里的麻烦制造者?
我什至不知道应该从哪个方向进行调查。
请帮忙。
谢谢!
【问题讨论】:
标签: cucumber webdriver-io