Skip to content

test(e2e): match docStore update in navigation blocker save test - #31065

Closed
ShaileshParmar11 wants to merge 1 commit into
mainfrom
fix/navigation-blocker-docstore-matcher-main
Closed

test(e2e): match docStore update in navigation blocker save test#31065
ShaileshParmar11 wants to merge 1 commit into
mainfrom
fix/navigation-blocker-docstore-matcher-main

Conversation

@ShaileshParmar11

Copy link
Copy Markdown
Contributor

Draft — held pending validation on 2.0 (#31064). Opened so the change isn't lost; do not merge until the next 2.0 nightlies confirm the test comes back clean.

Problem

Navigation Blocker Tests › should not show navigation blocker after saving changes is flaky in:

Branch Flaky runs
main 9 / 9
2.0 16 / 16
1.13 20 / 34

It fails the first attempt on a 60s timeout and passes on retry.

Test timeout of 60000ms exceeded.
Error: page.waitForResponse: Target page, context or browser has been closed
waiting for response "/api/v1/docStore"

Root cause

The tests in this file share one persona and run sequentially (describe.configure({ mode: 'default' })). An earlier test — "should confirm navigation when Save changes is clicked" — already saves a layout for that persona. So by the time this test saves, the request is an UPDATE (PUT /api/v1/docStore/{id}), not a create.

The wait was waitForResponse('/api/v1/docStore'). A bare string is an exact URL match, so it never matches the update and the await hangs until the test timeout. This was the only exact docStore matcher left in the suite.

* does not cross a / in Playwright globs, so the sibling's 'api/v1/docStore*' works only because its own save is a create. Matching the update requires **.

On retry, a fresh worker means beforeAll creates a new persona and the save is a create again — which is why it always passes on attempt 2 and never on attempt 1.

Evidence from the failed attempt: the Save button is already [disabled] in the error-context snapshot, i.e. the save had completed — only the matcher missed it.

Fix

  • Match **/api/v1/docStore**, covering both create and update.
  • Relax the toast assertion to accept created or updated, since this test covers navigation-blocker behaviour rather than create-vs-update semantics.

Verification

This one reproduces deterministically by running the file in order.

Check Result
Full file in order, before fix test 4 fails at 1.0m — same error as CI
Full file in order, after fix 5/5 passed, test 4 in 4.3s
--repeat-each=20 on the target test 20/20 passed

Iterations 2+ of the repeat run exercise the update path that was previously unmatched.

🤖 Generated with Claude Code

`Navigation Blocker Tests > should not show navigation blocker after
saving changes` is flaky in 9 of the last 9 Main V2 nightly runs (16/16 on
2.0, 20/34 on 1.13), failing the first attempt on a 60s timeout and
passing on retry.

The tests in this file share one persona, and run sequentially
(describe.configure mode: 'default'). An earlier test — "should confirm
navigation when Save changes is clicked" — already saves a layout for that
persona, so by the time this test saves, the request is an UPDATE
(PUT /api/v1/docStore/{id}) rather than a create.

The wait was `waitForResponse('/api/v1/docStore')`. A bare string is an
exact URL match, so it never matches the update and the await hangs until
the test timeout. This was the only exact docStore matcher left in the
suite; every other one uses a wildcard. Note '*' does not cross a '/', so
the sibling's 'api/v1/docStore*' works only because its own save is a
create — matching the update needs '**'.

On retry Playwright starts a fresh worker, beforeAll creates a new persona,
and the save becomes a create again — which is why the test always passes
on the second attempt and never on the first.

Also relaxes the toast assertion to accept "created" or "updated": this
test covers navigation-blocker behaviour, not create-vs-update semantics,
and should not depend on whether a preceding test already created the
layout.

Reproduced deterministically before the fix by running the file in order —
test 4 fails at 1.0m with `waiting for response "/api/v1/docStore"`. After
the fix the same run is 5/5 green and the test completes in 4.3s.
Verified with --repeat-each=20, 20/20 passed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Aug 5, 2026
@gitar-bot

gitar-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Updates the docStore matcher in the navigation blocker e2e test to handle update requests alongside creates, resolving the 60-second test timeout. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar | Powered by Gitar — free for open source

@ShaileshParmar11

Copy link
Copy Markdown
Contributor Author

Superseded by #31063, which is now the rolling main PR for Playwright flaky-test fixes. This commit has been cherry-picked there.

Keeping a single accumulating PR for main so fixes validated on 2.0 land together rather than as separate branches.

@ShaileshParmar11
ShaileshParmar11 deleted the fix/navigation-blocker-docstore-matcher-main branch August 5, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant