diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index a94a7ea2ba5..80776ca639e 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -245,8 +245,9 @@ jobs: if grep -l '@headful' "${TEST_FILES[@]}" >/dev/null; then E2E_PROJECT_ARGS+=(--project=electron-headful) fi + node tests/e2e/diagnose-execution-context.mjs xvfb-run --auto-servernum bash .github/scripts/e2e-with-window-manager.sh env "${E2E_ENV[@]}" \ - pnpm run test:e2e "${TEST_FILES[@]}" --workers=1 "${E2E_PROJECT_ARGS[@]}" + pnpm run test:e2e "${TEST_FILES[@]}" --workers=1 "${E2E_PROJECT_ARGS[@]}" --repeat-each=5 - name: Upload Playwright traces if: failure() diff --git a/tests/e2e/diagnose-execution-context.mjs b/tests/e2e/diagnose-execution-context.mjs new file mode 100644 index 00000000000..56ac7b98012 --- /dev/null +++ b/tests/e2e/diagnose-execution-context.mjs @@ -0,0 +1,10 @@ +import fs from 'node:fs' +import path from 'node:path' +import { createRequire } from 'node:module' +const require = createRequire(import.meta.url) +const file = path.join(path.dirname(require.resolve('playwright-core/package.json')), 'lib/server/chromium/crExecutionContext.js') +let source = fs.readFileSync(file, 'utf8') +const needle = 'function rewriteError(error) {' +if (!source.includes(needle)) throw new Error('Playwright diagnostic hook missing') +source = source.replace(needle, needle + '\n console.error("[raw-context-error]", error.message, error.stack);') +fs.writeFileSync(file, source)