Skip to content

Commit 10fd54a

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 10fd54a

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

.github/workflows/tests.yml

Lines changed: 13 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

@@ -213,10 +215,17 @@ jobs:
213215
path: ${{ matrix.task.cache }}
214216

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

0 commit comments

Comments
 (0)