Skip to content

Commit 55bf208

Browse files
committed
behat use chrome headless
1 parent 056928c commit 55bf208

File tree

1 file changed

+79
-55
lines changed

1 file changed

+79
-55
lines changed

.github/workflows/behat.yaml

Lines changed: 79 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,25 @@ jobs:
1818
matrix:
1919
php: [7.4]
2020
sylius: ['~1.7.0']
21+
node: [10.x]
2122

2223
env:
23-
APP_ENV: test
24+
APP_ENV: test_cached
2425

2526
steps:
26-
- name: PHP - Switch
27-
run: sudo update-alternatives --set php /usr/bin/php${{ matrix.php }} && php -v
28-
29-
- name: PHP - Setup timezone
30-
run: |
31-
echo "date.timezone=UTC" >> /tmp/timezone.ini; \
32-
sudo mv /tmp/timezone.ini /etc/php/${{ matrix.php }}/cli/conf.d/timezone.ini
27+
- name: Setup PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: "${{ matrix.php }}"
31+
extensions: intl
32+
tools: symfony, composer:v1
33+
coverage: none
34+
ini-values: date.timezone=Europe/Paris
35+
36+
- name: Setup Node
37+
uses: actions/setup-node@v1
38+
with:
39+
node-version: "${{ matrix.node }}"
3340

3441
- uses: actions/checkout@v2
3542
with:
@@ -46,11 +53,6 @@ jobs:
4653
run: mkdir -p /home/runner/.composer/cache
4754
if: steps.cache-composer.outputs.cache-hit != 'true'
4855

49-
- name: Composer - Self Update
50-
run: |
51-
mkdir -p /home/runner/.composer/
52-
sudo composer self-update
53-
5456
- name: Composer - Github Auth
5557
run: composer config -g github-oauth.github.com ${{ github.token }}
5658

@@ -62,28 +64,34 @@ jobs:
6264
run: |
6365
composer config repositories.plugin '{"type": "path", "url": "../theme/"}'
6466
67+
- name: Composer - Config
68+
working-directory: ./sylius
69+
run: |
70+
composer config extra.symfony.allow-contrib true
71+
composer config minimum-stability "dev"
72+
composer config prefer-stable true
73+
74+
- name: Composer - Install plugin
75+
working-directory: ./sylius
76+
run: composer require sylius/bootstrap-theme --prefer-source --no-scripts
77+
6578
- name: Theme - Install Theme
6679
working-directory: ./sylius
67-
run: composer require sylius/bootstrap-theme encore
80+
run: composer require encore
6881

