Skip to content

Commit

Permalink
[Security Solution] Attempt to fix flaky anomalies test on entity ana…
Browse files Browse the repository at this point in the history
…lytics page (#161453)

## Summary

 Attempt to fix flaky anomalies test on entity analytics page.
Test:
`x-pack/plugins/security_solution/cypress/e2e/explore/dashboards/entity_analytics.cy.ts:324`

The test was flaky because it took too long to load the table content. I
added some extra waiting points so that the rest of the application has
already loaded when the table loading starts. It reduced the flakiness,
but to prevent it from happening at all I also increase the default
timeout to 15sec.

Tested it 100 times on CI:

https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2579#_
<img width="786" alt="Screenshot 2023-07-07 at 16 01 35"
src="https://github.com/elastic/kibana/assets/1490444/370b1df8-f6b6-4d27-a509-b149a831a4f7">
  • Loading branch information
machadoum authored Jul 18, 2023
1 parent c6deb25 commit c5763bf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import { login, visit } from '../../../tasks/login';
import { ALERTS_URL, ENTITY_ANALYTICS_URL } from '../../../urls/navigation';

import { esArchiverLoad, esArchiverUnload } from '../../../tasks/es_archiver';
import { cleanKibana, deleteAlertsAndRules } from '../../../tasks/common';
import {
cleanKibana,
deleteAlertsAndRules,
waitForPageToBeLoaded,
waitForTableToLoad,
} from '../../../tasks/common';
import {
ANOMALIES_TABLE,
ANOMALIES_TABLE_ROWS,
Expand Down Expand Up @@ -313,11 +318,15 @@ describe('Entity Analytics Dashboard', () => {
beforeEach(() => {
login();
visit(ENTITY_ANALYTICS_URL);
waitForPageToBeLoaded();
});

it('renders table with pagination', () => {
cy.get(ANOMALIES_TABLE).should('be.visible');
cy.get(ANOMALIES_TABLE_ROWS).should('have.length', 10);
waitForTableToLoad();

// Increase default timeout because anomalies table takes a while to load
cy.get(ANOMALIES_TABLE_ROWS, { timeout: 20000 }).should('have.length', 10);

// navigates to next page
cy.get(ANOMALIES_TABLE_NEXT_PAGE_BUTTON).click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { login, visitHostDetailsPage } from '../../../tasks/login';

import { cleanKibana } from '../../../tasks/common';
import { cleanKibana, waitForTableToLoad } from '../../../tasks/common';
import { esArchiverLoad, esArchiverUnload } from '../../../tasks/es_archiver';
import { TABLE_CELL, TABLE_ROWS } from '../../../screens/alerts_details';

Expand Down Expand Up @@ -49,8 +49,3 @@ describe('risk tab', () => {
);
});
});

export const waitForTableToLoad = () => {
cy.get('.euiBasicTable-loading').should('exist');
cy.get('.euiBasicTable-loading').should('not.exist');
};
6 changes: 6 additions & 0 deletions x-pack/plugins/security_solution/cypress/tasks/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
LOADING_INDICATOR,
LOADING_INDICATOR_HIDDEN,
} from '../screens/security_header';
import { EUI_BASIC_TABLE_LOADING } from '../screens/common/controls';

const primaryButton = 0;

Expand Down Expand Up @@ -280,3 +281,8 @@ export const waitForWelcomePanelToBeLoaded = () => {
cy.get(KIBANA_LOADING_ICON).should('exist');
cy.get(KIBANA_LOADING_ICON).should('not.exist');
};

export const waitForTableToLoad = () => {
cy.get(EUI_BASIC_TABLE_LOADING).should('exist');
cy.get(EUI_BASIC_TABLE_LOADING).should('not.exist');
};

0 comments on commit c5763bf

Please sign in to comment.