Skip to content

Commit dd487e0

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

File tree

1 file changed

+67
-54
lines changed

1 file changed

+67
-54
lines changed

.github/workflows/behat.yaml

Lines changed: 67 additions & 54 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

@@ -71,19 +73,14 @@ jobs:
7173
run: |
7274
mkdir -p themes/BootstrapTheme/
7375
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
76+
ls -l themes/BootstrapTheme
8177
8278
- name: Theme - Config Webpack
8379
working-directory: ./sylius
8480
run: |
85-
echo "const bootstrapTheme = require('./themes/BootstrapTheme/webpack.config');" >> webpack.config.js
86-
echo "module.exports = [bootstrapTheme];" >> webpack.config.js
81+
sed -i "s#module.exports = \[shopConfig, adminConfig\];#const bootstrapTheme = require('./themes/BootstrapTheme/webpack.config');#" webpack.config.js
82+
echo "module.exports = [shopConfig, adminConfig, bootstrapTheme];" >> webpack.config.js
83+
cat webpack.config.js
8784
8885
- name: Theme - Config Assets
8986
working-directory: ./sylius
@@ -93,23 +90,49 @@ jobs:
9390
echo " packages:" >> config/packages/assets.yaml
9491
echo " bootstrapTheme:" >> config/packages/assets.yaml
9592
echo " json_manifest_path: '%kernel.project_dir%/public/bootstrap-theme/manifest.json'" >> config/packages/assets.yaml
93+
cat config/packages/assets.yaml
9694
9795
- name: Theme - Config Webpack Encore
9896
working-directory: ./sylius
9997
run: |
10098
echo " builds:" >> config/packages/webpack_encore.yaml
10199
echo " bootstrapTheme: '%kernel.project_dir%/public/bootstrap-theme'" >> config/packages/webpack_encore.yaml
100+
cat config/packages/webpack_encore.yaml
101+
102+
- name: Theme - Get Yarn cache directory
103+
id: yarn-cache
104+
run: echo "::set-output name=dir::$(yarn cache dir)"
102105

103-
- name: Theme - Build
106+
- name: Theme - Cache Yarn
107+
uses: actions/cache@v2
108+
with:
109+
path: ${{ steps.yarn-cache.outputs.dir }}
110+
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
111+
restore-keys: |
112+
${{ runner.os }}-node-${{ matrix.node }}-yarn-
113+
114+
- name: Theme - Install JS dependencies
104115
working-directory: ./sylius
105-
run: yarn build
116+
run: |
117+
yarn install
118+
yarn add @symfony/webpack-encore sass-loader@^9.0 node-sass@^4.0 lodash.throttle -D
119+
yarn add bootstrap bootstrap.native glightbox axios form-serialize @fortawesome/fontawesome-svg-core @fortawesome/free-brands-svg-icons @fortawesome/free-regular-svg-icons @fortawesome/free-solid-svg-icons
120+
121+
- name: Theme - Prepare test application assets
122+
working-directory: ./sylius
123+
run: |
124+
php bin/console assets:install public -vvv
125+
yarn encore dev
106126
107127
- name: Theme - Set in Sylius Standard
108128
working-directory: ./sylius
109129
run: |
110130
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
131+
cat vendor/sylius/sylius/src/Sylius/Bundle/CoreBundle/Resources/config/app/fixtures/shop_configuration.yaml
132+
sed -i "110i\ \$channel->setThemeName('sylius/bootstrap-theme');" vendor/sylius/sylius/src/Sylius/Component/Core/Test/Services/DefaultUnitedStatesChannelFactory.php
133+
cat vendor/sylius/sylius/src/Sylius/Component/Core/Test/Services/DefaultUnitedStatesChannelFactory.php
134+
sed -i "85i\ \$channel->setThemeName('sylius/bootstrap-theme');" vendor/sylius/sylius/src/Sylius/Component/Core/Test/Services/DefaultChannelFactory.php
135+
cat vendor/sylius/sylius/src/Sylius/Component/Core/Test/Services/DefaultChannelFactory.php
113136
114137
- name: Sylius - Init database
115138
working-directory: ./sylius
@@ -119,44 +142,34 @@ jobs:
119142
working-directory: ./sylius
120143
run: php bin/console sylius:install -n -s default
121144

122-
- name: Behat - Configure display
123-
working-directory: ./sylius
124-
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
127-
128-
- name: Behat - Download and configure ChromeDriver
145+
- name: Symfony CLI - PHP version
129146
working-directory: ./sylius
130147
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
148+
php -v | head -n 1 | awk '{ print $2 }' > .php-version
136149
137-
- name: Behat - Run ChromeDriver
150+
- name: Symfony CLI - Certificat
138151
working-directory: ./sylius
139-
run: chromedriver > /dev/null 2>&1 &
152+
run: symfony server:ca:install
140153

141-
- name: Behat - Download and configure Selenium
142-
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 &
154+
- name: Chrome - Run
155+
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 &
151156

152-
- name: Behat - Run webserver
157+
- name: Symfony CLI - Server start
153158
working-directory: ./sylius
154-
run: bin/console server:run 127.0.0.1:8080 --quiet > /dev/null 2>&1 &
159+
run: symfony server:start --port=8080 --dir=public --daemon
155160

156161
- name: Behat - Run Behat tests
157162
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
163+
run: vendor/bin/behat --strict -vvv --no-interaction -f progress --tags="~@javascript && ~@todo && ~@cli" vendor/sylius/sylius/features/account || \
164+
vendor/bin/behat --strict -vvv --no-interaction -f progress --tags="~@javascript && ~@todo && ~@cli" --rerun vendor/sylius/sylius/features/account
165+
166+
- name: Behat - Upload logs
167+
uses: actions/upload-artifact@v2
168+
if: failure()
169+
with:
170+
name: Behat logs
171+
path: sylius/etc/build/
172+
if-no-files-found: ignore
160173

161174
services:
162175
mariadb:

0 commit comments

Comments
 (0)