Use a service for selenium server

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2021-02-08 19:25:52 +01:00
parent 2dd0c07ea7
commit dc2a2fd479
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889

View File

@ -20,7 +20,36 @@ jobs:
MYSQL_ROOT_PASSWORD: testbench
ports:
- "3306:3306"
options: --name db-server --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
options: >-
--name database-server
--hostname database-server
--add-host database-server:127.0.0.1
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
selenium-server:
image: selenium/standalone-chrome:3.141.59
volumes:
- /dev/shm:/dev/shm
options: >-
--health-cmd "/opt/bin/check-grid.sh"
env:
SCREEN_WIDTH: 1920
SCREEN_HEIGHT: 1080
ports:
- "4444:4444"
docker-host-bridge:
# Allow accessing localhost ports from docker containers.
# See https://github.com/qoomon/docker-host
image: qoomon/docker-host
options: >-
--name docker-host-bridge
--hostname docker-host-bridge
--add-host docker-host-bridge:127.0.0.1
--cap-add=NET_ADMIN
--cap-add=NET_RAW
--restart on-failure
strategy:
matrix:
php-version: ["7.1"]
@ -62,8 +91,6 @@ jobs:
run: yarn install --non-interactive --production
- name: Install nginx and php-fpm
run: sudo apt-get install -y nginx php-fpm
- name: Start selenium server
run: docker run -d -e SCREEN_WIDTH=1920 -e SCREEN_HEIGHT=1080 --rm --name=selenium --net=host -v /dev/shm:/dev/shm selenium/standalone-chrome:3.141.59
- name: Copy the config
run: cp test/config.e2e.inc.php config.inc.php
- name: Start server
@ -72,21 +99,22 @@ jobs:
FPM_PATH: php-fpm8.0
SKIP_STANDALONE: 1
run: ./test/start-local-server
- name: Run php tests
- name: Run selenium tests
env:
CI_MODE: selenium
TESTSUITE_SELENIUM_BROWSER: chrome
TESTSUITE_USER: root
TESTSUITE_URL: http://127.0.0.1:8000
TESTSUITE_SERVER: "db-server"
# Port defined in test/nginx.conf
TESTSUITE_URL: http://docker-host-bridge:8000
TESTSUITE_SERVER: "database-server"
TESTSUITE_DATABASE: "selenium"
TESTSUITE_SELENIUM_HOST: "127.0.0.1"
TESTSUITE_SELENIUM_PORT: "4444"
# Allowed errors: https://github.com/phpmyadmin/phpmyadmin/issues/16479
continue-on-error: true
run: ./vendor/bin/phpunit --group selenium --verbose --debug
- name: Output selenium server logs
- name: Output logs
if: ${{ success() || failure() }}
run: docker logs selenium
- name: Stop selenium server
if: ${{ success() || failure() }}
run: docker stop selenium
run: |
if [ -f php.log ] ; then cat php.log ; fi
if [ -f nginx-error.log ] ; then cat nginx-error.log ; fi