Repository navigation
Fixes #38693: stop three recurring browser-test flakes at their root - #38694
Conversation
- networkIdle counted requests from MSW's service-worker events, which
reach the page later. Unmounting a page in afterEach flushes its
pending effects, and the requests they start could miss the first idle
check, so the handlers were reset and they landed unhandled in the
next test ("Data Consumer denied EditDescription", "children search
placeholder"). Count /api requests where the page sends them (fetch and
XMLHttpRequest), and yield one task first so axios has sent.
- Advanced search pickOption pinned its locator to the listbox id read
once; a popup that re-opened under the click got a new id and the click
waited out the test (175 s). It also toggled "Show options", which could
close a popup that opened a moment later. Open with ArrowDown and find
the option at click time.
- SchemaTable: searching also resets to page 1, which can start a plain
list fetch beside the search; a slower list response replaced the hits.
Only the latest columns request now sets the rows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code Review ✅ Approved 🟡 Medium riskThe SchemaTable latest-request guard changes concurrent result handling; without it, an older page fetch could replace filtered search results. Fixes three recurring browser-test flakes at their root: VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
UI browser testsRan: all test files (no impact map from main yet) Result: ✅ 1075 passed · 154 skipped Changed code executed by these browser tests: 12 / 17 lines (71%)
|
Fixes #38693
Describe your changes:
Three browser-test failures kept coming back on PRs that don't touch the code they test. Of the last 25 failed
UI Browser Testsruns, 9 were "Data Consumer denied EditDescription" (Table, Dashboard, Container, File, Topic), 6 were advanced search "two conditions as a group", and 2 were DriveService "children search placeholder". Each one has a root-cause fix and a test that fails without it.1. Requests started during unmount landed unhandled in the next test (
src/test/browser/network.ts)setup.tsunmounts the page inafterEach, waits fornetworkIdle, then resets the handlers.networkIdlecounted requests from MSW'srequest:startworker events, which reach the page through the service worker, later than the request itself. Unmounting flushes the page's pending effects, and those start requests. When the test's last activity was more than 150 ms earlier, the first idle check passed before the worker reported them. The handlers were then reset, and the requests became "API calls without an MSW handler" in the next test. That's why the failing test is always the one after a hard delete, and why the unhandled calls are always the delete test's landing page (databaseSchemas/name/…,storedProcedures,dashboardServices/name/…,containers,drives/*).I confirmed it with timing logs: 12 requests started after
cleanup()returned. The fix counts/apirequests where the page sends them (fetchandXMLHttpRequest, which axios uses), andnetworkIdleyields one task first so axios's promise-based interceptors have sent. The newnetwork.browser.test.tsfails on both cases (fetch, axios) with the old code, every time.2. Advanced search
pickOptioncould stall until the test timed out (src/test/browser/advanced-search/queryBuilder.ts)listboxOf(input)built its locator from the listbox id read at that moment. When the popup re-opened under the click, it got a new id ("element was detached"), and the click waited out the whole test (175 s). The step also clicked the "Show options" toggle whenever the popup wasn't open yet, which closed one that opened a moment later (thequeryBuilder.ts:67failures). It now opens with ArrowDown, which opens the popup or moves focus inside it and never closes it, and it finds the option at click time.pickSuggestionhad the same pinned id and is fixed the same way.3. SchemaTable: a stale page-1 list replaced the search hits (product bug,
SchemaTable.component.tsx)onSearchsetscolumnSearchand resets to page 1 as two updates. In between, the list effect can start a plain page-1 fetch next to the search fetch, and whichever answers last sets the rows. The CI failure screenshot showed exactly that:order_col_11in the search box, unfilteredorder_col_001…in the table. Users can hit it too. Only the latest columns request now sets rows, paging and the loader. The new browser test holds the page-1 list back for 500 ms; it fails without the fix and passes with it.Not in scope
EditConnectionFormPagesecret masking failed once, only ontest/connection-secret-masking, the PR that changes that page, so it isn't treated as a flake here.Type of change:
Tests
network.browser.test.ts: fails with the oldnetworkIdle(2/2) and passes with the fix.tscreports no errors in them.🤖 Generated with Claude Code