|
| 1 | +#!/bin/bash -ex |
| 2 | + |
| 3 | +# The script is intended for use locally, as well as in the CI. |
| 4 | +# It runs the browser-tests ("E2E" in the CI). |
| 5 | +# It expects a running IMAP server (connection configured in |
| 6 | +# `config-test.inc.php`, and a running Chrome/Chromium browser (connection |
| 7 | +# hard-coded in code, overrideable via environment variables). |
| 8 | + |
| 9 | +# Make temp and logs writeable to everyone. |
| 10 | +chmod 777 temp logs |
| 11 | + |
| 12 | +# Create downloads dir and ensure permissions (if it's set, the variable might |
| 13 | +# be blank if tests are not run using containers). |
| 14 | +if test -n "$TESTRUNNER_DOWNLOADS_DIR"; then |
| 15 | + # Use sudo because in the Github action we apparently can't use a |
| 16 | + # directory in $HOME or /tmp but another one for which we need |
| 17 | + # superuser-rights. |
| 18 | + install -m 777 -d "$TESTRUNNER_DOWNLOADS_DIR" |
| 19 | +fi |
| 20 | + |
| 21 | +if ! test -f config/config-test.inc.php; then |
| 22 | + cp -v .ci/config-test.inc.php config/config-test.inc.php |
| 23 | +fi |
| 24 | + |
| 25 | +# Install dependencies for to remote control the browser. |
| 26 | +composer require -n "nesbot/carbon:^2.62.1" --no-update |
| 27 | +composer require -n "laravel/dusk:^7.9" --no-update |
| 28 | + |
| 29 | +if $(echo $PHP_VERSION | grep -q '^8.3'); then |
| 30 | + # Downgrade dependencies (for PHP 8.3 only) |
| 31 | + composer update --prefer-dist --prefer-stable --prefer-lowest --no-interaction --no-progress --optimize-autoloader |
| 32 | +else |
| 33 | + composer update --prefer-dist --no-interaction --no-progress |
| 34 | +fi |
| 35 | + |
| 36 | +# Install development tools. |
| 37 | +npm install |
| 38 | + |
| 39 | +# Install javascript dependencies |
| 40 | +bin/install-jsdeps.sh |
| 41 | + |
| 42 | +# Compile Elastic's styles |
| 43 | +npx lessc --clean-css="--s1 --advanced" skins/elastic/styles/styles.less > skins/elastic/styles/styles.min.css |
| 44 | +npx lessc --clean-css="--s1 --advanced" skins/elastic/styles/print.less > skins/elastic/styles/print.min.css |
| 45 | +npx lessc --clean-css="--s1 --advanced" skins/elastic/styles/embed.less > skins/elastic/styles/embed.min.css |
| 46 | + |
| 47 | +# Use minified javascript files |
| 48 | +bin/jsshrink.sh |
| 49 | + |
| 50 | +# Run tests |
| 51 | +echo "TESTS_MODE: DESKTOP" |
| 52 | +TESTS_MODE=desktop vendor/bin/phpunit -c tests/Browser/phpunit.xml --fail-on-warning --fail-on-risky --exclude-group=failsonga |
| 53 | + |
| 54 | +echo "TESTS_MODE: TABLET" |
| 55 | +TESTS_MODE=tablet vendor/bin/phpunit -c tests/Browser/phpunit.xml --fail-on-warning --fail-on-risky --exclude-group=failsonga-tablet |
| 56 | + |
| 57 | +# Mobile mode tests are unreliable on Github Actions |
| 58 | +# echo "TESTS_MODE: PHONE" |
| 59 | +# TESTS_MODE=phone vendor/bin/phpunit -c tests/Browser/phpunit.xml --fail-on-warning --fail-on-risky --exclude-group=failsonga-phone |
0 commit comments