I have managed to build my acceptance tests with chrome headless without selenium, they work well locally but I can not get them to work in travis.yml.
travis.yml:
language: php
php:
- 7.2
- 7.3
addons:
chrome: stable
# faster builds on new travis setup not using sudo
sudo: false
# cache vendor dirs
cache:
directories:
- $HOME/.composer/cache
service:
- mysql
before_install:
- which google-chrome
- mysql -e 'CREATE DATABASE ModuleUser;'
install:
- travis_retry composer self-update && composer --version
- travis_retry composer update --prefer-dist --no-interaction
before_script:
- wget https://chromedriver.storage.googleapis.com/74.0.3729.6/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip -d vendor/bin
- vendor/bin/chromedriver --url-base=wd/hub > /dev/null 2>&1&
- vendor/bin/yii migrate --migrationPath=@TerabyteSoft/Module/User/Migrations --interactive=0
script:
- |
cd tests
php -S 127.0.0.1:8080 -t public > /dev/null 2>&1&
cd ..
vendor/bin/codecept build
vendor/bin/codecept run
after_script:
- |
if [ $TRAVIS_PHP_VERSION = '7.3' ]; then
travis_retry wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover tests/_output/coverage.xml
fi
Error TravisCI:
1) SignUpCest: Sign up register success data test
Test tests/acceptance/SignUpCest.php:signUpRegisterSuccessDataTest
[Facebook\WebDriver\Exception\UnknownServerException] unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Linux 4.4.0-101-generic x86_64)
#1 /home/travis/build/terabytesoft/app-user/vendor/facebook/webdriver/lib/Exception/WebDriverException.php:114
#2 /home/travis/build/terabytesoft/app-user/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:326
#3 /home/travis/build/terabytesoft/app-user/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:126
#4 /home/travis/build/terabytesoft/app-user/vendor/symfony/event-dispatcher/EventDispatcher.php:212
#5 /home/travis/build/terabytesoft/app-user/vendor/symfony/event-dispatcher/EventDispatcher.php:44
Artifacts:
Png: /home/travis/build/terabytesoft/app-user/tests/_output/ModuleUser.SignUpCest.signUpRegisterSuccessDataTest.fail.png
Html: /home/travis/build/terabytesoft/app-use
[https://travis-ci.org/terabytesoft/app-user/jobs/537436601](php 7.2 travisci)
[https://travis-ci.org/terabytesoft/app-user/jobs/537436602](php 7.2 travisci)