cannot run Protractor on a docker image
See original GitHub issueBug report
I’m trying to run e2e tests on CircleCI 2.0 infrastructure using a simple custom docker image, but it seems like if I use the directConnect
flag, it does’t work.
I’m using Alpine with Chromium 61 in the docker images. I’m not sure if this fails because I’m using Chromium and not Chrome.
- Node Version:
8.9
- Protractor Version:
5.2.0
- Angular Version:
5.0.3
- Browser(s):
Chromium
- Operating System and Version
Ubuntu 14
- Your protractor configuration file
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const {SpecReporter} = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
browserName: 'chrome',
// Run tests in a headless Chrome
// https://github.com/angular/protractor/blob/master/docs/browser-setup.md#using-headless-chrome
chromeOptions: {
args: [
// IMPORTANT: Required flag for running Chrome in unprivileged Docker,
// see https://github.com/karma-runner/karma-chrome-launcher/issues/125#issuecomment-312668593
'--no-sandbox',
'--headless',
'--disable-gpu'
]
}
},
// TODO: Try to figure out why using directConnect doesn't work
directConnect: true,
baseUrl: 'http://localhost:4224/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: () => {}
},
onPrepare() {
// Add jasmine spec reporter
jasmine.getEnv()
.addReporter(new SpecReporter({spec: {displayStacktrace: true}}));
// Compile TS files
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
}
};
- A relevant example test
import {AppPage} from './portal.po';
describe('App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
});
});
- Output from running the test
(node:60) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
webpack: Compiled successfully.
[12:19:40] I/file_manager - creating folder /root/gva-travel/node_modules/webdriver-manager/selenium
[12:19:40] I/update - chromedriver: unzipping chromedriver_2.33.zip
[12:19:41] I/update - chromedriver: setting permissions to 0755 for /root/gva-travel/node_modules/webdriver-manager/selenium/chromedriver_2.33
[12:19:41] I/launcher - Running 1 instances of WebDriver
[12:19:41] I/direct - Using ChromeDriver directly...
[12:19:41] E/launcher - spawn /root/gva-travel/node_modules/webdriver-manager/selenium/chromedriver_2.33 ENOENT
[12:19:41] E/launcher - Error: spawn /root/gva-travel/node_modules/webdriver-manager/selenium/chromedriver_2.33 ENOENT
at _errnoException (util.js:1024:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
[12:19:41] E/launcher - Process exited with error code 199
npm ERR! code ELIFECYCLE
npm ERR! errno 199
npm ERR! gva-travel@0.0.0 e2e:ci: `ng e2e --prod --no-progress --no-live-reload --no-watch --port 4224`
npm ERR! Exit status 199
npm ERR!
npm ERR! Failed at the gva-travel@0.0.0 e2e:ci script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-11-25T12_19_41_356Z-debug.log
Exited with code 199
- Steps to reproduce the bug
- The URL you are running your tests against (if relevant)
Issue Analytics
- State:
- Created 6 years ago
- Comments:11
Top Results From Across the Web
How to run dockerized protractor project which included ...
I created a project with angular and its works fine without docker. However, when I build the image it's successfully created. Unfortunately ...
Read more >Running E2E Test Cases Using Protractor & Docker
Our aim here is to run end to end test cases using a docker container. In order for us to run a test...
Read more >ictu/docker-protractor-headless - Docker Image
Then you want to run the dockerised Protractor against the same localhost:8000. If you don't use --net=host the container will receive the bridged...
Read more >How to run Protractor with headless Chrome on Docker
This short video tutorial shows how to run Protractor with headless (real) Chrome on Docker. The Docker image is designed as a drop...
Read more >Running Protractor tests in docker through teamcity
Remove the selenium server settings (the docker container starts one ... To get this to run I could not do this, as we...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@rolandjitsu I would suggest to not put tests and chrome in same container - for scalability and stability reasons. This allows to use ready-to-use official selenium doker files for browsers, and in future you might replace chrome container with selenium grid easily. Or even some other selenium grid replacement like Selenoid: https://medium.com/@aandryashin/selenium-done-in-60-seconds-176796f8bdc7
You can take my gist as example: https://gist.github.com/Xotabu4/a243d9ff25cfe276bcaa0175fb6a4b00
exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub' }