1

I have simple Protractor test that runs fine on my local system, but crashes with the error config not defined when I run it as a part of the deploy pipeline in CodeShip. Since the error is happening as a part of the browser, I haven't got any useful stack trace either. Will be helpful if someone has seen this error before.

The entire error stack says:

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)

1 Answers1

0

That might be issue with wrong format of protractor.conf.js export.

In this file your configuration should be exported outside with

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

Check that file that you referencing as config file, has exported config object with proper protractor configuration.

Here is example of file export : https://github.com/angular/protractor/blob/master/example/conf.js

Xotabu4
  • 3,063
  • 17
  • 29