Dockerfile:
FROM node:8.14.1-alpine
RUN apk update && apk add --no-cache openjdk8-jre
RUN apk update && apk add python py-pip curl unzip libexif udev nano
ENV CHROME_BIN=/usr/bin/chromium-browser
RUN echo @v3.8 http://nl.alpinelinux.org/alpine/v3.8/community >> /etc/apk/repositories && \
echo @v3.8 http://nl.alpinelinux.org/alpine/v3.8/main >> /etc/apk/repositories && \
apk add --no-cache \
chromium@v3.8 \
nss@v3.8
# Tell Puppeteer to skip installing Chrome. We'll be using the installed package.
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
WORKDIR /project_compile/vue_app
COPY vue_app /project_compile/vue_app
RUN rm -rf node_modules
RUN npm config set registry http://registry.npmjs.org/ && npm install
CMD npm run test:e2e:headless
When it is run, this error happens:
Error retrieving a new session from the selenium server
Connection refused! Is selenium server started?
{ value:
{ message: 'Timed out waiting for driver server to start.\nBuild info: version: \'3.141.59\', revision: \'e82be7d358\', time: \'2018-11-14T08:25:53\'\nSystem info: host: \'a3f993cb3a2b\', ip: \'172.22.0.2\', os.name: \'Linux\', os.arch: \'amd64\', os.version: \'4.15.0-33-generic\', java.version: \'1.8.0_191\'\nDriver info: driver.version: unknown',
error: 'unknown error' },
status: 13 }
ERROR Error: Command failed: /project_compile/vue_app/node_modules/nightwatch/bin/nightwatch --config nightwatch.conf.js --env chrome
Error: Command failed: /project_compile/vue_app/node_modules/nightwatch/bin/nightwatch --config nightwatch.conf.js --env chrome
at makeError (/project_compile/vue_app/node_modules/execa/index.js:174:9)
at Promise.all.then.arr (/project_compile/vue_app/node_modules/execa/index.js:278:16)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue_app@0.1.0 test:e2e:headless: `vue-cli-service test:e2e --config nightwatch.conf.js --env chrome`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue_app@0.1.0 test:e2e:headless 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/2019-01-14T12_14_57_744Z-debug.log
Seems that chrome works correctly (testable running something like chromium-browser --headless --no-sandbox --dump-dom https://www.chromestatus.com/) and also selenium seems to be working fine.
Why does the test not run? The error is not explainable.
All code is contained in this repo https://github.com/nicolalandro/vue-selenium-docker. So reproducing it is easy - clone the repo and run two commands:
The problem was that the selenium version was not aligned to chrome version.