Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.9] [Security Solution] Unskip rules table auto-refresh Cypress tes…
…ts (#163451) (#164062) # Backport This will backport the following commits from `main` to `8.9`: - [[Security Solution] Unskip rules table auto-refresh Cypress tests (#163451)](#163451) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Maxim Palenov","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-08-11T12:07:35Z","message":"[Security Solution] Unskip rules table auto-refresh Cypress tests (#163451)\n\n**Addresses:** https://github.com/elastic/kibana/issues/154694\r\n\r\n## Summary\r\n\r\nThis PR unskips rules table auto-refresh tests.\r\n\r\n## Details\r\n\r\nRules table auto-refresh Cypress tests were outdated so it was hard to determine the original flakiness reason. To make it working the following has been done\r\n\r\n- `mockGlobalClock()` moved above `visit()` to mock the time before visiting the page. It didn't look like working so the test had to wait for 60 seconds (our refresh interval)\r\n- removed unnecessary waiting `waitForRulesTableToBeLoaded()` as the test should work without it\r\n- removed `setRowsPerPageTo(5)` as the test doesn't look related to the page size\r\n- `AutoRefreshButtonComponent ` was refactored in attempt to fix popover closing related flakiness but it doesn't seem to help but the refactoring looks improving readability so leaving as a part of this PR\r\n- auto-refresh popover's behavior has been changed. The trigger button gets disabled if there is a rule selected. Clicking the disabled button won't make the auto-refresh popover to appear so this part was changed.\r\n\r\n### Encountered issues\r\n\r\n- `EuiPopover` should close by clicking the trigger button, clicking outside or pressing `Esc` button. The latter two cause flakiness for some reason. I spent quite some time to investigate the reason but without success. It looks like there is a race condition related to [EuiFocusTrap](https://github.com/elastic/eui/blob/main/src/components/focus_trap/focus_trap.tsx) but it doesn't look to be an issue outside Cypress.\r\n- `waitForRulesTableToBeLoaded()` basically does nothing after changes in the rules table. Looking at tis contents\r\n\r\n```ts\r\nexport const waitForRulesTableToBeLoaded = () => {\r\n // Wait up to 5 minutes for the rules to load as in CI containers this can be very slow\r\n cy.get(RULES_TABLE_INITIAL_LOADING_INDICATOR, { timeout: 300000 }).should('not.exist');\r\n};\r\n```\r\n\r\nreveals that `RULES_TABLE_INITIAL_LOADING_INDICATOR` defined as `[data-test-subj=\"initialLoadingPanelAllRulesTable\"]` doesn't exist anymore in our codebase so this function instantly returns. The selector will be fixed in a separate PR.\r\n\r\n- invoking `mockGlobalClock()` during the test leads to appearing a lot of `Executing a cancelled action` error messages.\r\n\r\n\r\n### Flaky test runner\r\n\r\n[50 runs succeeded](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2842)","sha":"589ef228fb9c2525a49d6abc5db64eb98b2c381e","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","skipped-test","release_note:skip","impact:high","Team:Detections and Resp","Team: SecuritySolution","Feature:Rule Management","Team:Detection Rule Management","backport:prev-minor","v8.10.0"],"number":163451,"url":"https://github.com/elastic/kibana/pull/163451","mergeCommit":{"message":"[Security Solution] Unskip rules table auto-refresh Cypress tests (#163451)\n\n**Addresses:** https://github.com/elastic/kibana/issues/154694\r\n\r\n## Summary\r\n\r\nThis PR unskips rules table auto-refresh tests.\r\n\r\n## Details\r\n\r\nRules table auto-refresh Cypress tests were outdated so it was hard to determine the original flakiness reason. To make it working the following has been done\r\n\r\n- `mockGlobalClock()` moved above `visit()` to mock the time before visiting the page. It didn't look like working so the test had to wait for 60 seconds (our refresh interval)\r\n- removed unnecessary waiting `waitForRulesTableToBeLoaded()` as the test should work without it\r\n- removed `setRowsPerPageTo(5)` as the test doesn't look related to the page size\r\n- `AutoRefreshButtonComponent ` was refactored in attempt to fix popover closing related flakiness but it doesn't seem to help but the refactoring looks improving readability so leaving as a part of this PR\r\n- auto-refresh popover's behavior has been changed. The trigger button gets disabled if there is a rule selected. Clicking the disabled button won't make the auto-refresh popover to appear so this part was changed.\r\n\r\n### Encountered issues\r\n\r\n- `EuiPopover` should close by clicking the trigger button, clicking outside or pressing `Esc` button. The latter two cause flakiness for some reason. I spent quite some time to investigate the reason but without success. It looks like there is a race condition related to [EuiFocusTrap](https://github.com/elastic/eui/blob/main/src/components/focus_trap/focus_trap.tsx) but it doesn't look to be an issue outside Cypress.\r\n- `waitForRulesTableToBeLoaded()` basically does nothing after changes in the rules table. Looking at tis contents\r\n\r\n```ts\r\nexport const waitForRulesTableToBeLoaded = () => {\r\n // Wait up to 5 minutes for the rules to load as in CI containers this can be very slow\r\n cy.get(RULES_TABLE_INITIAL_LOADING_INDICATOR, { timeout: 300000 }).should('not.exist');\r\n};\r\n```\r\n\r\nreveals that `RULES_TABLE_INITIAL_LOADING_INDICATOR` defined as `[data-test-subj=\"initialLoadingPanelAllRulesTable\"]` doesn't exist anymore in our codebase so this function instantly returns. The selector will be fixed in a separate PR.\r\n\r\n- invoking `mockGlobalClock()` during the test leads to appearing a lot of `Executing a cancelled action` error messages.\r\n\r\n\r\n### Flaky test runner\r\n\r\n[50 runs succeeded](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2842)","sha":"589ef228fb9c2525a49d6abc5db64eb98b2c381e"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/163451","number":163451,"mergeCommit":{"message":"[Security Solution] Unskip rules table auto-refresh Cypress tests (#163451)\n\n**Addresses:** https://github.com/elastic/kibana/issues/154694\r\n\r\n## Summary\r\n\r\nThis PR unskips rules table auto-refresh tests.\r\n\r\n## Details\r\n\r\nRules table auto-refresh Cypress tests were outdated so it was hard to determine the original flakiness reason. To make it working the following has been done\r\n\r\n- `mockGlobalClock()` moved above `visit()` to mock the time before visiting the page. It didn't look like working so the test had to wait for 60 seconds (our refresh interval)\r\n- removed unnecessary waiting `waitForRulesTableToBeLoaded()` as the test should work without it\r\n- removed `setRowsPerPageTo(5)` as the test doesn't look related to the page size\r\n- `AutoRefreshButtonComponent ` was refactored in attempt to fix popover closing related flakiness but it doesn't seem to help but the refactoring looks improving readability so leaving as a part of this PR\r\n- auto-refresh popover's behavior has been changed. The trigger button gets disabled if there is a rule selected. Clicking the disabled button won't make the auto-refresh popover to appear so this part was changed.\r\n\r\n### Encountered issues\r\n\r\n- `EuiPopover` should close by clicking the trigger button, clicking outside or pressing `Esc` button. The latter two cause flakiness for some reason. I spent quite some time to investigate the reason but without success. It looks like there is a race condition related to [EuiFocusTrap](https://github.com/elastic/eui/blob/main/src/components/focus_trap/focus_trap.tsx) but it doesn't look to be an issue outside Cypress.\r\n- `waitForRulesTableToBeLoaded()` basically does nothing after changes in the rules table. Looking at tis contents\r\n\r\n```ts\r\nexport const waitForRulesTableToBeLoaded = () => {\r\n // Wait up to 5 minutes for the rules to load as in CI containers this can be very slow\r\n cy.get(RULES_TABLE_INITIAL_LOADING_INDICATOR, { timeout: 300000 }).should('not.exist');\r\n};\r\n```\r\n\r\nreveals that `RULES_TABLE_INITIAL_LOADING_INDICATOR` defined as `[data-test-subj=\"initialLoadingPanelAllRulesTable\"]` doesn't exist anymore in our codebase so this function instantly returns. The selector will be fixed in a separate PR.\r\n\r\n- invoking `mockGlobalClock()` during the test leads to appearing a lot of `Executing a cancelled action` error messages.\r\n\r\n\r\n### Flaky test runner\r\n\r\n[50 runs succeeded](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2842)","sha":"589ef228fb9c2525a49d6abc5db64eb98b2c381e"}}]}] BACKPORT--> Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information