6982
- name: Theme - Copy Theme
7083
working-directory: ./sylius
7184
run: |
7285
mkdir -p themes/BootstrapTheme/
7386
cp -r ../theme/* themes/BootstrapTheme/
74-
75-
- name: Theme - Install dependencies
76-
working-directory: ./sylius
77-
run: |
78-
yarn
79-
yarn add @symfony/webpack-encore sass-loader@^7.0.0 node-sass lodash.throttle -D
80-
yarn add bootstrap@^4.5.0 bootstrap.native@^3.0.0 glightbox axios form-serialize @fortawesome/fontawesome-svg-core @fortawesome/free-brands-svg-icons @fortawesome/free-regular-svg-icons @fortawesome/free-solid-svg-icons
87+
ls -l themes/BootstrapTheme
8188
8289
- name: Theme - Config Webpack
8390
working-directory: ./sylius
8491
run: |
85-
echo "const bootstrapTheme = require('./themes/BootstrapTheme/webpack.config');" >> webpack.config.js
86-
echo "module.exports = [bootstrapTheme];" >> webpack.config.js
92+
sed -i "s#module.exports = \[shopConfig, adminConfig\];#const bootstrapTheme = require('./themes/BootstrapTheme/webpack.config');#" webpack.config.js
93+
echo "module.exports = [shopConfig, adminConfig, bootstrapTheme];" >> webpack.config.js
94+
cat webpack.config.js
8795
8896
- name: Theme - Config Assets
8997
working-directory: ./sylius
@@ -93,23 +101,49 @@ jobs:
93101
echo " packages:" >> config/packages/assets.yaml
94102
echo " bootstrapTheme:" >> config/packages/assets.yaml
95103
echo " json_manifest_path: '%kernel.project_dir%/public/bootstrap-theme/manifest.json'" >> config/packages/assets.yaml
104+
cat config/packages/assets.yaml
96105
97106
- name: Theme - Config Webpack Encore
98107
working-directory: ./sylius
99108
run: |
100109
echo " builds:" >> config/packages/webpack_encore.yaml
101110
echo " bootstrapTheme: '%kernel.project_dir%/public/bootstrap-theme'" >> config/packages/webpack_encore.yaml
111+
cat config/packages/webpack_encore.yaml
112+
113+
- name: Theme - Get Yarn cache directory
114+
id: yarn-cache
115+
run: echo "::set-output name=dir::$(yarn cache dir)"
102116

103-
- name: Theme - Build
117+
- name: Theme - Cache Yarn
118+
uses: actions/cache@v2
119+
with:
120+
path: ${{ steps.yarn-cache.outputs.dir }}
121+
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
122+
restore-keys: |
123+
${{ runner.os }}-node-${{ matrix.node }}-yarn-
124+
125+
- name: Theme - Install JS dependencies
126+
working-directory: ./sylius
127+
run: |
128+
yarn install
129+
yarn add @symfony/webpack-encore sass-loader@^9.0 node-sass@^4.0 lodash.throttle -D
130+
yarn add bootstrap@^4.5 bootstrap.native@^3.0 glightbox axios form-serialize @fortawesome/fontawesome-svg-core @fortawesome/free-brands-svg-icons @fortawesome/free-regular-svg-icons @fortawesome/free-solid-svg-icons
131+
132+
- name: Theme - Prepare test application assets
104133
working-directory: ./sylius
105-
run: yarn build
134+
run: |
135+
php bin/console assets:install public -vvv
136+
yarn encore dev
106137
107138
- name: Theme - Set in Sylius Standard
108139
working-directory: ./sylius
109140
run: |
110141
sed -i "82i\ theme_name: 'sylius/bootstrap-theme'" vendor/sylius/sylius/src/Sylius/Bundle/CoreBundle/Resources/config/app/fixtures/shop_configuration.yaml
111-
sed -i "113i\ \$channel->setThemeName('sylius/bootstrap-theme');" vendor/sylius/sylius/src/Sylius/Component/Core/Test/Services/DefaultUnitedStatesChannelFactory.php
112-
sed -i "88i\ \$channel->setThemeName('sylius/bootstrap-theme');" vendor/sylius/sylius/src/Sylius/Component/Core/Test/Services/DefaultChannelFactory.php
142+
cat vendor/sylius/sylius/src/Sylius/Bundle/CoreBundle/Resources/config/app/fixtures/shop_configuration.yaml
143+
sed -i "110i\ \$channel->setThemeName('sylius/bootstrap-theme');" vendor/sylius/sylius/src/Sylius/Component/Core/Test/Services/DefaultUnitedStatesChannelFactory.php
144+
cat vendor/sylius/sylius/src/Sylius/Component/Core/Test/Services/DefaultUnitedStatesChannelFactory.php
145+
sed -i "85i\ \$channel->setThemeName('sylius/bootstrap-theme');" vendor/sylius/sylius/src/Sylius/Component/Core/Test/Services/DefaultChannelFactory.php
146+
cat vendor/sylius/sylius/src/Sylius/Component/Core/Test/Services/DefaultChannelFactory.php
113147
114148
- name: Sylius - Init database
115149
working-directory: ./sylius
@@ -119,44 +153,34 @@ jobs:
119153
working-directory: ./sylius
120154
run: php bin/console sylius:install -n -s default
121155

122-
- name: Behat - Configure display
156+
- name: Symfony CLI - PHP version
123157
working-directory: ./sylius
124158
run: |
125-
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1680x1050x16
126-
export DISPLAY=:99
159+
php -v | head -n 1 | awk '{ print $2 }' > .php-version
127160
128-
- name: Behat - Download and configure ChromeDriver
161+
- name: Symfony CLI - Certificat
129162
working-directory: ./sylius
130-
run: |
131-
if [ ! -f chromedriver ] || [ "$(chromedriver --version | grep -c 2.34)" = "0" ]; then
132-
curl http://chromedriver.storage.googleapis.com/2.34/chromedriver_linux64.zip > chromedriver.zip
133-
unzip chromedriver.zip
134-
chmod +x chromedriver
135-
fi
163+
run: symfony server:ca:install
136164

137-
- name: Behat - Run ChromeDriver
138-
working-directory: ./sylius
139-
run: chromedriver > /dev/null 2>&1 &
165+
- name: Chrome - Run
166+
run: 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 &
140167

141-
- name: Behat - Download and configure Selenium
168+
- name: Symfony CLI - Server start
142169
working-directory: ./sylius
143-
run: |
144-
if [ ! -f selenium.jar ] || [ "$(java -jar selenium.jar --version | grep -c 3.4.0)" = "0" ]; then
145-
curl http://selenium-release.storage.googleapis.com/3.4/selenium-server-standalone-3.4.0.jar > selenium.jar
146-
fi
147-
148-
- name: Behat - Run Selenium
149-
working-directory: ./sylius
150-
run: java -Dwebdriver.chrome.driver=chromedriver -jar selenium.jar > /dev/null 2>&1 &
151-
152-
- name: Behat - Run webserver
153-
working-directory: ./sylius
154-
run: bin/console server:run 127.0.0.1:8080 --quiet > /dev/null 2>&1 &
170+
run: symfony server:start --port=8080 --dir=public --daemon
155171

156172
- name: Behat - Run Behat tests
157173
working-directory: ./sylius
158-
run: vendor/bin/behat --strict -vvv --no-interaction -f progress --tags="~@javascript && ~@todo && ~@cli" vendor/sylius/sylius/features/account/registering.feature || \
159-
vendor/bin/behat --strict -vvv --no-interaction -f progress --tags="~@javascript && ~@todo && ~@cli" vendor/sylius/sylius/features/account/registering.feature --rerun
174+
run: vendor/bin/behat --strict -vvv --no-interaction -f progress --tags="~@javascript && ~@todo && ~@cli" vendor/sylius/sylius/features/account || \
175+
vendor/bin/behat --strict -vvv --no-interaction -f progress --tags="~@javascript && ~@todo && ~@cli" --rerun vendor/sylius/sylius/features/account
176+
177+
- name: Behat - Upload logs
178+
uses: actions/upload-artifact@v2
179+
if: failure()
180+
with:
181+
name: Behat logs
182+
path: sylius/etc/build/
183+
if-no-files-found: ignore
160184

161185
services:
162186
mariadb:

0 commit comments

Comments
 (0)