test: Fix flaky service map Scout accessibility test#267960
Conversation
Split focus checks from find-in-page flow; drive fill and Enter via `#serviceMapFindInPageInput` so React `isFocused` updates highlight context. Assert `serviceMapNodeSearchHighlightFrame` before Enter while the find field stays focused. Closes elastic#262609 Co-authored-by: Cursor <cursoragent@cursor.com>
|
Pinging @elastic/obs-presentation-team (Team:obs-presentation) |
|
Catch flakiness early (recommended): this PR changes APM Scout UI specs and page objects for the service map; running the flaky test runner validates timing/focus paths beyond a single CI pass. Trigger via Flaky Test Runner UI or: /flaky scoutConfig:x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel.playwright.config.ts:30 |
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
|
|
/flaky scoutConfig:x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel.playwright.config.ts:30 |
Flaky Test Runner✅ Build triggered - kibana-flaky-test-suite-runner#12138
|
|
Starting backport for target branches: 9.3, 9.4 https://github.com/elastic/kibana/actions/runs/25442414603 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#12138[✅] x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel.playwright.config.ts (--arch stateful --domain classic): 30/30 tests passed. |
## Summary - Fixes the Scout failure tracked in [elastic#262609](elastic#262609): `service_map_a11y.spec.ts` expected `toBeFocused()` on the service circle **after** typing in find-in-page. Focusing the node blurs the find field; search highlights are intentionally cleared when the find input loses focus (`isFocused`), which led to unstable focus/DOM during the assertion. - Separates **node focus + focus ring** from **find-in-page**: focus the circle without opening find first; cover find in its own step (`focusBodyForMapShortcuts`, ⌃K, fill, match summary, Enter to center, settle). - **`expect(locator).toBeVisible()` on `serviceMapNodeSearchHighlightFrame` failed** even when the counter showed `1/1` because highlight context only updates when React treats the field as focused. `fill()` on `data-test-subj="serviceMapControlsSearch"` targets the **layout wrapper**; the native input may receive keystrokes without reliably firing `EuiFieldSearch` `onFocus`, so `isFocused` stayed false and **`serviceMapNodeSearchHighlightFrame` never rendered**. The test now fills and sends Enter via **`#serviceMapFindInPageInput`** (same element as `focusServiceMapFindInput()`). - Resolves the highlight frame from the service node root with an XPath ancestor to `[data-test-subj="serviceMapNodeSearchHighlightFrame"]`. - Asserts the highlight **before** Enter where possible: map centering can steal focus and clear highlights per existing product behavior. ## References Closes elastic#262609 Made with [Cursor](https://cursor.com) Co-authored-by: Cursor <cursoragent@cursor.com>
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
1 similar comment
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
|
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
3 similar comments
|
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
|
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
|
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
Summary
service_map_a11y.spec.tsexpectedtoBeFocused()on the service circle after typing in find-in-page. Focusing the node blurs the find field; search highlights are intentionally cleared when the find input loses focus (isFocused), which led to unstable focus/DOM during the assertion.focusBodyForMapShortcuts, ⌃K, fill, match summary, Enter to center, settle).expect(locator).toBeVisible()onserviceMapNodeSearchHighlightFramefailed even when the counter showed1/1because highlight context only updates when React treats the field as focused.fill()ondata-test-subj="serviceMapControlsSearch"targets the layout wrapper; the native input may receive keystrokes without reliably firingEuiFieldSearchonFocus, soisFocusedstayed false andserviceMapNodeSearchHighlightFramenever rendered. The test now fills and sends Enter via#serviceMapFindInPageInput(same element asfocusServiceMapFindInput()).[data-test-subj="serviceMapNodeSearchHighlightFrame"].References
Closes #262609
Made with Cursor