Running tests in Gitlab CI

782 views
Skip to first unread message

Tim Goodwin

unread,
Aug 8, 2019, 1:14:19 PM8/8/19
to NightwatchJs
I'm struggling to get the tests to run in gitlab ci.

Here is a sample of ci.yml
Enter code here...image: node:10.1.0

stages:
- build
- deploy
- e2e

cache:
paths:
- node_modules/

build:
stage: build
script:
- npm install
- npm run build:prod

artifacts:
paths:
- dist/
expire_in: 1 week

e2e:chrome:
stage: e2e
script:
- npm install --prefix nightwatchE2E/
- npm test --prefix nightwatchE2E/ -- --env ci
services:
- selenium/standalone-chrome

variables:
GIT_SSL_NO_VERIFY: "true"

And here is what's in the nightwatch.json file...

Enter code here...{
"src_folders": [
"tests"
],
"output_folder": "reports",
"custom_commands_path": "lib/commands/",
"custom_assertions_path": "",
"page_objects_path": [
"lib/pages/"
],
"globals_path": "",
"selenium": {
"start_process": true,
"server_path": "bin/selenium-server-standalone-3.141.59.jar",
"log_path": "",
"port": 4444,
"cli_args": {
"webdriver.chrome.driver": "bin/chromedriver",
"webdriver.gecko.driver": "",
"webdriver.edge.driver": ""
}
},
"test_settings": {
"default": {
"launch_url": "http://www.google.com",
"selenium_port": 4444,
"selenium_host": "127.0.0.1",
"silent": true,
"use_xpath": true,
"screenshots": {
"enabled": false,
"path": ""
},
"desiredCapabilities": {
"browserName": "chrome",
"marionette": true,
"chromeOptions": {
"args": [
"disable-notifications",
[
"--no-sandbox"
]
],
"w3c": false
}
},
"globals": {
"waitForConditionTimeout": 10000,
"retryAssertionTimeout": 5000
}
},
"chrome": {
"desiredCapabilities": {
"browserName": "chrome"
}
},
"edge": {
"desiredCapabilities": {
"browserName": "MicrosoftEdge"
}
},
"ci": {
"selenium_host": "selenium/standalone-chrome",
"selenium": {
"start_process": false
}
}
}
}

I'm currently getting the error of:
 POST http://selenium/standalone-chrome:4444 /wd/hub/session - ENOTFOUND
Error: getaddrinfo ENOTFOUND selenium/standalone-chrome selenium/standalone-chrome:4444
    at errnoException (dns.js:50:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:95:26)
   An error occurred while retrieving a new session: "getaddrinfo ENOTFOUND selenium/standalone-chrome selenium/standalone-chrome:4444"

Any suggestions or help is appreciated as this is first time trying nightwatch and integration with gitlab ci

Tim Goodwin

unread,
Aug 9, 2019, 11:17:27 AM8/9/19
to NightwatchJs
Fix the issue, saw that the selenium_host was set wrong, changed it to selenium--standalone-chrome and now have them running.
Reply all
Reply to author
Forward
0 new messages