Skip to content

test: Fix flaky service map Scout accessibility test#267960

Merged
jennypavlova merged 1 commit into
elastic:mainfrom
jennypavlova:262609-fix-test
May 6, 2026
Merged

test: Fix flaky service map Scout accessibility test#267960
jennypavlova merged 1 commit into
elastic:mainfrom
jennypavlova:262609-fix-test

Conversation

@jennypavlova
Copy link
Copy Markdown
Member

@jennypavlova jennypavlova commented May 6, 2026

Summary

  • Fixes the Scout failure tracked in #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 #262609

Made with Cursor

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>
@jennypavlova jennypavlova requested a review from a team as a code owner May 6, 2026 12:16
@jennypavlova jennypavlova added the release_note:skip Skip the PR/issue when compiling release notes label May 6, 2026
@jennypavlova jennypavlova requested a review from a team as a code owner May 6, 2026 12:16
@jennypavlova jennypavlova added backport:version Backport to applied version labels v9.3.0 v9.4.0 Team:obs-presentation Focus: APM UI, Infra UI, Hosts UI, Universal Profiling, Obs Overview and left Navigation release_note:skip Skip the PR/issue when compiling release notes labels May 6, 2026
@infra-vault-gh-plugin-prod
Copy link
Copy Markdown

Pinging @elastic/obs-presentation-team (Team:obs-presentation)

@jennypavlova
Copy link
Copy Markdown
Member Author

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

@kibanamachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

@jennypavlova
Copy link
Copy Markdown
Member Author

/flaky scoutConfig:x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel.playwright.config.ts:30

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner

✅ Build triggered - kibana-flaky-test-suite-runner#12138

  • x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel.playwright.config.ts x30

Copy link
Copy Markdown
Contributor

@sbelastic sbelastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jennypavlova jennypavlova merged commit 7dfcaed into elastic:main May 6, 2026
174 of 187 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 9.3, 9.4

https://github.com/elastic/kibana/actions/runs/25442414603

@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
9.3 Backport failed because of merge conflicts
9.4 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 267960

Questions ?

Please refer to the Backport tool documentation

@kibanamachine
Copy link
Copy Markdown
Contributor

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.
[✅] x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel.playwright.config.ts (--arch serverless --domain observability_complete): 30/30 tests passed.

see run history

ersin-erdal pushed a commit to ersin-erdal/kibana that referenced this pull request May 6, 2026
## 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>
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label May 7, 2026
@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 267960 locally
cc: @jennypavlova

1 similar comment
@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 267960 locally
cc: @jennypavlova

@jennypavlova
Copy link
Copy Markdown
Member Author

💚 All backports created successfully

Status Branch Result
9.4
9.3

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@kibanamachine
Copy link
Copy Markdown
Contributor

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.
cc: @jennypavlova

3 similar comments
@kibanamachine
Copy link
Copy Markdown
Contributor

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.
cc: @jennypavlova

@kibanamachine
Copy link
Copy Markdown
Contributor

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.
cc: @jennypavlova

@kibanamachine
Copy link
Copy Markdown
Contributor

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.
cc: @jennypavlova

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport missing Added to PRs automatically when the are determined to be missing a backport. backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:obs-presentation Focus: APM UI, Infra UI, Hosts UI, Universal Profiling, Obs Overview and left Navigation v9.4.0 v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failing test: Service map - accessibility - focus management and visible indicators work correctly

3 participants