-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution][Detections] Fix EQL cypress tests (#80440)
* Unskip EQL tests These _should_ be fixed with the latest ES on master, but let's see if CI disagrees. * Wait until alerts have populated on Rule Details Occasionally our tests hit a scenario where the rule has executed (its status is "succeeded"), but the generated alerts have not populated in the same time frame. In this case the test fails oddly, saying that the "alert count" element is not there when it is. I attempted to improve the error message by using a .should() with a callback, but that lead to even stranger behavior as the .should() would fail once (expected), and then not be able to find the element a second time. :( So we instead focus on fixing the real problem, here: wait until alerts populate (have a non-zero count) before performing the assertion. Because the page will not update automatically, we can't rely on cypress' retryability and must instead assert, click Refresh, and assert again, much like we're doing while waiting for the rule to execute. And like `waitForTheRuleToBeExecuted`, we're using a while loop that has no guarantee of ever exiting :( * More robust cypress assertions * Uses should with a text matcher instead of using invoke('text') * Use of not.equal between a string and an element may have been a false positive * Perform cypress loops in a manner guaranteed to exit We have a few tasks that require polling for some background work to be completed. The basic form is: assert the byproduct, or refresh the page and try again. We were previously doing this with a while loop, which was not guaranteed to ever complete, leading to cryptic failures if the process ever hung. Instead, this implements a safer polling mechanism with a definite termination similar to the cypress-wait-until plugin. * Update other specs that are asserting on alerts * Do not automatically refresh the page * This is only necessary if we're not in the state we need. The `waitFor` helper functions automatically reload whatever needs to be reloaded, so we're delegating this task to them. * Ensure we wait for alerts to be nonzero before our assertion * Otherwise we get some strange behavior around this field's availability; see previous commits * Remove unused import * Fix false positive in Rule Creation specs Threat Match Rules introduced an additional query input, causing our CUSTOM_QUERY_INPUT to be ambiguous. However, instead of failing due to the ambiguity, the behavior of cypress seems to be to pass! While I haven't yet tracked down the cause of these false positives, disambiguating these selectors is the immediate fix. Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
f6d41f4
commit b7ffefb
Showing
9 changed files
with
84 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters