Skip to content

Commit

Permalink
Fixed entity analytics dashboard filtering flaky tests (#173970)
Browse files Browse the repository at this point in the history
## Summary

This PR fixes two flaky tests within the Entity Analytics dashboard
pages.

Resolves #173871 
Resolves #173846.

I was able to reproduce this issue locally by running the tests 10 times
in succession, and found that they fail even locally ~10% of the time.
After implementing this fix, I have been unable to reproduce the issue
locally again.

**Flaky test runner, with x200 iterations, all passing:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4676#_**

## The Fix

Previously, the dashboard tests in question would attempt to click the
"User/Host Risk Level" filter button immediately upon opening the page.
In some circumstances, that click would fire before that respective
user/host panel was fully loaded, even though the component was
available. This would prevent the popover from showing up (see
screenshot below for what the popover is **supposed** to look like).

Therefore, the fix was to simply ensure that the user/host panel has
been fully loaded beforehand. We already do this in other tests by
checking if the inner table has been loaded, and I followed suit in this
case as well. This is also a very appropriate prerequisite for these
tests, because the purpose of the test is to check whether we can filter
data in that table.

<img width="891" alt="Screenshot 2023-12-26 at 4 05 53 PM"
src="https://github.com/elastic/kibana/assets/147995946/e776dc76-22be-443d-8a4e-41740ea6e7c6">


### Checklist

- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
jaredburgettelastic and kibanamachine authored Dec 27, 2023
1 parent 460ef86 commit 66777f1
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,10 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@serverless'] }, () =>
it('renders alerts column', () => {
cy.get(HOSTS_TABLE_ALERT_CELL).should('have.length', 5);
});

it('filters by risk level', () => {
cy.get(HOSTS_TABLE).should('be.visible');
cy.get(HOSTS_TABLE_ROWS).should('have.length', 5);

openRiskTableFilterAndSelectTheLowOption();

cy.get(HOSTS_DONUT_CHART).should('include.text', '1Total');
Expand Down Expand Up @@ -225,8 +227,7 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@serverless'] }, () =>
});
});

// FLAKY: https://github.com/elastic/kibana/issues/173846
describe.skip('With user risk data', () => {
describe('With user risk data', () => {
before(() => {
cy.task('esArchiverLoad', { archiveName: 'risk_users' });
});
Expand Down Expand Up @@ -254,6 +255,9 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@serverless'] }, () =>
});

it('filters by risk level', () => {
cy.get(USERS_TABLE).should('be.visible');
cy.get(USERS_TABLE_ROWS).should('have.length', 5);

openRiskTableFilterAndSelectTheLowOption();

cy.get(USERS_DONUT_CHART).should('include.text', '2Total');
Expand Down

0 comments on commit 66777f1

Please sign in to comment.