在高山码头工人容器上运行硒测试时出错



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

运行时,会发生此错误:

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

似乎 chrome 工作正常(可测试运行类似 chromium--browser --无头 --no-sandbox --dump-dom https://www.chromestatus.com/)的东西),而且硒似乎工作正常。

为什么测试不运行?该错误无法解释。

所有代码都包含在此存储库 https://github.com/nicolalandro/vue-selenium-docker 中。所以重现它很容易 - 克隆存储库并运行两个命令:

  • docker-compose -f docker/test/js/docker-compose-js-e2e.yml build
  • docker-compose -f docker/test/js/docker-compose-js-e2e.yml up --exit-code-from e2e

也许你必须等待硒容器起来?

查看本指南:https://github.com/SeleniumHQ/docker-selenium#waiting-for-the-grid-to-be-ready

写下脚本以检查"就绪":true,

问题是硒版本与铬版本不一致。

最新更新