Skip to content

Commit 2eae4d2

Browse files
kibanamachineMadameSheemacursoragent
authored
[9.4] [EA] Fix flaky entities_table_grouping: extend @entityStoreSearch timeout (#268217) (#268309)
# Backport This will backport the following commits from `main` to `9.4`: - [[EA] Fix flaky entities_table_grouping: extend @entityStoreSearch timeout (#268217)](#268217) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Gloria Hornero","email":"gloria.hornero@elastic.co"},"sourceCommit":{"committedDate":"2026-05-07T21:03:08Z","message":"[EA] Fix flaky entities_table_grouping: extend @entityStoreSearch timeout (#268217)\n\n## Summary\n\nFixes intermittent failures in `entities_table_grouping.cy.ts` reported\nin:\n- #267794\n- #267795\n- #267828\n- #267965\n\n### Root Cause\n\nPR #265125 added `interceptEntityStoreStatus('running')` +\n`cy.wait('@entityStoreStatus', { timeout: 20000 })` to every\n`beforeEach` to prevent the page from showing\n`EntityStoreDisabledEmptyPrompt`. The intent was correct, but after\n`@entityStoreStatus` resolves, the page still needs to:\n\n1. React re-render with the new status data\n2. Wait for `isSourcererLoading = false` (the sourcerer / data-view\ninitialization)\n3. Mount `EntitiesTableSection`\n4. Fire the POST to `/internal/search/ese`\n\nThis cascade can easily take **> 5 s** in slow CI environments, while\n`cy.wait('@entityStoreSearch')` was left with the default **5 s\ntimeout** — causing \"No request ever occurred\" failures.\n\n### Changes\n\n**Option A** — raise the `@entityStoreSearch` timeout to 20 s, matching\n`@entityStoreStatus`.\n\n**Option B** — consolidate `cy.wait('@entityStoreStatus')` +\n`cy.wait('@entityStoreSearch')` + `waitForGroupingTable()` into a single\n`waitForEntityAnalyticsPageReady()` task helper, so the three\n`beforeEach` blocks stay DRY and the timeout logic lives in one place.\n\nBoth options are implemented together: the helper encapsulates the\ncorrect timeouts and every `beforeEach` now calls\n`waitForEntityAnalyticsPageReady()`.\n\n## Test plan\n\n- [ ] Verify `entities_table_grouping.cy.ts` passes locally\n- [ ] Check CI on this PR for the three previously-failing suites (Group\nby Resolution, Switching grouping)\n\n## Checklist\n\n- [x] No hardcoded waits (`cy.wait(ms)`) introduced\n- [x] No `eslint-disable` introduced\n- [x] Existing tests unchanged — only `beforeEach` wiring consolidated\n\nMade with [Cursor](https://cursor.com)\n\n---------\n\nCo-authored-by: Cursor <cursoragent@cursor.com>","sha":"fd88e7fead56d2c4d274ea588c8449fbc4218534","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","Team:Entity Analytics","v9.5.0","v9.4.1"],"title":"[EA] Fix flaky entities_table_grouping: extend @entityStoreSearch timeout","number":268217,"url":"https://github.com/elastic/kibana/pull/268217","mergeCommit":{"message":"[EA] Fix flaky entities_table_grouping: extend @entityStoreSearch timeout (#268217)\n\n## Summary\n\nFixes intermittent failures in `entities_table_grouping.cy.ts` reported\nin:\n- #267794\n- #267795\n- #267828\n- #267965\n\n### Root Cause\n\nPR #265125 added `interceptEntityStoreStatus('running')` +\n`cy.wait('@entityStoreStatus', { timeout: 20000 })` to every\n`beforeEach` to prevent the page from showing\n`EntityStoreDisabledEmptyPrompt`. The intent was correct, but after\n`@entityStoreStatus` resolves, the page still needs to:\n\n1. React re-render with the new status data\n2. Wait for `isSourcererLoading = false` (the sourcerer / data-view\ninitialization)\n3. Mount `EntitiesTableSection`\n4. Fire the POST to `/internal/search/ese`\n\nThis cascade can easily take **> 5 s** in slow CI environments, while\n`cy.wait('@entityStoreSearch')` was left with the default **5 s\ntimeout** — causing \"No request ever occurred\" failures.\n\n### Changes\n\n**Option A** — raise the `@entityStoreSearch` timeout to 20 s, matching\n`@entityStoreStatus`.\n\n**Option B** — consolidate `cy.wait('@entityStoreStatus')` +\n`cy.wait('@entityStoreSearch')` + `waitForGroupingTable()` into a single\n`waitForEntityAnalyticsPageReady()` task helper, so the three\n`beforeEach` blocks stay DRY and the timeout logic lives in one place.\n\nBoth options are implemented together: the helper encapsulates the\ncorrect timeouts and every `beforeEach` now calls\n`waitForEntityAnalyticsPageReady()`.\n\n## Test plan\n\n- [ ] Verify `entities_table_grouping.cy.ts` passes locally\n- [ ] Check CI on this PR for the three previously-failing suites (Group\nby Resolution, Switching grouping)\n\n## Checklist\n\n- [x] No hardcoded waits (`cy.wait(ms)`) introduced\n- [x] No `eslint-disable` introduced\n- [x] Existing tests unchanged — only `beforeEach` wiring consolidated\n\nMade with [Cursor](https://cursor.com)\n\n---------\n\nCo-authored-by: Cursor <cursoragent@cursor.com>","sha":"fd88e7fead56d2c4d274ea588c8449fbc4218534"}},"sourceBranch":"main","suggestedTargetBranches":["9.4"],"targetPullRequestStates":[{"branch":"main","label":"v9.5.0","branchLabelMappingKey":"^v9.5.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/268217","number":268217,"mergeCommit":{"message":"[EA] Fix flaky entities_table_grouping: extend @entityStoreSearch timeout (#268217)\n\n## Summary\n\nFixes intermittent failures in `entities_table_grouping.cy.ts` reported\nin:\n- #267794\n- #267795\n- #267828\n- #267965\n\n### Root Cause\n\nPR #265125 added `interceptEntityStoreStatus('running')` +\n`cy.wait('@entityStoreStatus', { timeout: 20000 })` to every\n`beforeEach` to prevent the page from showing\n`EntityStoreDisabledEmptyPrompt`. The intent was correct, but after\n`@entityStoreStatus` resolves, the page still needs to:\n\n1. React re-render with the new status data\n2. Wait for `isSourcererLoading = false` (the sourcerer / data-view\ninitialization)\n3. Mount `EntitiesTableSection`\n4. Fire the POST to `/internal/search/ese`\n\nThis cascade can easily take **> 5 s** in slow CI environments, while\n`cy.wait('@entityStoreSearch')` was left with the default **5 s\ntimeout** — causing \"No request ever occurred\" failures.\n\n### Changes\n\n**Option A** — raise the `@entityStoreSearch` timeout to 20 s, matching\n`@entityStoreStatus`.\n\n**Option B** — consolidate `cy.wait('@entityStoreStatus')` +\n`cy.wait('@entityStoreSearch')` + `waitForGroupingTable()` into a single\n`waitForEntityAnalyticsPageReady()` task helper, so the three\n`beforeEach` blocks stay DRY and the timeout logic lives in one place.\n\nBoth options are implemented together: the helper encapsulates the\ncorrect timeouts and every `beforeEach` now calls\n`waitForEntityAnalyticsPageReady()`.\n\n## Test plan\n\n- [ ] Verify `entities_table_grouping.cy.ts` passes locally\n- [ ] Check CI on this PR for the three previously-failing suites (Group\nby Resolution, Switching grouping)\n\n## Checklist\n\n- [x] No hardcoded waits (`cy.wait(ms)`) introduced\n- [x] No `eslint-disable` introduced\n- [x] Existing tests unchanged — only `beforeEach` wiring consolidated\n\nMade with [Cursor](https://cursor.com)\n\n---------\n\nCo-authored-by: Cursor <cursoragent@cursor.com>","sha":"fd88e7fead56d2c4d274ea588c8449fbc4218534"}},{"branch":"9.4","label":"v9.4.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Gloria Hornero <gloria.hornero@elastic.co> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 32b305b commit 2eae4d2

2 files changed

Lines changed: 21 additions & 9 deletions

File tree

x-pack/solutions/security/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_analytics_home/entities_table_grouping.cy.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { visit } from '../../../tasks/navigation';
1010
import {
1111
setGrouping,
1212
waitForGroupingTable,
13+
waitForEntityAnalyticsPageReady,
1314
interceptEntityStoreSearch,
1415
selectGroupingOption,
1516
interceptEntityStoreStatus,
@@ -63,9 +64,7 @@ describe(
6364
visit(ENTITY_ANALYTICS_HOME_PAGE_URL);
6465
cy.get(PAGE_TITLE).should('exist');
6566
// Resolution is the default grouping
66-
cy.wait('@entityStoreStatus', { timeout: 20000 });
67-
cy.wait('@entityStoreSearch');
68-
waitForGroupingTable();
67+
waitForEntityAnalyticsPageReady();
6968
});
7069

7170
it('displays resolution groups', () => {
@@ -116,9 +115,7 @@ describe(
116115
interceptEntityStoreSearch();
117116
visit(ENTITY_ANALYTICS_HOME_PAGE_URL);
118117
cy.get(PAGE_TITLE).should('exist');
119-
cy.wait('@entityStoreStatus', { timeout: 20000 });
120-
cy.wait('@entityStoreSearch');
121-
waitForGroupingTable();
118+
waitForEntityAnalyticsPageReady();
122119
});
123120

124121
it('shows group selector with Entity type selected', () => {
@@ -152,9 +149,7 @@ describe(
152149
interceptEntityStoreSearch();
153150
visit(ENTITY_ANALYTICS_HOME_PAGE_URL);
154151
cy.get(PAGE_TITLE).should('exist');
155-
cy.wait('@entityStoreStatus', { timeout: 20000 });
156-
cy.wait('@entityStoreSearch');
157-
waitForGroupingTable();
152+
waitForEntityAnalyticsPageReady();
158153
});
159154

160155
it('selecting "None" shows flat data table', () => {

x-pack/solutions/security/test/security_solution_cypress/cypress/tasks/entity_analytics/entity_analytics_home.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,23 @@ export const waitForGroupingTable = () => {
5959
cy.get(GROUPING_LEVEL_0).should('exist');
6060
};
6161

62+
/**
63+
* Waits for the entity store status intercept and the initial entity store
64+
* search to both resolve, then confirms the grouping table is ready.
65+
*
66+
* Must be called after `interceptEntityStoreStatus` and
67+
* `interceptEntityStoreSearch` are registered and after `cy.visit`.
68+
*
69+
* The search fires only once the sourcerer / data-view has finished loading,
70+
* which can take well over 5 s in CI — both timeouts are set to 20 s to
71+
* match the patience already applied to `@entityStoreStatus`.
72+
*/
73+
export const waitForEntityAnalyticsPageReady = () => {
74+
cy.wait('@entityStoreStatus', { timeout: 20000 });
75+
cy.wait('@entityStoreSearch', { timeout: 20000 });
76+
waitForGroupingTable();
77+
};
78+
6279
/**
6380
* Intercepts the entity store search API and registers an alias.
6481
* Call this before navigation so Cypress captures the request.

0 commit comments

Comments
 (0)