Repository navigation
fix(playwright): warm search index + cap slow-test timeouts on Roles/Entity flakes - #30390
Conversation
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
|
Amended with 2343d80527 per @madlanichirag's suggestion — direct-nav to the role detail page instead of paginating. Four test.step blocks in
Combined with the earlier |
✅ Playwright Results — workflow succeededValidated commit ✅ 399 passed · ❌ 0 failed · 🟡 2 flaky · ⏭️ 3 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 43m 38s ⏱️ Max setup 1m 44s · max shard execution 14m 22s · max shard-job elapsed before upload 18m 31s · reporting 5s 🌐 214.23 requests/attempt · 3.28 app boots/UI scenario · 19.03% common-shard skew Optimization targets still in progress:
🟡 2 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
…Entity flakes
Two 180s test-timeout hangs surfaced repeatedly in postgresql-e2e — each
one burns 3 minutes of shard runtime per attempt before Playwright's
retry kicks in:
Pages/Roles.spec.ts › Roles page should work properly (shard 1)
Pages/Entity.spec.ts › User as Owner with unsorted list (shard 5/6)
Both tests declare test.slow() (=180s) and both consistently pass in
~30-40s on the retry attempt. The waste is entirely in how long each
attempt is allowed to hang before failing.
Entity › User as Owner with unsorted list — root-cause fix
The test creates two fresh users via API, then immediately drives the
UI owner picker to search for them. Under CI load the async
user_search_index lags creation by several seconds; the UI search
returns empty and each ownerItem.waitFor({visible}) inside
addMultiOwner hangs the default 30s. Two adds + a remove chain that
waste up to 90s from one cold index.
Poll the search API up-front after user creation so both users are
visible in the index before any UI search runs. Also cap the test at
120s as insurance in case the warmup doesn't cover every hang mode.
Roles › Roles page should work properly — fail-fast cap
This test runs 8 sequential test.step blocks, each renavigating to the
roles list and calling getElementWithPagination (a 50-page loop with
a 30s loader wait per page). Under load the cumulative delays push
past 180s. Refactoring the 8 steps is out of scope; instead cap at
120s so a hung attempt fails fast and the retry gets a fresh 120s
budget, saving ~60s per flake occurrence.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…/5/6/7
Four test.step blocks in "Roles page should work properly" open the same
role's detail page. Each was doing:
settingClick(page, ROLES) // navigate to list
waitForAllLoadersToDisappear(page) // wait for list to render
getElementWithPagination(roleLocator) // 50-page loop, 30s loader wait
// per page, clicks the row
waitForAllLoadersToDisappear(page) // wait for detail to render
This is pure ceremony — the URL is deterministic from roleName. Replace
each with a single page.goto(`/settings/access/roles/${roleName}`).
Step 1 (verify newly-created role appears in the roles list) and Step 8
(delete via the row's delete-action button) genuinely need the list
view and keep the pagination lookup.
Combined with the earlier timeout cap on this branch, the happy-path
runtime for this test drops significantly and the underlying source of
the 180s hang — repeated getElementWithPagination round-trips — is
removed for the four affected steps.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2343d80 to
c24c647
Compare
|
Rebased on latest main (which now includes #30310) → head
|
Gitar-bot review on #30390 (comment 5068041851) noted that the warmup polled by getUserName() (= responseData.name) but addMultiOwner drives the picker with getUserDisplayName() (= responseData.displayName ?? name). While those happen to match for users generated via generateRandomUsername today, any future divergence would silently pass the warmup while the UI search still misses — quietly reintroducing the 30s-per-op hang the warmup was added to eliminate. Switch both poll calls to getUserDisplayName() so we confirm the exact term the picker searches is in the index. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Addressed @gitar-bot's review in c24ffcdce0. Confirmed the mapping (bot had the names swapped but the concern was real):
At line 292 and downstream (301, 311, 319) |
Confirmed — checked Verified |
Code Review ✅ Approved 1 resolved / 1 findingsWarms the user search index before owner-picker operations and caps Playwright test timeouts to reduce CI flakiness, addressing the username versus display name polling finding. No issues found. ✅ 1 resolved✅ Bug: Warm-up polls by username but UI searches display name
OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
Summary
Two ~180 s timeout hangs consistently surface on postgresql-e2e:
Both declare `test.slow()` (180 s ceiling) and both pass in ~30–40 s on retry. All the waste is in how long the first attempt hangs before Playwright's per-test retry kicks in — 180 s / attempt in the worst case.
Root cause per test
Entity › User as Owner with unsorted list
The test creates two fresh users via API, then immediately drives the UI owner picker to search for them. Under CI load the async `user_search_index` lags creation by several seconds. The UI search returns empty and each `ownerItem.waitFor({state:'visible'})` inside `addMultiOwner` hangs 30 s. Two adds + a remove chain waste up to 90 s from one cold index — enough to push the whole test over the 180 s ceiling.
Roles › Roles page should work properly
The test runs 8 sequential `test.step` blocks, each renavigating to the roles list and calling `getElementWithPagination` (a 50-page loop with a 30 s loader wait per page). Under load the cumulative delays exceed 180 s.
Change
Entity.spec.ts — root-cause fix + insurance cap
Roles.spec.ts — fail-fast cap only
Expected impact
Per flake occurrence:
Test plan
Related
🤖 Generated with Claude Code
Greptile Summary
The PR reduces Playwright flake duration by warming the user search index before owner selection, imposing two-minute test ceilings, and replacing repeated Roles-list pagination with deterministic detail-page navigation.
Confidence Score: 5/5
The PR appears safe to merge.
No blocking failures remain.
Important Files Changed
Reviews (4): Last reviewed commit: "fix(playwright): poll user search index ..." | Re-trigger Greptile