Fix QAN search page-object race with debounced search - #1188
Conversation
The QAN Overview search became search-as-you-type (debounced 300ms) in PMM-14848 (percona/pmm#5537, merged 2026-08-11). The searchByValue()/ click() page-object methods cleared the field before clicking it, and that clear now fires an empty search of its own, reloading the Overview panel and remounting the search input. The immediately following I.click() races that reload and fails with "Clickable element //input[contains(@name, "search")] was not found" (PMM-T1061, PMM-T1790, and any @qan spec that searches). Click the already-loaded grid first and let I.fillField clear+type in a single action (Playwright fill clears the field), so only one search is issued, then wait for the panel to settle. Apply the same settle to clearSearchValue(). Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: travagliad <215686151+travagliad@users.noreply.github.com>
|
Closing this — it should never have been opened. My dedup only covered open More importantly, it classifies this correctly — as a product bug — and my
So the input doesn't merely race a reload: the product deletes its own search PMM-15336 is explicit that the tests are to stay as they are:
That is exactly what this PR would have done. Removing the The measurements I took stand and agree with the ticket's (search input out of the Generated by Claude Code |
Failures fixed (investigator)
main@37a003d), jobtest execution / @qan|@menu|@valkey-nightly|@permissions-nightly|@pt-summary-nightly|@pbm-nightlycodeceptjs-e2e/tests/QAN/details_explain_test.js:103/@qan— PMM-T1790 "no error on Explains after switching between queries from different DB servers"codeceptjs-e2e/tests/QAN/overview_test.js:31/@qan— PMM-T1061 "Verify Plan and PlanID with pg_stat_monitor"What failed
The only red job in the run (
88 passed, 2 failed, 21 skipped). Both failures arethe same error, at the same page-object line:
The field is visible,
clearFieldon it succeeds — and then the very next stepcannot find it at all.
Not a one-off: the same two tests failed the same way on three consecutive
nightlies — 31653305276 (08-13),
31756198073 (08-14),
31852756475 (08-15).
Root cause — our page object, not the product
percona/pmm#5537 (PMM-14848, merged
2026-08-11 — two days before the first red nightly) turned the QAN Overview
search into debounced search-as-you-type:
Every value change now issues a search of its own.
I.clearFieldis a valuechange, so
searchByValue()fires an empty search before it ever gets to theclick, the Overview panel reloads, and the search input is remounted underneath
the pending
I.click.Measured on the reproduction VM
Throwaway Linode VM,
perconalab/pmm-server:3-dev-latest(3.9.1-v3-b9a8db278,so it has #5537),
latest-tarballclient,pdpgsql+ps+psmdbsetups.Driving the real UI and polling the DOM every 50 ms after a
fill('')on thesearch input — three runs:
So there is a ~700-800 ms window in which
//input[contains(@name, "search")]matches nothing — which is exactly the error CI reports.
pr.codecept.jssetswaitForAction: 500, soI.clickfires ≈500 ms afterI.clearField— straddling the start of that window. In two of the threemeasurements the gap was already open at 500 ms. Whether the click lands just
before or just inside the gap is decided by tens of milliseconds, which is why
the nightly's loaded remote server loses it every night while a fresh,
lightly-loaded VM wins it.
Fix
Don't issue a search just to empty the field: drop the pre-click
clearField(Playwright's
fillclears the field as part of typing, soI.fillFieldalonedoes the job in one action and one debounce), and settle the panel afterwards.
Verification
Full
@qansuite on the same VM, before and after the change (same server, samesetups, runs ~1 h apart):
main@37a003dPMM-T1061 and PMM-T1790 pass in both runs. Every baseline failure is still a
failure afterwards (no test was "fixed" by accident) and three more appear:
.ant-pagination-item-ellipsis(not visible / not found). Whether that element renders depends on how many
pages of QAN data exist, and the dataset grew between the two runs. The
baseline's own PMM-T193 failure shows the same drift (
expected 100, actual 75items).supposed to result in Query with value: 0.05 QPS but the resulted query found is 0.06 QPS. A value that moves whilethe generator keeps running. Notably the search in this test worked; only
the QPS assertion drifted.
None of the three touch
searchByValue()/click()/clearSearchValue(), andneither run produced a "search input not found" error (the one
was not foundin the after-run is the pagination ellipsis above).
What this does not prove. As explained above, this VM wins the race the
nightly loses, so a green run here is not evidence the nightly is fixed. What
is established here is the mechanism (the measured DOM gap) and that removing
the extra search does not regress the
@qansuite. Only the next real nightlycan confirm PMM-T1061/PMM-T1790 go green in CI.
Note on PR #1184
#1184's description lists this
exact fix ("fix 1", commit
0b2c040) and namesPMM-T1061/PMM-T1790, but that commit is no longer on its branch — the file
isn't in #1184's diff and
mainstill has the racy sequence. So despite what#1184 says, nothing open currently fixes these two tests. This PR restores it.
Generated by Claude Code