Skip to content

Commit

Permalink
Update puppeteer / fix tests (#13895)
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy authored Jan 6, 2025
1 parent 40dc434 commit b6b826c
Show file tree
Hide file tree
Showing 40 changed files with 1,303 additions and 623 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/tests-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ jobs:
COMPOSE_INTERACTIVE_NO_CLI: true
WP_VERSION: ${{ matrix.wp }}

# See https://issues.chromium.org/issues/373753919
# and https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md
- name: Disable AppArmor
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns

- name: Get Chromium executable path
id: chromium_path
run: |
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/tests-karma-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ jobs:
env:
PUPPETEER_PRODUCT: chrome

# See https://issues.chromium.org/issues/373753919
# and https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md
- name: Disable AppArmor
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns

# FIXME: https://github.com/googleforcreators/web-stories-wp/issues/4364
- name: Increase max number of file watchers
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Expand All @@ -99,6 +104,6 @@ jobs:
- name: Upload code coverage report
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303
with:
file: build/logs/karma-coverage/dashboard/lcov.info
files: build/logs/karma-coverage/dashboard/lcov.info
flags: karmatests
token: ${{ secrets.CODECOV_TOKEN }}
7 changes: 6 additions & 1 deletion .github/workflows/tests-karma-editor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ jobs:
env:
PUPPETEER_PRODUCT: chrome

# See https://issues.chromium.org/issues/373753919
# and https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md
- name: Disable AppArmor
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns

# FIXME: https://github.com/googleforcreators/web-stories-wp/issues/4364
- name: Increase max number of file watchers
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Expand All @@ -140,6 +145,6 @@ jobs:
- name: Upload code coverage report
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303
with:
file: build/logs/karma-coverage/story-editor/lcov.info
files: build/logs/karma-coverage/story-editor/lcov.info
flags: karmatests
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/tests-unit-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,6 @@ jobs:
- name: Upload code coverage report
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303
with:
file: build/logs/lcov.info
files: build/logs/lcov.info
flags: unittests
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/tests-unit-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,6 @@ jobs:
- name: Upload code coverage report
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303
with:
file: build/logs/*.xml
files: build/logs/*.xml
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ matrix.coverage }}
4 changes: 2 additions & 2 deletions jest-puppeteer.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
*/
const {
PUPPETEER_DEVTOOLS = false,
PUPPETEER_HEADLESS = 'new',
PUPPETEER_HEADLESS = true,
PUPPETEER_PRODUCT = 'chrome',
PUPPETEER_SLOWMO = 0,
} = process.env;

module.exports = {
launch: {
devtools: PUPPETEER_DEVTOOLS === 'true',
headless: PUPPETEER_HEADLESS !== 'false' ? PUPPETEER_HEADLESS : false,
headless: Boolean(PUPPETEER_HEADLESS),
slowMo: Number(PUPPETEER_SLOWMO) || 0,
product: PUPPETEER_PRODUCT,
args: ['--window-size=1600,1000'], // Same as in percy.config.yml.
Expand Down
2 changes: 1 addition & 1 deletion karma-dashboard.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ module.exports = function (config) {

puppeteerLauncher: {
puppeteer: {
headless: config.headless ? 'new' : false,
headless: Boolean(config.headless),
slowMo: config.slowMo || 0,
devtools: config.devtools || false,
snapshots: config.snapshots || false,
Expand Down
2 changes: 1 addition & 1 deletion karma-story-editor.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ module.exports = function (config) {

puppeteerLauncher: {
puppeteer: {
headless: config.headless ? 'new' : false,
headless: Boolean(config.headless),
slowMo: config.slowMo || 0,
devtools: config.devtools || false,
snapshots: config.snapshots || false,
Expand Down
Loading

0 comments on commit b6b826c

Please sign in to comment.