Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Secuirty Solution] Fixes alerts flaky test #78424

Merged
merged 2 commits into from
Sep 24, 2020

Conversation

MadameSheema
Copy link
Member

@MadameSheema MadameSheema commented Sep 24, 2020

Summary

The alerts spec started to be flaky and was skipped: #77957

In this PR we are fixing the flakiness modifying some of the code :)

@MadameSheema
Copy link
Member Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky


Test Failures

"after each" hook for "inspects the Hosts Stat".Inspect Hosts stats and tables "after each" hook for "inspects the Hosts Stat"

Link to Jenkins

Stack Trace

Failed Tests Reporter:
  - Test has not failed recently on tracked branches

CypressError: Timed out retrying: `cy.click()` failed because this element is detached from the DOM.

`<button class="euiButton euiButton--primary euiButton--fill" type="button" data-test-subj="modal-inspect-close">...</button>`

Cypress requires elements be attached in the DOM to interact with them.

The previous command that ran was:

  > `cy.get()`

This DOM element likely became detached somewhere between the previous and current command.

Common situations why this happens:
  - Your JS framework re-rendered asynchronously
  - Your app code reacted to an event firing and removed the element

You typically need to re-query for the element or add 'guards' which delay Cypress from running new commands.

https://on.cypress.io/element-has-detached-from-dom

Because this error occurred during a `after each` hook we are skipping the remaining tests in the current suite: `Hosts stats and tables`
    at $Cy.ensureAttached (http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:160835:24)
    at runAllChecks (http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:149825:12)
    at retryActionability (http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:149884:16)
    at tryCatcher (http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:9852:23)
    at Function.Promise.attempt.Promise.try (http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:7126:29)
    at tryFn (http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:164075:24)
    at whenStable (http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:164116:12)
    at http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:163634:16
    at tryCatcher (http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:9852:23)
    at Promise._settlePromiseFromHandler (http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:7787:31)
    at Promise._settlePromise (http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:7844:18)
    at Promise._settlePromise0 (http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:7889:10)
    at Promise._settlePromises (http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:7969:18)
    at Promise._fulfill (http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:7913:18)
    at http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:9527:46
From Your Spec Code:
    at Object.exports.closesModal (http://localhost:6111/__cypress/tests?p=cypress/integration/inspect.spec.ts:771:54)
    at Context.eval (http://localhost:6111/__cypress/tests?p=cypress/integration/inspect.spec.ts:723:23)

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@MadameSheema MadameSheema self-assigned this Sep 24, 2020
@MadameSheema MadameSheema added Feature:Detection Rules Security Solution rules and Detection Engine release_note:skip Skip the PR/issue when compiling release notes v7.10.0 v8.0.0 labels Sep 24, 2020
@MadameSheema MadameSheema marked this pull request as ready for review September 24, 2020 17:10
@MadameSheema MadameSheema requested review from a team as code owners September 24, 2020 17:10
Copy link
Contributor

@rylnd rylnd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For posterity: the behavior of should is to retry until successful. .invoke('text').should('eq', expectedText) has nothing to retry since it's a simple comparison with a static value, but .should('have.text', expectedText) and .should(retryableCallback)` will perform retries.

@MadameSheema
Copy link
Member Author

Yes @rylnd you are completely right, this is why we are moving everything to that clause in refactors :)

@MadameSheema MadameSheema merged commit 276dab4 into elastic:master Sep 24, 2020
@MadameSheema MadameSheema deleted the fixes-alert-flaky-test branch September 24, 2020 17:58
MadameSheema added a commit to MadameSheema/kibana that referenced this pull request Sep 24, 2020
MadameSheema added a commit that referenced this pull request Sep 24, 2020
Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Detection Rules Security Solution rules and Detection Engine release_note:skip Skip the PR/issue when compiling release notes v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants