Loading challenge...
Beat a search whose short queries resolve slower — assert the final query wins, not a stale response
Each keystroke fires a request that is never cancelled — and the backend answers short queries SLOWER than long ones, so stale responses can overwrite fresh ones
Type into the box and every character fires a new request to /api/lab/search. The server delay is inversely proportional to the query length, so an early short query can resolve after a later long one and clobber the list.
A naive test that just waits a fixed time then reads the results will sometimes see stale data. Your job is to assert that the displayed results actually match the final query.
Results render in whatever order responses arrive
showing results for:
Automation hints
#search-input then waits a fixed timeout often reads stale results — the early short-query response lands last and overwrites the final listpage.waitForResponse(r => r.url().includes(finalQuery)) before asserting, or abort/cancel stale in-flight requests in the app#search-results[data-query] equals the final query, not just that any rows existdata-result id — count [data-result] for result presence and read its text for ordering checks#search-status flips between typing… and showing results for: <q> — use it as a settle signal, but never trust it over data-query