Skip to content

[ML] Fix flaky source_selection test by asserting against the visible callout copy#280705

Merged
kibanamachine merged 1 commit into
mainfrom
fix/flaky-280686-source-selection-callout-announce-027d2b05460cd583
Jul 24, 2026
Merged

[ML] Fix flaky source_selection test by asserting against the visible callout copy#280705
kibanamachine merged 1 commit into
mainfrom
fix/flaky-280686-source-selection-callout-announce-027d2b05460cd583

Conversation

@kibanamachine

@kibanamachine kibanamachine commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #280686 - likely introduced by #235054 (cc @paulinashakirova)

Summary

  • The analyticsCreateSourceIndexModalCcsErrorCallOut callout is rendered with announceOnMount, so EUI mounts a screen-reader role="status" copy of the title (and body) alongside the visible copy.
  • Three positive assertions used single-match queryByText(...), which throws Found multiple elements whenever the SR copy is present — a timing-dependent flake.
  • This patch switches those three assertions to getAllByText(...)[0], asserting against the visible copy (which precedes the live-region copy in the DOM). No production change — announceOnMount is intended a11y behavior.

Context

Verification

Verified locally

  • ✅ Passed: node scripts/eslint x-pack/platform/plugins/shared/ml/public/application/data_frame_analytics/pages/analytics_management/components/source_selection/source_selection.test.tsx
  • ✅ Passed: node scripts/jest x-pack/platform/plugins/shared/ml/public/application/data_frame_analytics/pages/analytics_management/components/source_selection/source_selection.test.tsx — all 5 tests pass

Not verified locally

  • node scripts/type_check --project x-pack/platform/plugins/shared/ml/tsconfig.json was killed by the sandbox's memory limit (SIGKILL) before completing, twice. The change is a test-only edit using standard @testing-library/react APIs (getAllByText(...)[0] returns an HTMLElement) and introduces no new types.
Backporting guidance

Applied backport:version with v9.5.0, v9.4.5, and v9.3.9. The announceOnMount root cause was introduced by #235054 (v9.3.0), and the test file exists unchanged on the 9.5, 9.4, and 9.3 release branches, so the patch applies there cleanly. The 8.19 branch predates announceOnMount (no duplicate copy, no flake), so it is excluded.

Note

Share feedback in #kibana-qa. Mention @copilot to make quick changes.

Generated by Flaky Test Fixer for #280686 · 229.9 AIC · ⌖ 11.5 AIC · ⊞ 672 ·

The CcsErrorCallOut uses `announceOnMount`, which renders a duplicate
screen-reader copy of the title and body. Switch the three positive
assertions from single-match `queryByText` to `getAllByText(...)[0]`
to assert against the visible copy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kibanamachine

Copy link
Copy Markdown
Contributor Author

⏭️ Flaky-fix verification skipped

The flaky test runner isn't used here: this fix touches only a Jest unit test (source_selection.test.tsx), which the /flaky runner (FTR/Scout only) can't execute, and the change is deterministic — it swaps queryByText(...) for getAllByText(...)[0] so the assertion tolerates the duplicate announceOnMount screen-reader copy. A single Jest pass in the required CI lane is a reliable verdict, so repeated runs would add no signal.

Generated by Flaky Fix Verifier for #280705 · 81.7 AIC · ⌖ 10.1 AIC · ⊞ 890 ·

@kibanamachine
kibanamachine marked this pull request as ready for review July 24, 2026 09:41
@kibanamachine
kibanamachine requested a review from a team as a code owner July 24, 2026 09:41
@kibanamachine
kibanamachine enabled auto-merge (squash) July 24, 2026 09:41
@kibanamachine

Copy link
Copy Markdown
Contributor Author

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Scout Lane #8 - stateful-classic / default / local-stateful-classic - Entity attachment cases – flyout add-to-case actions and Entities accordion - Entities accordion renders when entity attachments were added via API
  • [job] [logs] Scout Lane #8 - stateful-classic / default / local-stateful-classic - Entity attachment cases – flyout add-to-case actions and Entities accordion - renders no Entities accordion when a case has no entity attachments

Metrics [docs]

✅ unchanged

