Skip to content

Commit

Permalink
refactor #194 Update to Travis Bionic + use headless Chrome (pamil)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.7 branch.

Discussion
----------



Commits
-------

cc77c10 Update to Travis Bionic + use headless Chrome
  • Loading branch information
pamil authored Jun 2, 2020
2 parents 4d04d9a + cc77c10 commit a1630dc
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 39 deletions.
48 changes: 23 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
language: php

dist: trusty
os: linux

sudo: false
dist: bionic

php:
- '7.3'
- '7.4'

services:
- mysql

addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
chrome: stable

cache:
yarn: true
Expand Down Expand Up @@ -35,37 +47,23 @@ before_script:
- (cd tests/Application && bin/console cache:warmup -vvv)
- (cd tests/Application && yarn build)

# Configure display
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1680x1050x16
- export DISPLAY=:99

# Download and configure ChromeDriver
- |
if [ ! -f $SYLIUS_CACHE_DIR/chromedriver ] || [ "$($SYLIUS_CACHE_DIR/chromedriver --version | grep -c 2.34)" = "0" ]; then
curl http://chromedriver.storage.googleapis.com/2.34/chromedriver_linux64.zip > chromedriver.zip
unzip chromedriver.zip
chmod +x chromedriver
mv chromedriver $SYLIUS_CACHE_DIR
fi
# Run ChromeDriver
- $SYLIUS_CACHE_DIR/chromedriver > /dev/null 2>&1 &

# Download and configure Selenium
# Downloading Symfony CLI
- |
if [ ! -f $SYLIUS_CACHE_DIR/selenium.jar ] || [ "$(java -jar $SYLIUS_CACHE_DIR/selenium.jar --version | grep -c 3.4.0)" = "0" ]; then
curl http://selenium-release.storage.googleapis.com/3.4/selenium-server-standalone-3.4.0.jar > selenium.jar
mv selenium.jar $SYLIUS_CACHE_DIR
if [ ! -f $SYLIUS_CACHE_DIR/symfony ]; then
wget https://get.symfony.com/cli/installer -O - | bash
mv ~/.symfony/bin/symfony $SYLIUS_CACHE_DIR
fi
php -v | head -n 1 | awk '{ print $2 }' > .php-version
# Run Selenium
- java -Dwebdriver.chrome.driver=$SYLIUS_CACHE_DIR/chromedriver -jar $SYLIUS_CACHE_DIR/selenium.jar > /dev/null 2>&1 &
# Run Chrome Headless
- google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 &

# Run webserver
- (cd tests/Application && bin/console server:run 127.0.0.1:8080 --quiet > /dev/null 2>&1 &)
- (cd tests/Application && $SYLIUS_CACHE_DIR/symfony server:start --port=8080 --dir=public --daemon)

script:
- composer validate

- vendor/bin/phpstan analyse -c phpstan.neon -l max src/

- vendor/bin/phpunit
Expand Down
8 changes: 7 additions & 1 deletion behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ imports:

default:
extensions:
DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~

Lakion\Behat\MinkDebugExtension:
directory: etc/build
clean_start: false
Expand All @@ -13,10 +15,14 @@ default:
files_path: "%paths.base%/vendor/sylius/sylius/src/Sylius/Behat/Resources/fixtures/"
base_url: "http://localhost:8080/"
default_session: symfony
javascript_session: chrome
javascript_session: chrome_headless
sessions:
symfony:
symfony: ~
chrome_headless:
chrome:
api_url: http://127.0.0.1:9222
validate_certificate: false
chrome:
selenium2:
browser: chrome
Expand Down
24 changes: 13 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,27 @@
"require": {
"php": "^7.3",

"sylius/sylius": "^1.7.4"
"sylius/sylius": "^1.7.5"
},
"require-dev": {
"behat/behat": "^3.6.1",
"behat/mink-selenium2-driver": "^1.3",
"behat/mink-selenium2-driver": "^1.4",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
"friends-of-behat/mink-browserkit-driver": "^1.3",
"friends-of-behat/mink-extension": "^2.2",
"friends-of-behat/mink-browserkit-driver": "^1.4",
"friends-of-behat/mink-extension": "^2.4",
"friends-of-behat/page-object-extension": "^0.3",
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/symfony-extension": "^2.0",
"friends-of-behat/variadic-extension": "^1.1",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"lakion/mink-debug-extension": "^1.2.3",
"phpspec/phpspec": "^6.1",
"phpstan/phpstan-doctrine": "^0.12",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-webmozart-assert": "^0.12",
"phpunit/phpunit": "^8.0",
"sensiolabs/security-checker": "^5.0",
"phpstan/phpstan": "0.12.25",
"phpstan/phpstan-doctrine": "0.12.13",
"phpstan/phpstan-webmozart-assert": "0.12.4",
"phpunit/phpunit": "^8.5",
"sensiolabs/security-checker": "^6.0",
"sylius-labs/coding-standard": "^3.1",
"symfony/browser-kit": "^4.4",
"symfony/debug-bundle": "^4.4|^5.0",
Expand Down
6 changes: 4 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/8.0/phpunit.xsd"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/8.5/phpunit.xsd"
colors="true"
bootstrap="tests/Application/config/bootstrap.php">
<testsuites>
Expand All @@ -11,9 +11,11 @@
</testsuites>

<php>
<ini name="error_reporting" value="-1" />

<server name="KERNEL_CLASS_PATH" value="/tests/Application/AppKernel.php" />
<server name="IS_DOCTRINE_ORM_SUPPORTED" value="true" />

<env name="APP_ENV" value="test"/>
<env name="SHELL_VERBOSITY" value="-1" />
</php>
Expand Down

0 comments on commit a1630dc

Please sign in to comment.