Home > Mobile >  How I can run selenium?
How I can run selenium?

Time:01-13

I've stage, where I make tests for our app

test-dev:
  stage: test
  image: selenium/standalone-chrome
  image: node:14.15.0-stretch
  script:
    - npm i
    - npm run prod
    - /opt/bin/start-selenium-standalone.sh
    - npx mocha tests/js/screenshots-* --timeout 50000
    - npx playwright test tests/js/pw_*
    - php artisan test
  artifacts:
    when: always
    name: $CI_COMMIT_SHA
    untracked: true
    paths:
      - tests/js/screenshots/
      - tests/js/screens/
      - tests/js/report/
  cache:
    untracked: true
    when: always
    paths:
      - tests/js/screenshots/
      - tests/js/screens/
      - tests/js/report/
      - storage/
      - vendor/ #composer packages
      - node_modules
      - public

But the system can't find start-selenium-standalone.sh, in the original docker image it is in /opt/bin How I can launch it?

CodePudding user response:

I wrote next Dockerfile and use them:

Dockerfile

FROM ubuntu:latest
FROM node:14.15.0-stretch AS node
RUN npm i libnpx
FROM selenium/standalone-chrome:latest as sel

USER root
#selenium copy
#COPY --from=sel /opt/bin/start-selenium-standalone.sh /opt/bin/start-selenium-standalone.sh
#COPY --from=sel /etc/supervisor/conf.d/ /etc/supervisor/conf.d/
#COPY --from=sel /opt/bin/generate_config /opt/bin/generate_config
#COPY --from=sel /opt/selenium/config.toml /opt/selenium/config.toml
#COPY --from=sel /opt/selenium/browser_name /opt/selenium/browser_name
#ENV SE_RELAX_CHECKS true
EXPOSE 4444
EXPOSE 7900

#Nodejs
#COPY --from=node / /
COPY --from=node /usr/local/lib/ /usr/local/lib/
COPY --from=node /usr/local/bin/ /usr/local/bin/
COPY --from=node /usr/local/bin/ /usr/local/bin/
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm


LABEL miekrif uzvar-selenium

CMD ["bash"]

In following job:

test-dev:
  stage: test
  image: miekrif/uzavr-selenium:latest
  script:
    - nohup /opt/bin/entry_point.sh &
    - npx mocha tests/js/screenshots-* --timeout 50000
    - npx playwright test tests/js/pw_*
    - php artisan test
  artifacts:
    when: always
    name: $CI_COMMIT_SHA
    untracked: true
    paths:
      - tests/js/screenshots/
      - tests/js/screens/
      - tests/js/report/
  cache:
    untracked: true
    when: always
    paths:
      - tests/js/screenshots/
      - tests/js/screens/
      - tests/js/report/
      - storage/
      - vendor/ #composer packages
      - node_modules
      - public
  tags:
    - test_new_runner
  only:
    - ned_runner #Затычка бранча чтобы ранер не запускался
#    - develop
  • Related