From d6bd764f5f3192f4dce253993b89cb96ff05ef3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Wed, 10 Jul 2019 09:24:49 +0200 Subject: [PATCH] Add support for Chromium driver (#417) * Add support for Chromium driver * Allow setting default driver --- .env | 3 +++ behat.yml.dist | 27 +++++++++++++++++---------- composer.json | 2 ++ doc/docker/README.md | 7 +++++++ doc/docker/chromium.yml | 20 ++++++++++++++++++++ 5 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 doc/docker/chromium.yml diff --git a/.env b/.env index 4dc9016afb..356b7754c5 100644 --- a/.env +++ b/.env @@ -12,6 +12,7 @@ PHP_IMAGE_DEV=ezsystems/php:7.3-v1-dev NGINX_IMAGE=nginx:stable MYSQL_IMAGE=healthcheck/mariadb SELENIUM_IMAGE=selenium/standalone-chrome-debug:3.141.59-oxygen +CHROMIUM_IMAGE=registry.gitlab.com/dmore/docker-chrome-headless:7.1 REDIS_IMAGE=healthcheck/redis SESSION_HANDLER_ID=session.handler.native_file @@ -24,7 +25,9 @@ DATASET_VARDIR=my-ez-app # Behat / Selenium config ## web host refer to the tip of the setup, so varnish if that is used. WEB_HOST=web +MINK_DEFAULT_SESSION=selenium SELENIUM_HOST=selenium +CHROMIUM_HOST=chromium # Enable recommendations by setting valid id, key and uri #RECOMMENDATIONS_CUSTOMER_ID="" diff --git a/behat.yml.dist b/behat.yml.dist index fa9a867c45..7201a8f872 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -5,16 +5,23 @@ default: Behat\MinkExtension: base_url: 'http://localhost' goutte: ~ - javascript_session: selenium2 - selenium2: - browser: chrome - wd_host: 'http://localhost:4444/wd/hub' - capabilities: - extra_capabilities: - chromeOptions: - args: - - "--window-size=1440,1080" - - "--no-sandbox" + javascript_session: selenium + sessions: + selenium: + selenium2: + browser: chrome + wd_host: 'http://localhost:4444/wd/hub' + capabilities: + extra_capabilities: + chromeOptions: + args: + - "--window-size=1440,1080" + - "--no-sandbox" + chrome: + chrome: + api_url: "http://localhost:9222" + + DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~ Behat\Symfony2Extension: kernel: diff --git a/composer.json b/composer.json index 86288dd67f..1b57c9a8ed 100644 --- a/composer.json +++ b/composer.json @@ -68,6 +68,8 @@ "behat/mink-selenium2-driver": "^1.3", "behat/symfony2-extension": "^2.1", "bex/behat-screenshot": "^1.2", + "dmore/behat-chrome-extension": "^1.3", + "dmore/chrome-mink-driver": "^2.7", "ezsystems/behat-screenshot-image-driver-cloudinary": "^1.1@dev", "ezsystems/behatbundle": "^7.0@dev", "liuggio/fastest": "^1.6", diff --git a/doc/docker/README.md b/doc/docker/README.md index e5e9b0297a..d39cfe30fd 100644 --- a/doc/docker/README.md +++ b/doc/docker/README.md @@ -41,6 +41,7 @@ The current Docker Compose files are made to be mixed and matched together for Q - varnish.yml _(optional, adds varnish service and appends config to app)_ - solr.yml _(optional, add solr service and configure app for it)_ - selenium.yml _(optional, always needs to be last, adds selenium service and appends config to app)_ +- chromium.yml _(alternative to `selenium.yml`, adds headless Chrome service, same applies here if used. Experimental)_ These can be used with `-f` argument on docker-compose, like: @@ -133,6 +134,12 @@ docker-compose exec --user www-data app sh -c "php /scripts/wait_for_db.php; php docker-compose exec --user www-data app composer ezplatform-install ``` +Note: if you want to use the Chromium driver, use +``` +export COMPOSE_FILE=doc/docker/base-prod.yml:doc/docker/chromium.yml +``` +This driver is not fully supported in our test suite and is in experimental state. + ### DFS If you want to use the DFS cluster handler, you'll need to run the migration script manually, after starting the diff --git a/doc/docker/chromium.yml b/doc/docker/chromium.yml new file mode 100644 index 0000000000..e87d8aae52 --- /dev/null +++ b/doc/docker/chromium.yml @@ -0,0 +1,20 @@ +version: '3.3' +# Appends services to prod.yml, prod+dev, prod+redis, ..., always latest + +services: + chromium: + image: ${CHROMIUM_IMAGE} + ports: + - "9222:9222" + networks: + - backend + command: tail -f /dev/null + + app: + depends_on: + - chromium + environment: + - EZP_TEST_REST_HOST=$WEB_HOST + - BEHAT_CHROMIUM_HOST=$CHROMIUM_HOST + - BEHAT_WEB_HOST=$WEB_HOST + - MINK_DEFAULT_SESSION=chrome