@alvarezmelissa87 alvarezmelissa87 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@kibanamachine
kibanamachine merged commit d4e18e0 into main Jul 24, 2026
314 of 348 checks passed
@kibanamachine
kibanamachine deleted the fix/flaky-280686-source-selection-callout-announce-027d2b05460cd583 branch July 24, 2026 18:35
@kibanamachine

Copy link
Copy Markdown
Contributor Author

Starting backport for target branches: 9.3, 9.4, 9.5

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

@kibanamachine

Copy link
Copy Markdown
Contributor Author

💚 All backports created successfully

Status Branch Result
9.3
9.4
9.5

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

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jul 24, 2026
…isible callout copy (#280705) (#280875)

# Backport

This will backport the following commits from `main` to `9.5`:
- [[ML] Fix flaky source_selection test by asserting against the visible
callout copy (#280705)](#280705)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Kibana
Machine","email":"42973632+kibanamachine@users.noreply.github.com"},"sourceCommit":{"committedDate":"2026-07-24T18:35:13Z","message":"[ML]
Fix flaky source_selection test by asserting against the visible callout
copy (#280705)\n\nFixes #280686 - likely introduced by #235054 (cc
`@paulinashakirova`)\n\n### Summary\n\n- The
`analyticsCreateSourceIndexModalCcsErrorCallOut` callout is\nrendered
with `announceOnMount`, so EUI mounts a screen-reader\n`role=\"status\"`
copy of the title (and body) alongside the visible copy.\n- Three
positive assertions used single-match `queryByText(...)`, which\nthrows
`Found multiple elements` whenever the SR copy is present —
a\ntiming-dependent flake.\n- This patch switches those three assertions
to `getAllByText(...)[0]`,\nasserting against the visible copy (which
precedes the live-region copy\nin the DOM). No production change —
`announceOnMount` is intended a11y\nbehavior.\n\n### Context\n\n-
Follows the [failed-test investigator's
proposed\nfix](https://github.com/elastic/kibana/issues/280686#issuecomment-5068150163)\nexactly
(the already-merged `getAllByText(...)[0]` pattern from\n#269061).\n-
Failure was on `main` in the `kibana-on-merge` Jest lane
([build\n103893](https://buildkite.com/elastic/kibana-on-merge/builds/103893#019f9342-9398-4616-9954-22fbe43a9695));\nthe
`announceOnMount` copy is populated on a `setTimeout`, so whether\nthe
duplicate exists when the assertion runs is a race.\n- Also fixes the
identical title+body assertions in the sibling test\n(subject of
#254968), which carry the same
bug.\n\n<details>\n<summary>Verification</summary>\n\n#### Verified
locally\n\n- `✅ Passed: node
scripts/eslint\nx-pack/platform/plugins/shared/ml/public/application/data_frame_analytics/pages/analytics_management/components/source_selection/source_selection.test.tsx`\n-
`✅ Passed: node
scripts/jest\nx-pack/platform/plugins/shared/ml/public/application/data_frame_analytics/pages/analytics_management/components/source_selection/source_selection.test.tsx`\n—
all 5 tests pass\n\n#### Not verified locally\n\n- `node
scripts/type_check
--project\nx-pack/platform/plugins/shared/ml/tsconfig.json` was killed
by the\nsandbox's memory limit (SIGKILL) before completing, twice. The
change is\na test-only edit using standard `@testing-library/react`
APIs\n(`getAllByText(...)[0]` returns an `HTMLElement`) and introduces
no new\ntypes.\n\n</details>\n\n<details>\n<summary>Backporting
guidance</summary>\n\nApplied `backport:version` with `v9.5.0`,
`v9.4.5`, and `v9.3.9`. The\n`announceOnMount` root cause was introduced
by #235054 (`v9.3.0`), and\nthe test file exists unchanged on the `9.5`,
`9.4`, and `9.3` release\nbranches, so the patch applies there cleanly.
The `8.19` branch predates\n`announceOnMount` (no duplicate copy, no
flake), so it is excluded.\n\n</details>\n\n> [!NOTE]\n> Share feedback
in #kibana-qa. Mention `@copilot` to make quick\nchanges.\n\n\n\n\n>
Generated by [Flaky
Test\nFixer](https://github.com/elastic/kibana/actions/runs/30081512525)
for\n#280686 · 229.9 AIC · ⌖ 11.5 AIC · ⊞ 672
·\n[◷](https://github.com/search?q=repo%3Aelastic%2Fkibana+%22gh-aw-workflow-id%3A+flaky-test-fixer%22&type=pullrequests)\n\n\n\n\n\n\nCo-authored-by:
Claude Opus 4.8 (1M context)
<noreply@anthropic.com>","sha":"d4e18e0234335731ba442786ac02c05f0bc84480","branchLabelMapping":{"^v9.6.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","v9.5.0","flaky-test-fixer","flaky-fix-check:skipped","v9.6.0","v9.4.5","v9.3.9"],"title":"[ML]
Fix flaky source_selection test by asserting against the visible callout
copy","number":280705,"url":"https://github.com/elastic/kibana/pull/280705","mergeCommit":{"message":"[ML]
Fix flaky source_selection test by asserting against the visible callout
copy (#280705)\n\nFixes #280686 - likely introduced by #235054 (cc
`@paulinashakirova`)\n\n### Summary\n\n- The
`analyticsCreateSourceIndexModalCcsErrorCallOut` callout is\nrendered
with `announceOnMount`, so EUI mounts a screen-reader\n`role=\"status\"`
copy of the title (and body) alongside the visible copy.\n- Three
positive assertions used single-match `queryByText(...)`, which\nthrows
`Found multiple elements` whenever the SR copy is present —
a\ntiming-dependent flake.\n- This patch switches those three assertions
to `getAllByText(...)[0]`,\nasserting against the visible copy (which
precedes the live-region copy\nin the DOM). No production change —
`announceOnMount` is intended a11y\nbehavior.\n\n### Context\n\n-
Follows the [failed-test investigator's
proposed\nfix](https://github.com/elastic/kibana/issues/280686#issuecomment-5068150163)\nexactly
(the already-merged `getAllByText(...)[0]` pattern from\n#269061).\n-
Failure was on `main` in the `kibana-on-merge` Jest lane
([build\n103893](https://buildkite.com/elastic/kibana-on-merge/builds/103893#019f9342-9398-4616-9954-22fbe43a9695));\nthe
`announceOnMount` copy is populated on a `setTimeout`, so whether\nthe
duplicate exists when the assertion runs is a race.\n- Also fixes the
identical title+body assertions in the sibling test\n(subject of
#254968), which carry the same
bug.\n\n<details>\n<summary>Verification</summary>\n\n#### Verified
locally\n\n- `✅ Passed: node
scripts/eslint\nx-pack/platform/plugins/shared/ml/public/application/data_frame_analytics/pages/analytics_management/components/source_selection/source_selection.test.tsx`\n-
`✅ Passed: node
scripts/jest\nx-pack/platform/plugins/shared/ml/public/application/data_frame_analytics/pages/analytics_management/components/source_selection/source_selection.test.tsx`\n—
all 5 tests pass\n\n#### Not verified locally\n\n- `node
scripts/type_check
--project\nx-pack/platform/plugins/shared/ml/tsconfig.json` was killed
by the\nsandbox's memory limit (SIGKILL) before completing, twice. The
change is\na test-only edit using standard `@testing-library/react`
APIs\n(`getAllByText(...)[0]` returns an `HTMLElement`) and introduces
no new\ntypes.\n\n</details>\n\n<details>\n<summary>Backporting
guidance</summary>\n\nApplied `backport:version` with `v9.5.0`,
`v9.4.5`, and `v9.3.9`. The\n`announceOnMount` root cause was introduced
by #235054 (`v9.3.0`), and\nthe test file exists unchanged on the `9.5`,
`9.4`, and `9.3` release\nbranches, so the patch applies there cleanly.
The `8.19` branch predates\n`announceOnMount` (no duplicate copy, no
flake), so it is excluded.\n\n</details>\n\n> [!NOTE]\n> Share feedback
in #kibana-qa. Mention `@copilot` to make quick\nchanges.\n\n\n\n\n>
Generated by [Flaky
Test\nFixer](https://github.com/elastic/kibana/actions/runs/30081512525)
for\n#280686 · 229.9 AIC · ⌖ 11.5 AIC · ⊞ 672
·\n[◷](https://github.com/search?q=repo%3Aelastic%2Fkibana+%22gh-aw-workflow-id%3A+flaky-test-fixer%22&type=pullrequests)\n\n\n\n\n\n\nCo-authored-by:
Claude Opus 4.8 (1M context)
<noreply@anthropic.com>","sha":"d4e18e0234335731ba442786ac02c05f0bc84480"}},"sourceBranch":"main","suggestedTargetBranches":["9.5","9.4","9.3"],"targetPullRequestStates":[{"branch":"9.5","label":"v9.5.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.6.0","branchLabelMappingKey":"^v9.6.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/280705","number":280705,"mergeCommit":{"message":"[ML]
Fix flaky source_selection test by asserting against the visible callout
copy (#280705)\n\nFixes #280686 - likely introduced by #235054 (cc
`@paulinashakirova`)\n\n### Summary\n\n- The
`analyticsCreateSourceIndexModalCcsErrorCallOut` callout is\nrendered
with `announceOnMount`, so EUI mounts a screen-reader\n`role=\"status\"`
copy of the title (and body) alongside the visible copy.\n- Three
positive assertions used single-match `queryByText(...)`, which\nthrows
`Found multiple elements` whenever the SR copy is present —
a\ntiming-dependent flake.\n- This patch switches those three assertions
to `getAllByText(...)[0]`,\nasserting against the visible copy (which
precedes the live-region copy\nin the DOM). No production change —
`announceOnMount` is intended a11y\nbehavior.\n\n### Context\n\n-
Follows the [failed-test investigator's
proposed\nfix](https://github.com/elastic/kibana/issues/280686#issuecomment-5068150163)\nexactly
(the already-merged `getAllByText(...)[0]` pattern from\n#269061).\n-
Failure was on `main` in the `kibana-on-merge` Jest lane
([build\n103893](https://buildkite.com/elastic/kibana-on-merge/builds/103893#019f9342-9398-4616-9954-22fbe43a9695));\nthe
`announceOnMount` copy is populated on a `setTimeout`, so whether\nthe
duplicate exists when the assertion runs is a race.\n- Also fixes the
identical title+body assertions in the sibling test\n(subject of
#254968), which carry the same
bug.\n\n<details>\n<summary>Verification</summary>\n\n#### Verified
locally\n\n- `✅ Passed: node
scripts/eslint\nx-pack/platform/plugins/shared/ml/public/application/data_frame_analytics/pages/analytics_management/components/source_selection/source_selection.test.tsx`\n-
`✅ Passed: node
scripts/jest\nx-pack/platform/plugins/shared/ml/public/application/data_frame_analytics/pages/analytics_management/components/source_selection/source_selection.test.tsx`\n—
all 5 tests pass\n\n#### Not verified locally\n\n- `node
scripts/type_check
--project\nx-pack/platform/plugins/shared/ml/tsconfig.json` was killed
by the\nsandbox's memory limit (SIGKILL) before completing, twice. The
change is\na test-only edit using standard `@testing-library/react`
APIs\n(`getAllByText(...)[0]` returns an `HTMLElement`) and introduces
no new\ntypes.\n\n</details>\n\n<details>\n<summary>Backporting
guidance</summary>\n\nApplied `backport:version` with `v9.5.0`,
`v9.4.5`, and `v9.3.9`. The\n`announceOnMount` root cause was introduced
by #235054 (`v9.3.0`), and\nthe test file exists unchanged on the `9.5`,
`9.4`, and `9.3` release\nbranches, so the patch applies there cleanly.
The `8.19` branch predates\n`announceOnMount` (no duplicate copy, no
flake), so it is excluded.\n\n</details>\n\n> [!NOTE]\n> Share feedback
in #kibana-qa. Mention `@copilot` to make quick\nchanges.\n\n\n\n\n>
Generated by [Flaky
Test\nFixer](https://github.com/elastic/kibana/actions/runs/30081512525)
for\n#280686 · 229.9 AIC · ⌖ 11.5 AIC · ⊞ 672
·\n[◷](https://github.com/search?q=repo%3Aelastic%2Fkibana+%22gh-aw-workflow-id%3A+flaky-test-fixer%22&type=pullrequests)\n\n\n\n\n\n\nCo-authored-by:
Claude Opus 4.8 (1M context)
<noreply@anthropic.com>","sha":"d4e18e0234335731ba442786ac02c05f0bc84480"}},{"branch":"9.4","label":"v9.4.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.3","label":"v9.3.9","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
kibanamachine added a commit that referenced this pull request Jul 24, 2026
…isible callout copy (#280705) (#280874)

# Backport

This will backport the following commits from `main` to `9.4`:
- [[ML] Fix flaky source_selection test by asserting against the visible
callout copy (#280705)](#280705)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Kibana
Machine","email":"42973632+kibanamachine@users.noreply.github.com"},"sourceCommit":{"committedDate":"2026-07-24T18:35:13Z","message":"[ML]
Fix flaky source_selection test by asserting against the visible callout
copy (#280705)\n\nFixes #280686 - likely introduced by #235054 (cc
`@paulinashakirova`)\n\n### Summary\n\n- The
`analyticsCreateSourceIndexModalCcsErrorCallOut` callout is\nrendered
with `announceOnMount`, so EUI mounts a screen-reader\n`role=\"status\"`
copy of the title (and body) alongside the visible copy.\n- Three
positive assertions used single-match `queryByText(...)`, which\nthrows
`Found multiple elements` whenever the SR copy is present —
a\ntiming-dependent flake.\n- This patch switches those three assertions
to `getAllByText(...)[0]`,\nasserting against the visible copy (which
precedes the live-region copy\nin the DOM). No production change —
`announceOnMount` is intended a11y\nbehavior.\n\n### Context\n\n-
Follows the [failed-test investigator's
proposed\nfix](https://github.com/elastic/kibana/issues/280686#issuecomment-5068150163)\nexactly
(the already-merged `getAllByText(...)[0]` pattern from\n#269061).\n-
Failure was on `main` in the `kibana-on-merge` Jest lane
([build\n103893](https://buildkite.com/elastic/kibana-on-merge/builds/103893#019f9342-9398-4616-9954-22fbe43a9695));\nthe
`announceOnMount` copy is populated on a `setTimeout`, so whether\nthe
duplicate exists when the assertion runs is a race.\n- Also fixes the
identical title+body assertions in the sibling test\n(subject of
#254968), which carry the same
bug.\n\n<details>\n<summary>Verification</summary>\n\n#### Verified
locally\n\n- `✅ Passed: node
scripts/eslint\nx-pack/platform/plugins/shared/ml/public/application/data_frame_analytics/pages/analytics_management/components/source_selection/source_selection.test.tsx`\n-
`✅ Passed: node
scripts/jest\nx-pack/platform/plugins/shared/ml/public/application/data_frame_analytics/pages/analytics_management/components/source_selection/source_selection.test.tsx`\n—
all 5 tests pass\n\n#### Not verified locally\n\n- `node
scripts/type_check
--project\nx-pack/platform/plugins/shared/ml/tsconfig.json` was killed
by the\nsandbox's memory limit (SIGKILL) before completing, twice. The
change is\na test-only edit using standard `@testing-library/react`
APIs\n(`getAllByText(...)[0]` returns an `HTMLElement`) and introduces
no new\ntypes.\n\n</details>\n\n<details>\n<summary>Backporting
guidance</summary>\n\nApplied `backport:version` with `v9.5.0`,
`v9.4.5`, and `v9.3.9`. The\n`announceOnMount` root cause was introduced
by #235054 (`v9.3.0`), and\nthe test file exists unchanged on the `9.5`,
`9.4`, and `9.3` release\nbranches, so the patch applies there cleanly.
The `8.19` branch predates\n`announceOnMount` (no duplicate copy, no
flake), so it is excluded.\n\n</details>\n\n> [!NOTE]\n> Share feedback
in #kibana-qa. Mention `@copilot` to make quick\nchanges.\n\n\n\n\n>
Generated by [Flaky
Test\nFixer](https://github.com/elastic/kibana/actions/runs/30081512525)
for\n#280686 · 229.9 AIC · ⌖ 11.5 AIC · ⊞ 672
·\n[◷](https://github.com/search?q=repo%3Aelastic%2Fkibana+%22gh-aw-workflow-id%3A+flaky-test-fixer%22&type=pullrequests)\n\n\n\n\n\n\nCo-authored-by:
Claude Opus 4.8 (1M context)
<noreply@anthropic.com>","sha":"d4e18e0234335731ba442786ac02c05f0bc84480","branchLabelMapping":{"^v9.6.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","v9.5.0","flaky-test-fixer","flaky-fix-check:skipped","v9.6.0","v9.4.5","v9.3.9"],"title":"[ML]
Fix flaky source_selection test by asserting against the visible callout
copy","number":280705,"url":"https://github.com/elastic/kibana/pull/280705","mergeCommit":{"message":"[ML]
Fix flaky source_selection test by asserting against the visible callout
copy (#280705)\n\nFixes #280686 - likely introduced by #235054 (cc
`@paulinashakirova`)\n\n### Summary\n\n- The
`analyticsCreateSourceIndexModalCcsErrorCallOut` callout is\nrendered
with `announceOnMount`, so EUI mounts a screen-reader\n`role=\"status\"`
copy of the title (and body) alongside the visible copy.\n- Three
positive assertions used single-match `queryByText(...)`, which\nthrows
`Found multiple elements` whenever the SR copy is present —
a\ntiming-dependent flake.\n- This patch switches those three assertions
to `getAllByText(...)[0]`,\nasserting against the visible copy (which
precedes the live-region copy\nin the DOM). No production change —
`announceOnMount` is intended a11y\nbehavior.\n\n### Context\n\n-
Follows the [failed-test investigator's
proposed\nfix](https://github.com/elastic/kibana/issues/280686#issuecomment-5068150163)\nexactly
(the already-merged `getAllByText(...)[0]` pattern from\n#269061).\n-
Failure was on `main` in the `kibana-on-merge` Jest lane
([build\n103893](https://buildkite.com/elastic/kibana-on-merge/builds/103893#019f9342-9398-4616-9954-22fbe43a9695));\nthe
`announceOnMount` copy is populated on a `setTimeout`, so whether\nthe
duplicate exists when the assertion runs is a race.\n- Also fixes the
identical title+body assertions in the sibling test\n(subject of
#254968), which carry the same
bug.\n\n<details>\n<summary>Verification</summary>\n\n#### Verified
locally\n\n- `✅ Passed: node
scripts/eslint\nx-pack/platform/plugins/shared/ml/public/application/data_frame_analytics/pages/analytics_management/components/source_selection/source_selection.test.tsx`\n-
`✅ Passed: node
scripts/jest\nx-pack/platform/plugins/shared/ml/public/application/data_frame_analytics/pages/analytics_management/components/source_selection/source_selection.test.tsx`\n—
all 5 tests pass\n\n#### Not verified locally\n\n- `node
scripts/type_check
--project\nx-pack/platform/plugins/shared/ml/tsconfig.json` was killed
by the\nsandbox's memory limit (SIGKILL) before completing, twice. The
change is\na test-only edit using standard `@testing-library/react`
APIs\n(`getAllByText(...)[0]` returns an `HTMLElement`) and introduces
no new\ntypes.\n\n</details>\n\n<details>\n<summary>Backporting
guidance</summary>\n\nApplied `backport:version` with `v9.5.0`,
`v9.4.5`, and `v9.3.9`. The\n`announceOnMount` root cause was introduced
by #235054 (`v9.3.0`), and\nthe test file exists unchanged on the `9.5`,
`9.4`, and `9.3` release\nbranches, so the patch applies there cleanly.
The `8.19` branch predates\n`announceOnMount` (no duplicate copy, no
flake), so it is excluded.\n\n</details>\n\n> [!NOTE]\n> Share feedback
in #kibana-qa. Mention `@copilot` to make quick\nchanges.\n\n\n\n\n>
Generated by [Flaky
Test\nFixer](https://github.com/elastic/kibana/actions/runs/30081512525)
for\n#280686 · 229.9 AIC · ⌖ 11.5 AIC · ⊞ 672
·\n[◷](https://github.com/search?q=repo%3Aelastic%2Fkibana+%22gh-aw-workflow-id%3A+flaky-test-fixer%22&type=pullrequests)\n\n\n\n\n\n\nCo-authored-by:
Claude Opus 4.8 (1M context)
<noreply@anthropic.com>","sha":"d4e18e0234335731ba442786ac02c05f0bc84480"}},"sourceBranch":"main","suggestedTargetBranches":["9.5","9.4","9.3"],"targetPullRequestStates":[{"branch":"9.5","label":"v9.5.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.6.0","branchLabelMappingKey":"^v9.6.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/280705","number":280705,"mergeCommit":{"message":"[ML]
Fix flaky source_selection test by asserting against the visible callout
copy (#280705)\n\nFixes #280686 - likely introduced by #235054 (cc
`@paulinashakirova`)\n\n### Summary\n\n- The
`analyticsCreateSourceIndexModalCcsErrorCallOut` callout is\nrendered
with `announceOnMount`, so EUI mounts a screen-reader\n`role=\"status\"`
copy of the title (and body) alongside the visible copy.\n- Three
positive assertions used single-match `queryByText(...)`, which\nthrows
`Found multiple elements` whenever the SR copy is present —
a\ntiming-dependent flake.\n- This patch switches those three assertions
to `getAllByText(...)[0]`,\nasserting against the visible copy (which
precedes the live-region copy\nin the DOM). No production change —
`announceOnMount` is intended a11y\nbehavior.\n\n### Context\n\n-
Follows the [failed-test investigator's
proposed\nfix](https://github.com/elastic/kibana/issues/280686#issuecomment-5068150163)\nexactly
(the already-merged `getAllByText(...)[0]` pattern from\n#269061).\n-
Failure was on `main` in the `kibana-on-merge` Jest lane
([build\n103893](https://buildkite.com/elastic/kibana-on-merge/builds/103893#019f9342-9398-4616-9954-22fbe43a9695));\nthe
`announceOnMount` copy is populated on a `setTimeout`, so whether\nthe
duplicate exists when the assertion runs is a race.\n- Also fixes the
identical title+body assertions in the sibling test\n(subject of
#254968), which carry the same
bug.\n\n<details>\n<summary>Verification</summary>\n\n#### Verified
locally\n\n- `✅ Passed: node
scripts/eslint\nx-pack/platform/plugins/shared/ml/public/application/data_frame_analytics/pages/analytics_management/components/source_selection/source_selection.test.tsx`\n-
`✅ Passed: node
scripts/jest\nx-pack/platform/plugins/shared/ml/public/application/data_frame_analytics/pages/analytics_management/components/source_selection/source_selection.test.tsx`\n—
all 5 tests pass\n\n#### Not verified locally\n\n- `node
scripts/type_check
--project\nx-pack/platform/plugins/shared/ml/tsconfig.json` was killed
by the\nsandbox's memory limit (SIGKILL) before completing, twice. The
change is\na test-only edit using standard `@testing-library/react`
APIs\n(`getAllByText(...)[0]` returns an `HTMLElement`) and introduces
no new\ntypes.\n\n</details>\n\n<details>\n<summary>Backporting
guidance</summary>\n\nApplied `backport:version` with `v9.5.0`,
`v9.4.5`, and `v9.3.9`. The\n`announceOnMount` root cause was introduced
by #235054 (`v9.3.0`), and\nthe test file exists unchanged on the `9.5`,
`9.4`, and `9.3` release\nbranches, so the patch applies there cleanly.
The `8.19` branch predates\n`announceOnMount` (no duplicate copy, no
flake), so it is excluded.\n\n</details>\n\n> [!NOTE]\n> Share feedback
in #kibana-qa. Mention `@copilot` to make quick\nchanges.\n\n\n\n\n>
Generated by [Flaky
Test\nFixer](https://github.com/elastic/kibana/actions/runs/30081512525)
for\n#280686 · 229.9 AIC · ⌖ 11.5 AIC · ⊞ 672
·\n[◷](https://github.com/search?q=repo%3Aelastic%2Fkibana+%22gh-aw-workflow-id%3A+flaky-test-fixer%22&type=pullrequests)\n\n\n\n\n\n\nCo-authored-by:
Claude Opus 4.8 (1M context)
<noreply@anthropic.com>","sha":"d4e18e0234335731ba442786ac02c05f0bc84480"}},{"branch":"9.4","label":"v9.4.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.3","label":"v9.3.9","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels flaky-fix-check:skipped Flaky fix verifier: runner can't verify this fix (e.g. no Jest support) flaky-test-fixer Automated PR created by the flaky test fixer workflow release_note:skip Skip the PR/issue when compiling release notes v9.3.9 v9.4.5 v9.5.0 v9.6.0

Projects

None yet

2 participants