Skip to content

fix(trace): retain browser snapshots when afterAll fails - #44409

Open
mr-anton-t wants to merge 1 commit into
microsoft:mainfrom
mr-anton-t:fix/trace-afterall-failure-main
Open

mr-anton-t wants to merge 1 commit into
microsoft:mainfrom
mr-anton-t:fix/trace-afterall-failure-main

Conversation

@mr-anton-t

Copy link
Copy Markdown

Summary

Fixes #44408.

Test-scoped fixture teardown stops browser trace chunks before afterAll hooks run. In retain modes, those chunks can be discarded while the test result is still successful, even though a subsequent afterAll failure marks the test as failed.

  • Defer marking tracing as finished when there are pending afterAll hooks for the current test.
  • Mark tracing as finished after those hooks have run.
  • Add six regression cases covering three retain modes with both fixture-owned and shared browser contexts.
  • Add a control verifying that successful afterAll hooks still discard traces.

Validation

The original fix was validated against Playwright v1.64.0 using the native test harness:

  • Without the fix: six regression cases failed and the successful-afterAll control passed.
  • With the fix: all seven new cases and 18 neighboring tests passed (25 total).
  • ESLint and diff checks passed.

This PR cherry-picks only that fix and its tests onto current main; it applied without conflicts. Diff checks passed after the cherry-pick. The test suite has not yet been rerun on this new main-based branch.

The public reproduction in #44408 was separately verified against the unmodified official @playwright/test 1.65.1 npm package. The issue includes reproduction instructions and comparison trace archives for retain-on-failure and on.

Refs: dbeaver/pro#12060, microsoft#31541, microsoft#28527, microsoft#32377

Add regression tests for missing browser actions and DOM snapshots
when only afterAll fails.

Verified with Playwright's native test harness:
- Without fix: 6 regression tests fail; 1 control passes.
- With fix: all 7 new tests and 18 existing tests pass (25 total).
@mr-anton-t

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: retain-on-failure loses browser actions and DOM snapshots when only afterAll fails

1 participant