Merry Christmas, dear smart participants I've this job
test-dev:
stage: test
script:
- mkdir -p tests/js/screens/diffs
- docker run --rm -d --name=browser_$CI_JOB_ID -p 4444:4444 -p 7900:7900 --shm-size="2g" selenium/standalone-chrome
- npx mocha tests/js/screenshots-* --timeout 50000
- npx playwright test tests/js/pw_*
- php artisan test
- docker stop browser_$CI_JOB_ID
artifacts:
when: always
name: $CI_COMMIT_SHA
untracked: true
paths:
- tests/js/screens
- tests/js/report
cache:
when: always
paths:
- storage/framework
- vendor/ #composer packages
- node_modules
- public
key:
files:
- vendor/ #composer packages
- composer.lock
tags:
- test_new_runner
The same job, but in progress for rebuild
test-dev:
# allow_failure: true
stage: test
image: selenium/standalone-chrome
script:
- mkdir -p tests/js/screens/diffs
# - docker run --rm -d --name=browser_$CI_JOB_ID -p 4444:4444 -p 7900:7900 --shm-size="2g" selenium/standalone-chrome
- npx mocha tests/js/screenshots-* --timeout 50000
- npx playwright test tests/js/pw_*
- php artisan test
# - docker stop browser_$CI_JOB_ID
artifacts:
when: always
name: $CI_COMMIT_SHA
untracked: true
paths:
- tests/js/screens
- tests/js/report
cache:
when: always
paths:
- storage/framework
- vendor/ #composer packages
- node_modules
- public
key:
files:
- vendor/ #composer packages
- composer.lock
tags:
- test_new_runner
I want to remove docker launch, because it's make a failure, but I don't undertsand how I can use this with image But if I use image I don't have npx inside I haven't any idea how to do this, can somebody help with this?
CodePudding user response:
You can use base image docker:20.10.16
then install npx
then use service
to run docker dind
and then run selenium browser in your docker.
like:
test-dev:
stage: test
image: docker:20.10.16
services:
- docker:dind
script:
- apk add --update npm
- mkdir -p tests/js/screens/diffs
- docker run --rm -d --name=browser_$CI_JOB_ID -p 4444:4444 -p 7900:7900 --shm-size="2g" selenium/standalone-chrome
- npx mocha tests/js/screenshots-* --timeout 50000
- npx playwright test tests/js/pw_*
- php artisan test
- docker stop browser_$CI_JOB_ID
artifacts:
when: always
name: $CI_COMMIT_SHA
untracked: true
paths:
- tests/js/screens
- tests/js/report
cache:
when: always
paths:
- storage/framework
- vendor/ #composer packages
- node_modules
- public
key:
files:
- vendor/ #composer packages
- composer.lock
tags:
- test_new_runner
Hope this works.