Skip to content

Commit 970bd9f

Browse files
[Security Solution] fix data provider cypress test (#93465) (#93539)
## Summary This PR is to fix data_provider's cypress test: displays the data provider action menu when Enter is pressed. When I ran it locally, I couldn’t reproduce it every time. There’s a chance that the timeline was opened but the filter we put wasn’t there, this happen when I simulate slow 3G with Chrome or once out of my 10-time-trial with `loop_cypress_tests.js` [failure 1](https://kibana-ci.elastic.co/job/elastic+kibana+security-cypress/4313/testReport/junit/(root)/displays%20the%20data%20provider%20action%20menu%20when%20Enter%20is%20pressed/timeline_data_providers_displays_the_data_provider_action_menu_when_Enter_is_pressed/) [failure 2](https://kibana-ci.elastic.co/job/elastic+kibana+security-cypress/4313/testReport/junit/(root)/displays%20the%20data%20provider%20action%20menu%20when%20Enter%20is%20pressed/timeline_data_providers_displays_the_data_provider_action_menu_when_Enter_is_pressed_2/) How to run this test several times automatically: 1. Go to the file and mark your case with .only 2. Copy the relative path of the file 3. Go to x-pack/plugins/security_solution/package.json Line 13, change —spec to the path you just copied (e.g: ./cypress/integration/timelines/data_providers.spec.ts) 4. Go to Kibana/ and run node x-pack/plugins/security_solution/scripts/loop_cypress_tests.js 1 (1 means run it once, you can put more to check flakiness) 5. After it finishes, it generates you a report under: kibana/target/loop-cypress-tests.txt 6. Search for `displays the data provider action menu when Enter is pressed.` and see if all passes. Co-authored-by: Angela Chuang <6295984+angorayc@users.noreply.github.com>
1 parent 7b02635 commit 970bd9f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

x-pack/plugins/security_solution/cypress/integration/timelines/data_providers.spec.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
TIMELINE_DATA_PROVIDERS_EMPTY,
1111
TIMELINE_DROPPED_DATA_PROVIDERS,
1212
TIMELINE_DATA_PROVIDERS_ACTION_MENU,
13+
TIMELINE_FLYOUT_HEADER,
1314
} from '../../screens/timeline';
1415
import { HOSTS_NAMES_DRAGGABLE } from '../../screens/hosts/all_hosts';
1516

@@ -60,8 +61,13 @@ describe('timeline data providers', () => {
6061
openTimelineUsingToggle();
6162
cy.get(TIMELINE_DATA_PROVIDERS_ACTION_MENU).should('not.exist');
6263

63-
cy.get(TIMELINE_DROPPED_DATA_PROVIDERS).first().focus();
64-
cy.get(TIMELINE_DROPPED_DATA_PROVIDERS).first().parent().type('{enter}');
64+
cy.get(`${TIMELINE_FLYOUT_HEADER} ${TIMELINE_DROPPED_DATA_PROVIDERS}`)
65+
.pipe(($el) => $el.trigger('focus'))
66+
.should('exist');
67+
cy.get(`${TIMELINE_FLYOUT_HEADER} ${TIMELINE_DROPPED_DATA_PROVIDERS}`)
68+
.first()
69+
.parent()
70+
.type('{enter}');
6571

6672
cy.get(TIMELINE_DATA_PROVIDERS_ACTION_MENU).should('exist');
6773
});

0 commit comments

Comments
 (0)