【问题标题】:Protractor test fails with config not defined量角器测试失败,未定义配置
【发布时间】:2018-08-06 11:53:46
【问题描述】:

我有一个简单的量角器测试,可以在我的本地系统上正常运行,但是当我将它作为 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)

【问题讨论】:

  • 请用您的代码试验更新问题。

标签: javascript node.js selenium protractor codeship


【解决方案1】:

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

在这个文件中你的配置应该用

导出到外面

module.exports.config = ... Your config here.

检查您引用为配置文件的文件,是否已导出 config 具有适当量角器配置的对象。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-05
    • 1970-01-01
    相关资源
    最近更新 更多