refactor(e2e): use shared-page fixture for serial specs#4696
refactor(e2e): use shared-page fixture for serial specs#4696nickboldt merged 5 commits intoredhat-developer:mainfrom
Conversation
Replace manual browser.newContext() with a worker-scoped sharedPage fixture so serial specs get video recording, tracing and screenshot support from Playwright's built-in config. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Code Review by Qodo
1. Per-worker video only
|
Review Summary by QodoRefactor e2e tests to use shared-page fixture with video and tracing
WalkthroughsDescription• Introduced worker-scoped sharedPage fixture for persistent browser context • Integrated video recording, tracing, and screenshot support automatically • Refactored adoption-insights and scorecard specs to use shared fixture • Added @support/* TypeScript path alias for cleaner imports Diagramflowchart LR
A["Manual browser.newContext()"] -->|Replace with| B["sharedPage fixture"]
B -->|Provides| C["Video Recording"]
B -->|Provides| D["Trace Chunks"]
B -->|Provides| E["Screenshots"]
C -->|Retain on| F["Test Failure"]
D -->|Attach to| G["Playwright Report"]
File Changes1. e2e-tests/playwright/support/shared-page.ts
|
- Capture and attach screenshot on test failure in shared-page fixture - Add Page type annotation to adoption-insights page variable - Add explanatory comments for video recording and worker isolation - Trim header comment to project convention length Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The container image build workflow finished with status: |
Wrap sharedPage.screenshot() in try-catch so trace attachment still succeeds when the page has crashed during a test failure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Playwright auto-starts tracing when trace: "on" is set in config, so the explicit tracing.start() caused "Tracing has been already started" error. The startChunk/stopChunk calls in _sharedTraceChunk work on top of the auto-started session. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Playwright's trace: "on" config auto-manages tracing (start, per-test chunks, and attachment) for all contexts including manually created ones. Remove _sharedTraceChunk fixture and replace with a simpler _sharedTestHook that only handles screenshot-on-failure and the workerHadFailure flag for video cleanup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
/test e2e-ocp-helm |
|
/lgtm |



Summary
sharedPagefixture (e2e-tests/playwright/support/shared-page.ts) that provides a persistentBrowserContext+Pagewith video recording, per-test tracing (startChunk/stopChunk), and retain-on-failure semanticsadoption-insights.spec.tsandscorecard.spec.tsto usesharedPageinstead of manualbrowser.newContext(), which was bypassing Playwright's built-in video/trace/screenshot config@support/*TypeScript path alias for cleaner imports fromplaywright/support/Test plan
npx tsc --noEmitpasses (verified locally)yarn lint:checkpasses — no new warnings (verified locally)yarn prettier:checkpasses (verified locally)🤖 Generated with Claude Code