我已升级到Protractor 6.0.0和Jasmine 3.3.1,并且必须重做所有测试以异步运行。
当我的量角器测试完成运行时,我最后有一个无法解释的错误。没有测试失败,但这个过程似乎不规则地中止。我在最新的webdriver中运行Chrome 73,我不得不专门降级到Chrome 73 webdriver,因为74仍然处于测试阶段。
以下是测试运行的快照:
测试套件1测试
√ should check first thing √ should check second thing √ should display another thing
94个规格中的3个未完成(89 SKIPPED)。 C:\ Users \ Joon \ AppData \ Roaming \ npm \ node_modules \ protractor \ node_modules \ jasmine-core \ lib \ jasmine-core \ jasmine.js:3190 throw arguments [0]; ^
NoSuchSessionError:在Object.checkLegacyResponse上无效的会话ID(驱动程序信息:chromedriver = 73.0.3683.68(47787ec04b6e38e22703e856e101e840b65afe72),platform = Windows NT 10.0.17134 x86_64)(C:\ Users \ Joon \ AppData \ Roaming \ npm \ node_modules \ protractor \ node_modules \ selenium-webdriver \ lib \ error.js:585:15)at parseHttpResponse(C:\ Users \ Joon \ AppData \ Roaming \ npm \ node_modules \ protractor \ node_modules \ selenium-webdriver \ lib \ http.js:533:13 )在process._tickCallback(internal / process / next_tick)的Executor.execute(C:\ Users \ Joon \ AppData \ Roaming \ npm \ node_modules \ protractor \ node_modules \ selenium-webdriver \ lib \ http.js:468:26)的.js:188:7)
没有其他错误消息,我发现有唯一的其他SO帖子有相同的错误消息后还有一个额外的承诺拒绝错误。
如何调试/排除导致此错误的原因?
我想通了 - 有一些对browser.wait的调用没有等待它们。
其中一个导致同步错误,导致在测试运行结束时出现未指定的状态管理错误。
对于从控制流升级到异步流后遇到WebDriver状态错误的任何其他人 - 请确保在所有Protractor浏览器交互调用之前等待调用。我错过的是browser.wait,但它可能是任何其他调用Protractor导致此问题