I edited the question.
If someone can help me to understand why my test doesn't work, it would be very appreciated.
It seems to me that Selenium server starts and Chromedriver starts (please take a look at 'selenium-debug.log' section), but tests scripts are not executed.
My codes work on my Mac, but I don't know why they don't on a Linux server.
My codes are here: https://github.com/watarumohawk/nightwatchjs-e2e
On the server, node is v7.2.0, and npm is v4.0.5. So I installed these versions on my Mac, but I still can't reproduce the issue on my Mac.
On my Mac, 'npm run test:amazon' and 'node_modules/nightwatch/bin/nightwatch' work.
On the Linux server, I tried this:
node_modules/nightwatch/bin/nightwatch
$ node_modules/nightwatch/bin/nightwatch
Starting selenium server in parallel mode... started - PID: 29825
Started child process for: amazon/amazon-top
>> amazon/amazon-top finished.
npm run test:amazon
$ npm run test:amazon
> Nightwatch-e2e@1.1.0 test:amazon /home/foo/work/hoge/nightwatchjs-e2e
> nightwatch --group amazon
Starting selenium server in parallel mode... started - PID: 30066
Started child process for: amazon/amazon-top
>> amazon/amazon-top finished.
npm ERR! Linux 3.10.0-327.4.5.el7.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test:amazon"
npm ERR! node v7.2.0
npm ERR! npm v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! Nightwatch-e2e@1.1.0 test:amazon: `nightwatch --group amazon`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Nightwatch-e2e@1.1.0 test:amazon script 'nightwatch --group amazon'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the Nightwatch-e2e package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! nightwatch --group amazon
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs Nightwatch-e2e
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls Nightwatch-e2e
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/foo/work/hoge/nightwatchjs-e2e/npm-debug.log
Settings:
package.json
{
......
"scripts": {
"test": "nightwatch",
"test:amazon": "nightwatch --group amazon"
},
"dependencies": {
"chai-nightwatch": "^0.1.1",
"chromedriver": "^2.32.3",
"nightwatch": "^0.9.16",
"selenium-server-standalone-jar": "3.6.0"
},
"devDependencies": {}
}
nightwatch.json
{
"src_folders" : ["tests"],
"output_folder" : "reports",
"custom_commands_path" : "",
"custom_assertions_path" : "",
"page_objects_path" : "",
"globals_path" : "",
"test_workers" : {"enabled" : true, "workers" : "auto"},
"selenium" : {
"start_process" : true,
"server_path" : "node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-3.6.0.jar",
"log_path" : "",
"host" : "127.0.0.1",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "node_modules/chromedriver/lib/chromedriver/chromedriver",
"webdriver.ie.driver" : ""
}
},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"selenium_port" : 4444,
"selenium_host" : "localhost",
"silent": true,
"firefox_profile": false,
"chrome_driver" : "",
"screenshots" : {
"enabled" : true,
"path" : "screenshots",
"on_failure": true,
"on_error": false
},
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"chromeOptions": {
"args": ["--headless","--window-size=1920,1080"]
},
"use_xpath": false
}
}
}
}
Logs:
selenium-debug.log
15:31:22.180 INFO - Selenium build info: version: '3.6.0', revision: '6fbf3ec767'
15:31:22.180 INFO - Launching a standalone Selenium Server
2017-10-19 15:31:22.193:INFO::main: Logging initialized @159ms to org.seleniumhq.jetty9.util.log.StdErrLog
15:31:22.228 INFO - Driver class not found: com.opera.core.systems.OperaDriver
15:31:22.247 INFO - Driver provider class org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform LINUX
15:31:22.247 INFO - Driver provider class org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform LINUX
15:31:22.247 INFO - Driver provider class org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform LINUX
15:31:22.264 INFO - Using the passthrough mode handler
2017-10-19 15:31:22.281:INFO:osjs.Server:main: jetty-9.4.5.v20170502
2017-10-19 15:31:22.297:WARN:osjs.SecurityHandler:main: ServletContext@o.s.j.s.ServletContextHandler@eec5a4a{/,null,STARTING} has uncovered http methods for path: /
2017-10-19 15:31:22.300:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@eec5a4a{/,null,AVAILABLE}
2017-10-19 15:31:22.310:INFO:osjs.AbstractConnector:main: Started ServerConnector@9660f4e{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-10-19 15:31:22.311:INFO:osjs.Server:main: Started @278ms
15:31:22.311 INFO - Selenium Server is up and running
2017-10-19 15:31:22.528:INFO:osjshC.ROOT:qtp1910163204-11: org.openqa.selenium.remote.server.WebDriverServlet-28d25987: Initialising WebDriverServlet
15:31:22.552 INFO - Binding default provider to: org.openqa.selenium.chrome.ChromeDriverService
15:31:22.553 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.BeginSession@41c87be0
15:31:22.555 INFO - /session: Executing POST on /session (handler: BeginSession)
15:31:22.587 INFO - Capabilities are: Capabilities {acceptSslCerts=true, name=Amazon / Amazon Top, browserName=chrome, javascriptEnabled=true, use_xpath=false, chromeOptions={args=[--headless, --window-size=1920,1080]}, platformName=ANY, platform=ANY, }
15:31:22.587 INFO - Capabilities {acceptSslCerts=true, name=Amazon / Amazon Top, browserName=chrome, javascriptEnabled=true, use_xpath=false, chromeOptions={args=[--headless, --window-size=1920,1080]}, platformName=ANY, platform=ANY, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
15:31:22.588 INFO - Capabilities {acceptSslCerts=true, name=Amazon / Amazon Top, browserName=chrome, javascriptEnabled=true, use_xpath=false, chromeOptions={args=[--headless, --window-size=1920,1080]}, platformName=ANY, platform=ANY, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
15:31:22.588 INFO - Capabilities {acceptSslCerts=true, name=Amazon / Amazon Top, browserName=chrome, javascriptEnabled=true, use_xpath=false, chromeOptions={args=[--headless, --window-size=1920,1080]}, platformName=ANY, platform=ANY, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4) on port 27120
Only local connections are allowed.
npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'test:amazon' ]
2 info using npm@4.0.5
3 info using node@v7.2.0
4 verbose run-script [ 'pretest:amazon', 'test:amazon', 'posttest:amazon' ]
5 info lifecycle Nightwatch-e2e@1.1.0~pretest:amazon: Nightwatch-e2e@1.1.0
6 silly lifecycle Nightwatch-e2e@1.1.0~pretest:amazon: no script for pretest:amazon, continuing
7 info lifecycle Nightwatch-e2e@1.1.0~test:amazon: Nightwatch-e2e@1.1.0
8 verbose lifecycle Nightwatch-e2e@1.1.0~test:amazon: unsafe-perm in lifecycle true
9 verbose lifecycle Nightwatch-e2e@1.1.0~test:amazon: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/foo/work/hoge/nightwatchjs-e2e/node_modules/.bin:/home/foo/.pyenv/shims:/home/foo/.pyenv/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/foo/.local/bin:/home/foo/bin
10 verbose lifecycle Nightwatch-e2e@1.1.0~test:amazon: CWD: /home/foo/work/hoge/nightwatchjs-e2e
11 silly lifecycle Nightwatch-e2e@1.1.0~test:amazon: Args: [ '-c', 'nightwatch --group amazon' ]
12 silly lifecycle Nightwatch-e2e@1.1.0~test:amazon: Returned: code: 1 signal: null
13 info lifecycle Nightwatch-e2e@1.1.0~test:amazon: Failed to exec test:amazon script
14 verbose stack Error: Nightwatch-e2e@1.1.0 test:amazon: `nightwatch --group amazon`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:885:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid Nightwatch-e2e@1.1.0
16 verbose cwd /home/foo/work/hoge/nightwatchjs-e2e
17 error Linux 3.10.0-327.4.5.el7.x86_64
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test:amazon"
19 error node v7.2.0
20 error npm v4.0.5
21 error code ELIFECYCLE
22 error Nightwatch-e2e@1.1.0 test:amazon: `nightwatch --group amazon`
22 error Exit status 1
23 error Failed at the Nightwatch-e2e@1.1.0 test:amazon script 'nightwatch --group amazon'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the Nightwatch-e2e package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error nightwatch --group amazon
23 error You can get information on how to open an issue for this project with:
23 error npm bugs Nightwatch-e2e
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls Nightwatch-e2e
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]