Skip to content

Commit 54206de

Browse files
Fix Functional Javascript CI tests (#1004)
* Fixup js tests * Move MINK env var into phpunit for easier local testing * Fix xpath for 10.3 --------- Co-authored-by: Joe Corall <[email protected]>
1 parent 9b26616 commit 54206de

File tree

4 files changed

+165
-139
lines changed

4 files changed

+165
-139
lines changed

.github/workflows/build-2.x.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
1-
# This is a basic workflow to help you get started with Actions
2-
31
name: CI
42

5-
# Controls when the action will run.
63
on:
7-
# Triggers the workflow on push or pull request events but only for the 2.x branch
84
push:
95
branches: [ 2.x ]
106
pull_request:
117
branches: [ 2.x ]
12-
13-
# Allows you to run this workflow manually from the Actions tab
148
workflow_dispatch:
159

16-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1710
jobs:
18-
# This workflow contains a single job called "build"
1911
build:
20-
# The type of runner that the job will run on
12+
env:
13+
DRUPAL_VERSION: ${{ matrix.drupal-version }}
14+
SCRIPT_DIR: ${{ github.workspace }}/islandora_ci
15+
DRUPAL_DIR: /opt/drupal
16+
PHPUNIT_FILE: ${{ github.workspace }}/build_dir/phpunit.xml
17+
2118
runs-on: ubuntu-latest
2219
continue-on-error: ${{ matrix.allowed_failure }}
2320
strategy:
2421
fail-fast: false
2522
matrix:
2623
php-versions: ["8.1", "8.2", "8.3"]
27-
# test-suite functional-javascript will appear to pass but will skip tests; missing chromedriver.
2824
test-suite: ["kernel", "functional", "functional-javascript"]
2925
drupal-version: ["10.1.x", "10.2.x", "10.3.x-dev"]
3026
mysql: ["8.0"]
@@ -51,17 +47,15 @@ jobs:
5147
- 61616:61616
5248
- 61613:61613
5349

54-
# Steps represent a sequence of tasks that will be executed as part of the job
5550
steps:
5651

57-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
5852
- name: Checkout code
59-
uses: actions/checkout@v3
53+
uses: actions/checkout@v4
6054
with:
6155
path: build_dir
6256

6357
- name: Checkout islandora_ci
64-
uses: actions/checkout@v3
58+
uses: actions/checkout@v4
6559
with:
6660
repository: islandora/islandora_ci
6761
ref: github-actions
@@ -79,13 +73,6 @@ jobs:
7973
sudo apt-get remove -y mysql-client mysql-common
8074
sudo apt-get install -y mysql-client
8175
82-
- name: Set environment variables
83-
run: |
84-
echo "DRUPAL_VERSION=${{ matrix.drupal-version }}" >> $GITHUB_ENV
85-
echo "SCRIPT_DIR=$GITHUB_WORKSPACE/islandora_ci" >> $GITHUB_ENV
86-
echo "DRUPAL_DIR=/opt/drupal" >> $GITHUB_ENV
87-
echo "PHPUNIT_FILE=$GITHUB_WORKSPACE/build_dir/phpunit.xml" >> $GITHUB_ENV
88-
8976
- name: Cache Composer dependencies
9077
uses: actions/cache@v3
9178
with:
@@ -118,8 +105,21 @@ jobs:
118105

119106
- name: Test scripts
120107
run: $SCRIPT_DIR/travis_scripts.sh
108+
109+
- name: Start chromedriver
110+
if: matrix.test-suite == 'functional-javascript'
111+
run: |-
112+
/usr/local/share/chromedriver-linux64/chromedriver \
113+
--log-path=/tmp/chromedriver.log \
114+
--verbose \
115+
--allowed-ips= \
116+
--allowed-origins=* &
121117
122118
- name: PHPUNIT tests
123119
run: |
124120
cd $DRUPAL_DIR/web/core
125121
$DRUPAL_DIR/vendor/bin/phpunit --verbose --testsuite "${{ matrix.test-suite }}"
122+
123+
- name: Print chromedriver logs
124+
if: matrix.test-suite == 'functional-javascript'
125+
run: cat /tmp/chromedriver.log

phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<!-- Example for changing the driver args to phantomjs tests MINK_DRIVER_ARGS_PHANTOMJS value: '["http://127.0.0.1:8510"]' -->
4848
<env name="MINK_DRIVER_ARGS_PHANTOMJS" value=""/>
4949
<!-- Example for changing the driver args to webdriver tests MINK_DRIVER_ARGS_WEBDRIVER value: '["chrome", { "chromeOptions": { "w3c": false } }, "http://localhost:4444/wd/hub"]' For using the Firefox browser, replace "chrome" with "firefox" -->
50-
<env name="MINK_DRIVER_ARGS_WEBDRIVER" value=""/>
50+
<env name="MINK_DRIVER_ARGS_WEBDRIVER" value='["chrome", {"browserName":"chrome","chromeOptions":{"args":["--disable-gpu","--headless", "--no-sandbox", "--disable-dev-shm-usage"]}}, "http://localhost:9515"]'/>
5151
</php>
5252
<testsuites>
5353
<testsuite name="unit">

0 commit comments

Comments
 (0)