Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Chrome headless on docker #29

Merged
merged 1 commit into from
Apr 15, 2023
Merged

Conversation

ylecuyer
Copy link
Contributor

Hello, I'm migrating our jasmine integration from the legacy ruby version to the latest javascript version. Everything was working well until I moved the test suite to docker (gitlab CI), here chrome headless wasn't working:

root@d131d44a7f93:/app# ./node_modules/jasmine-browser-runner/bin/jasmine-browser-runner runSpecs --config=spec/javascripts/support/jasmine.json --browser=headlessChrome
Jasmine server is running here: http://localhost:42071
Jasmine tests are here:         /app/spec/javascripts
Source files are here:          /app/public/assets
Running tests in the browser...
NoSuchSessionError: invalid session id
    at Object.throwDecodedError (/app/node_modules/selenium-webdriver/lib/error.js:524:15)
    at parseHttpResponse (/app/node_modules/selenium-webdriver/lib/http.js:587:13)
    at Executor.execute (/app/node_modules/selenium-webdriver/lib/http.js:515:28)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async thenableWebDriverProxy.execute (/app/node_modules/selenium-webdriver/lib/webdriver.js:741:17)
    at async Object.runSpecs (/app/node_modules/jasmine-browser-runner/index.js:134:9)
    at async Command.runSpecs (/app/node_modules/jasmine-browser-runner/lib/command.js:187:5) {
  remoteStacktrace: '#0 0x562b164362a3 <unknown>\n' +
    '#1 0x562b161f4dfd <unknown>\n' +
    '#2 0x562b16224a05 <unknown>\n' +
    '#3 0x562b16225fde <unknown>\n' +
    '#4 0x562b1648663e <unknown>\n' +
    '#5 0x562b16489b79 <unknown>\n' +
    '#6 0x562b1646c89e <unknown>\n' +
    '#7 0x562b1648aa83 <unknown>\n' +
    '#8 0x562b1645f505 <unknown>\n' +
    '#9 0x562b164abca8 <unknown>\n' +
    '#10 0x562b164abe36 <unknown>\n' +
    '#11 0x562b164c7333 <unknown>\n' +
    '#12 0x7f4768c1a4a4 start_thread\n'
}

This is because --disable-dev-shm-usage is missing from the options sent to chrome when starting

With the proper option it works as expected:

root@d131d44a7f93:/app# ./node_modules/jasmine-browser-runner/bin/jasmine-browser-runner runSpecs --config=spec/javascripts/support/jasmine.json --browser=headlessChrome
Jasmine server is running here: http://localhost:39429
Jasmine tests are here:         /app/spec/javascripts
Source files are here:          /app/public/assets
Running tests in the browser...
Randomized with seed 05143
Started
...................................................................................................................................................................................................................................................................................


275 specs, 0 failures
Finished in 6.241 seconds
Randomized with seed 05143 (jasmine-browser-runner runSpecs --seed=05143)

@sgravrock
Copy link
Member

Thanks for your contribution. This might actually fix some occasional CI failures I've seen.

Would you mind adding a comment explaining what the flag is for and squashing your commits:? If you're not comfortable squashing I can do it for you, but in that case GitHub won't show the PR as merged.

@ylecuyer
Copy link
Contributor Author

Would you mind adding a comment explaining what the flag is for and squashing your commits:? If you're not comfortable squashing I can do it for you, but in that case GitHub won't show the PR as merged.

done

@sgravrock sgravrock merged commit 7d114dc into jasmine:main Apr 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants