Let fillField clear the QAN search box, not a separate clearField - #1190
Closed
claude[bot] wants to merge 1 commit into
Closed
Let fillField clear the QAN search box, not a separate clearField#1190claude[bot] wants to merge 1 commit into
claude[bot] wants to merge 1 commit into
Conversation
PMM-T1061 and PMM-T1790 have failed the nightly QAN lane three runs running with: Clickable element "//input[contains(@name, "search")]" was not found at QueryAnalyticsData.searchByValue (queryAnalyticsData.js:158) QAN's Overview search became debounced search-as-you-type in percona/pmm#5537, so clearing the field is itself a search. 300ms later the empty search reloads the overview, and while it loads the QanTable renders a spinner instead of the table -- taking the header row, and the search input that lives in it, out of the DOM. searchByValue cleared the field and then clicked it, so it was re-finding an element its own clear had just swept away. fillField clears and types in one operation, so the input is never re-found mid-reload. Settle on waitForLoaded afterwards so callers see a loaded grid. Signed-off-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Failures fixed (investigator)
main@37a003d), jobtest execution / @qan|@menu|@valkey-nightly|@permissions-nightly|@pt-summary-nightly|@pbm-nightly(95247925371)codeceptjs-e2e/tests/QAN/overview_test.js:31/@qan— PMM-T1061 "Verify Plan and PlanID with pg_stat_monitor"codeceptjs-e2e/tests/QAN/details_explain_test.js:103/@qan— PMM-T1790 "Verify that there is any no error on Explains after switching between queries from different DB servers"Not a one-off: both have failed the same way in the last three nightlies —
runs 262,
261,
260.
The run's third red test, PMM-T269, is a different failure and is already
covered by #1186 — this PR does not address it, so the lane needs both to go
green. The job's later
Record launchable test resultsstep failed onlybecause
launchable gatesaw these asActionable Failures | 3(0quarantined); it is not a separate problem.
What failed
The step that waits for the input passes, the step that clears it passes, and
then the step that clicks that same input reports it does not exist.
Root cause — pmm-qa test code, not the product
QAN's Overview search became debounced search-as-you-type in
percona/pmm#5537 (PMM-14848):
Search.tsxnow fireshandleSearchfromonChangethrough aSEARCH_DEBOUNCE_MS = 300debounce, where before it only fired on form submit.So clearing the field is itself a search.
That matters because of where the search box lives. It is rendered inside the
overview table's first column header
(
DefaultColumns.tsx→HeaderAccessor: () => <Dimension />→Search), andQanTableswaps the whole table out while a query is in flight:So the reload that
clearFieldkicks off unmounts the header row — and thesearch input with it — for as long as the query takes.
searchByValueclearedthe field and then went looking for that input again, i.e. it re-found an
element its own clear had just swept away.
Read straight out of the failing run's Playwright trace (
monotonicTime, ms):queryCount('//input[contains(@name,"search")]')→ 1fill('')— codecept'sclearField— succeedsmetrics:getReport(fill + ~345 ms ≈ the 300 ms debounce)clickprobesqueryCount(…)→ 0 — the failuregetReportresponds (duration 311.8 ms), table remountsThe click landed 266 ms into a ~312 ms window in which the input did not
exist, and missed the response by ~46 ms.
This also explains why only the second search in each test fails. Both tests
call
searchByValueearlier with the field already empty —fill('')on anempty input changes nothing, fires no
onChange, triggers no reload. Thefailing calls (
overview_test.js:61, afterresetAllFilters();details_explain_test.js:112, clearing'SELECT') are the ones where thefield actually had a value to clear.
Reproduction (throwaway Linode VM)
PMM Server
perconalab/pmm-server:3-dev-latest, digestsha256:cba225bd21c7439ddef5971b4e470526c7d0e59ce9b1236e7ac84ff42430e305—byte-identical to the image the failing run recorded to Launchable — reporting
3.9.1-v3-c92cf5c93, same commit11ff3856. Clientlatest-tarball,--database ps --database psmdb,SETUP_TYPE=pss --database pdpgsql, Chromium151.0.7922.34 (the runner's version).
main, VM as provisioned (PMM on loopback)main,tc qdisc add dev lo root netem delay 80msThe latency is not a contrivance — this lane is "Nightly E2E tests Matrix
(remote PMM Server)": a GitHub-hosted runner driving a PMM Server across
the internet, where the trace shows
getReporttaking 312–529 ms. On a VM withPMM on loopback and 3 of the nightly's 14 setups the same query returns fast
enough that the table is back before codecept looks, which is why the fresh box
passes. Restoring a realistic round trip reproduces the CI failure exactly —
same message, same step, same preceding scenario steps.
Fix
fillField(Playwrightlocator.fill) clears and types in one operation andwaits for actionability itself, so there is no moment between "cleared" and
"typed" for the test to re-find a re-rendering input. Drop the separate
clearField+click, and settle onwaitForLoaded()so callers get a loadedgrid.
Backward-compatible with pre-#5537 builds (3.9.0-rc and the compatibility
legs), where search only fires on submit:
fillFieldfocuses the input, so theretained
I.pressKey('Enter')still submits exactly as before. The removedI.clickwas only ever giving focus thatfillalready gives.click()got the same treatment — it is currently unused, but it carried averbatim copy of the same racy sequence.
No assertion was loosened and no test was skipped.
Verification
Same VM, full
--grep "@qan"lane run twice back to back — once onmain,once on this branch — so the comparison is like for like:
main@37a003dmain: none. No regressionacross the lane, including the other 20 specs that call
searchByValue.on
mainand passes here.mainon this box and comefrom it having 3 of the nightly's 14 setups (e.g. the PMM-T2063 legs for
mysql_pmm_,pgsql_pgss_pmm,pxc_node__1fail in ~150 ms — thoseservices are not registered here).
npx eslintclean on the changed file.The red-to-green flip above is the direct evidence. Only the next nightly can
confirm it under the full 14-setup matrix against the real remote server.
Generated by Claude Code