diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3c035ef..9854419 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -318,7 +318,7 @@ jobs: # Run Codeception End to End Tests. - name: Run tests/${{ matrix.test-groups }} working-directory: ${{ env.PLUGIN_DIR }} - run: php vendor/bin/codecept run tests/${{ matrix.test-groups }} --fail-fast + run: php vendor/bin/codecept run tests/${{ matrix.test-groups }} --env headless --fail-fast # Artifacts are data generated by this workflow that we want to access, such as log files, screenshots, HTML output. # The if: failure() directive means that this will run when the workflow fails e.g. if a test fails, which is needed diff --git a/tests/EndToEnd.suite.yml b/tests/EndToEnd.suite.yml index bce6fb9..df1fa6e 100644 --- a/tests/EndToEnd.suite.yml +++ b/tests/EndToEnd.suite.yml @@ -68,4 +68,27 @@ modules: wpRootFolder: '%WORDPRESS_ROOT_DIR%' dbUrl: '%WORDPRESS_DB_URL%' domain: '%WORDPRESS_DOMAIN%' - \ No newline at end of file + +# Environments +# +# Run with `vendor/bin/codecept run EndToEnd --env headless` to run Chrome in +# headless mode (used by GitHub Actions). Without `--env headless`, Chrome runs +# in headed mode so a developer can watch tests execute locally. +env: + headless: + modules: + config: + lucatume\WPBrowser\Module\WPWebDriver: + capabilities: + "goog:chromeOptions": + args: + - "--headless" + - "--disable-gpu" + - "--disable-dev-shm-usage" + - "--disable-software-rasterizer" + - "--proxy-server='direct://'" + - "--proxy-bypass-list=*" + - "--no-sandbox" + - "--user-agent=%TEST_SITE_HTTP_USER_AGENT%" + prefs: + download.default_directory: '%WORDPRESS_ROOT_DIR%' \ No newline at end of file