gpt4 book ai didi

javascript - Protractor 测试失败,配置未定义

转载 作者:太空宇宙 更新时间:2023-11-04 01:52:58 25 4
gpt4 key购买 nike

我有一个简单的 Protractor 测试,它在本地系统上运行良好,但当我将其作为 CodeShip 中部署管道的一部分运行时,会因错误配置未定义而崩溃。由于错误是作为浏览器的一部分发生的,因此我也没有得到任何有用的堆栈跟踪。如果有人以前见过此错误,将会很有帮助。

整个错误堆栈显示:

Message:
Failed: unknown error: config is not defined
(Session info: headless chrome=64.0.3282.167)
(Driver info: chromedriver=2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881),platform=Linux 4.4.0-112-generic x86_64)
Stack:
WebDriverError: unknown error: config is not defined
(Session info: headless chrome=64.0.3282.167)
(Driver info: chromedriver=2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881),platform=Linux 4.4.0-112-generic x86_64)
at Object.checkLegacyResponse (/home/rof/src/github.com/myproject/node_modules/selenium-webdriver/lib/error.js:546:15)
at parseHttpResponse (/home/rof/src/github.com/myproject/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/home/rof/src/github.com/myproject/node_modules/selenium-webdriver/lib/http.js:441:30)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:169:7)
From: Task: Protractor.get(http://localhost:3002/automation/abandoned-cart/) - resume bootstrap
at thenableWebDriverProxy.schedule (/home/rof/src/github.com/myproject/node_modules/selenium-webdriver/lib/webdriver.js:807:17)
at ProtractorBrowser.executeScriptWithDescription (/home/rof/src/github.com/myproject/node_modules/protractor/built/browser.js:404:28)
at modulePromise.then (/home/rof/src/github.com/myproject/node_modules/protractor/built/browser.js:744:54)
at ManagedPromise.invokeCallback_ (/home/rof/src/github.com/myproject/node_modules/selenium-webdriver/lib/promise.js:1376:14)
at TaskQueue.execute_ (/home/rof/src/github.com/myproject/node_modules/selenium-webdriver/lib/promise.js:3084:14)
at TaskQueue.executeNext_ (/home/rof/src/github.com/myproject/node_modules/selenium-webdriver/lib/promise.js:3067:27)
at asyncRun (/home/rof/src/github.com/myproject/node_modules/selenium-webdriver/lib/promise.js:2927:27)
at /home/rof/src/github.com/myproject/node_modules/selenium-webdriver/lib/promise.js:668:7
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:169:7)
From: Task: Run it("should remember the state after a refresh") in control flow
at UserContext.<anonymous> (/home/rof/src/github.com/myproject/node_modules/jasminewd2/index.js:94:19)
at /home/rof/src/github.com/myproject/node_modules/jasminewd2/index.js:64:48
at ControlFlow.emit (/home/rof/src/github.com/myproject/node_modules/selenium-webdriver/lib/events.js:62:21)
at ControlFlow.shutdown_ (/home/rof/src/github.com/myproject/node_modules/selenium-webdriver/lib/promise.js:2674:10)
From asynchronous test:
Error
at Suite.describe (/home/rof/src/github.com/myproject/specs/automation-abandoned-cart.js:2:3)
at Object.<anonymous> (/home/rof/src/github.com/myproject/specs/automation-abandoned-cart.js:1:63)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)

最佳答案

这可能是由于 protractor.conf.js 导出格式错误造成的问题。

在此文件中,您的配置应使用

导出到外部

module.exports.config = ...您的配置。

检查您引用为配置文件的文件是否已导出具有正确 Protractor 配置的 config 对象。

以下是文件导出的示例: https://github.com/angular/protractor/blob/master/example/conf.js

关于javascript - Protractor 测试失败,配置未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48998435/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com