Skip to content

Commit c8186a3

Browse files
committed
Fix Puppeteer related tests on Ubuntu
In Ubuntu 24.04 development builds of Chrome need to be run with a specific App Armor profile set. See https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md
1 parent b84f122 commit c8186a3

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

.github/workflows/tests.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ jobs:
176176
cache: |
177177
.cache/jest
178178
.cache/puppeteer
179+
puppeteer: true
179180
projects:
180181
- JavaScript component tests
181182

@@ -190,6 +191,7 @@ jobs:
190191
cache: |
191192
.cache/jest
192193
.cache/puppeteer
194+
puppeteer: true
193195
projects:
194196
- Accessibility tests
195197

@@ -212,11 +214,17 @@ jobs:
212214
key: ${{ matrix.task.name }}-${{ runner.os }}
213215
path: ${{ matrix.task.cache }}
214216

217+
# Use 2x CPU cores for hosted GitHub runners
218+
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
215219
- name: Run test task
216-
217-
# Use 2x CPU cores for hosted GitHub runners
218-
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
219-
run: npx jest --color ${{ format('--coverage={0} --maxWorkers=2 --selectProjects "{1}"', matrix.task.coverage || false, join(matrix.task.projects, '", "')) }}
220+
run: |
221+
# Puppeteer uses Chrome to execute tests.
222+
# Ubuntu requires a profile for developer builds of Chrome to run without errors.
223+
# (https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md)
224+
${{ (
225+
matrix.task.puppeteer == true &&
226+
matrix.runner.name == 'Ubuntu'
227+
) && 'aa-exec --profile=chrome' || '' }} npx jest --color ${{ format('--coverage={0} --maxWorkers=2 --selectProjects "{1}"', matrix.task.coverage || false, join(matrix.task.projects, '", "')) }}
220228
221229
- name: Save test coverage
222230
uses: actions/upload-artifact@v7.0.1

0 commit comments

Comments
 (0)