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

Failing test: X-Pack Endpoint Functional Tests.x-pack/test/security_solution_endpoint/apps/endpoint/responder·ts - endpoint Response Actions Responder from timeline should show Responder from alert in a timeline #139260

Closed
kibanamachine opened this issue Aug 23, 2022 · 45 comments · Fixed by #158295 or #165466
Assignees
Labels
failed-test A test failure on a tracked branch, potentially flaky-test OLM Sprint Team:Defend Workflows “EDR Workflows” sub-team of Security Solution Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc.

Comments

@kibanamachine
Copy link
Contributor

kibanamachine commented Aug 23, 2022

A test failed on a tracked branch

StaleElementReferenceError: stale element reference: element is not attached to the page document
  (Session info: headless chrome=102.0.5005.115)
    at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:522:15)
    at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:589:13)
    at Executor.execute (node_modules/selenium-webdriver/lib/http.js:514:28)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Task.exec (test/functional/services/remote/prevent_parallel_calls.ts:28:20) {
  remoteStacktrace: '#0 0x556988442f33 <unknown>\n' +
    '#1 0x55698818d118 <unknown>\n' +
    '#2 0x55698818ff97 <unknown>\n' +
    '#3 0x55698818fe3b <unknown>\n' +
    '#4 0x5569881900fc <unknown>\n' +
    '#5 0x5569881be65e <unknown>\n' +
    '#6 0x5569881e0f72 <unknown>\n' +
    '#7 0x5569881b7e73 <unknown>\n' +
    '#8 0x5569881e107e <unknown>\n' +
    '#9 0x5569881f42e4 <unknown>\n' +
    '#10 0x5569881e0e63 <unknown>\n' +
    '#11 0x5569881b682a <unknown>\n' +
    '#12 0x5569881b7985 <unknown>\n' +
    '#13 0x5569884874cd <unknown>\n' +
    '#14 0x55698848b5ec <unknown>\n' +
    '#15 0x55698847171e <unknown>\n' +
    '#16 0x55698848c238 <unknown>\n' +
    '#17 0x556988466870 <unknown>\n' +
    '#18 0x5569884a8608 <unknown>\n' +
    '#19 0x5569884a8788 <unknown>\n' +
    '#20 0x5569884c2f1d <unknown>\n' +
    '#21 0x7f1a6fe41609 <unknown>\n'
}

First failure: CI Build - main

@kibanamachine kibanamachine added the failed-test A test failure on a tracked branch, potentially flaky-test label Aug 23, 2022
@botelastic botelastic bot added the needs-team Issues missing a team label label Aug 23, 2022
@kibanamachine kibanamachine added the Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. label Aug 23, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@botelastic botelastic bot removed the needs-team Issues missing a team label label Aug 23, 2022
@kevinlog
Copy link
Contributor

@paul-tavares can you take a look?

@paul-tavares
Copy link
Contributor

paul-tavares commented Aug 25, 2022

Hey @spalger ,

Wondering if you might have some insight here. The failure seems to be happening in a Global beforeEach() that points back to this file test/functional/services/remote/prevent_parallel_calls.ts. Any idea what might have caused this one?

This same error also just got reported today on a different test - here (build failure here).

I checked out code for these tests and we don't have global beforeEach hooks defined - all of ours are scoped to describe() blocks.

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

@spalger
Copy link
Contributor

spalger commented Aug 30, 2022

The output is a bit verbose, but the failure line lists the test which was executing when the error was caught endpoint When on the Endpoint Policy Details Page and the save button is clicked should have updated policy data in overall Agent Policy.

The error message StaleElementReferenceError: stale element reference: element is not attached to the page document is caused when a reference to an element is captured, then used in some way, but between the capturing and the use the element was re-rendered or deleted for some reason. This code can look like this:

const button = await testSubjects.find('someButton')
await button.click();

This does two actions, and if the element with someButton test subject is re-rendered between those two actions then the second action will fail. Instead, you should use:

await testSubjects.click('someButton')

This handle the error by re-fetching the element using the same selection if the click fails.

@paul-tavares
Copy link
Contributor

Ohhh... This is good info. on the differences between those two approached. I know for sure in some cases I am using the approach that you mention might lead to this StaleElementReferrenceError. I will look for ways around it.

Thank you @spalger 🙏

@paul-tavares
Copy link
Contributor

PR merged. Lets see what happens. :)

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

@spalger
Copy link
Contributor

spalger commented Sep 1, 2022

@spalger
Copy link
Contributor

spalger commented Sep 1, 2022

So, I took a look at the testSubjects.clickWhenNotDisabled() method, which is a wrapper around find.clickByCssSelectorWhenNotDisabled(), which explicitly says that it shouldn't protect against stale element execptions... which is a very weird decisions that I don't understand

public async clickByCssSelectorWhenNotDisabled(
selector: string,
{ timeout } = { timeout: this.defaultFindTimeout }
): Promise<void> {
this.log.debug(`Find.clickByCssSelectorWhenNotDisabled('${selector}') with timeout=${timeout}`);
// Don't wrap this code in a retry, or stale element checks may get caught here and the element
// will never be re-grabbed. Let errors bubble, but continue checking for disabled property until
// it's gone.
const element = await this.byCssSelector(selector, timeout);
await element.moveMouseTo();
await this.driver.wait(until.elementIsEnabled(element._webElement), timeout);
await element.click();
}

Unfortunately testSubjects.clickWhenNotDisabled() is used in 90 places across 40 files, which means changing the meaning of that method is pretty risky.

@spalger
Copy link
Contributor

spalger commented Sep 1, 2022

Opened #139964 to fix this

@spalger
Copy link
Contributor

spalger commented Sep 6, 2022

Fixed by #139964

@spalger spalger closed this as completed Sep 6, 2022
@kevinlog
Copy link
Contributor

kevinlog commented Sep 6, 2022

Thank you for looking at this @spalger !

cc @paul-tavares

@paul-tavares
Copy link
Contributor

Thanks @spalger . Appreciate you taking a look.

@kibanamachine kibanamachine reopened this May 11, 2023
@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

mistic added a commit that referenced this issue May 22, 2023
@kibanamachine kibanamachine added blocker skipped-test Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v8.11.0 labels Aug 31, 2023
@kibanamachine
Copy link
Contributor Author

Skipped

main: 404c359

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-defend-workflows (Team:Defend Workflows)

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

ashokaditya added a commit to ashokaditya/kibana that referenced this issue Sep 1, 2023
ashokaditya added a commit that referenced this issue Sep 4, 2023
## Summary

Fixes and un-skips a test. Ensures that the test data doesn't create an
existing index. If it still does, as a temp. measure we're dismissing
the error toast that is blocking the button so the rest of the test can
continue.

closes /issues/139260

**flakey test runner**

https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3036
x 200 ( all green)

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Sep 4, 2023
## Summary

Fixes and un-skips a test. Ensures that the test data doesn't create an
existing index. If it still does, as a temp. measure we're dismissing
the error toast that is blocking the button so the rest of the test can
continue.

closes elastic/issues/139260

**flakey test runner**

https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3036
x 200 ( all green)

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit ada6671)
kibanamachine added a commit that referenced this issue Sep 4, 2023
…) (#165559)

# Backport

This will backport the following commits from `main` to `8.10`:
- [[Security Solution][Endpoint] Fix and unskip flaky test
(#165466)](#165466)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Ash","email":"1849116+ashokaditya@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-09-04T07:43:47Z","message":"[Security
Solution][Endpoint] Fix and unskip flaky test (#165466)\n\n##
Summary\r\n\r\nFixes and un-skips a test. Ensures that the test data
doesn't create an\r\nexisting index. If it still does, as a temp.
measure we're dismissing\r\nthe error toast that is blocking the button
so the rest of the test can\r\ncontinue.\r\n\r\ncloses
/issues/139260\r\n\r\n**flakey test
runner**\r\n\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3036\r\nx
200 ( all green)\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"ada6671165ecfc2c27014fa0aa43c58ed8e965df","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Defend
Workflows","OLM
Sprint","v8.10.0","v8.11.0"],"number":165466,"url":"https://github.com/elastic/kibana/pull/165466","mergeCommit":{"message":"[Security
Solution][Endpoint] Fix and unskip flaky test (#165466)\n\n##
Summary\r\n\r\nFixes and un-skips a test. Ensures that the test data
doesn't create an\r\nexisting index. If it still does, as a temp.
measure we're dismissing\r\nthe error toast that is blocking the button
so the rest of the test can\r\ncontinue.\r\n\r\ncloses
/issues/139260\r\n\r\n**flakey test
runner**\r\n\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3036\r\nx
200 ( all green)\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"ada6671165ecfc2c27014fa0aa43c58ed8e965df"}},"sourceBranch":"main","suggestedTargetBranches":["8.10"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/165466","number":165466,"mergeCommit":{"message":"[Security
Solution][Endpoint] Fix and unskip flaky test (#165466)\n\n##
Summary\r\n\r\nFixes and un-skips a test. Ensures that the test data
doesn't create an\r\nexisting index. If it still does, as a temp.
measure we're dismissing\r\nthe error toast that is blocking the button
so the rest of the test can\r\ncontinue.\r\n\r\ncloses
/issues/139260\r\n\r\n**flakey test
runner**\r\n\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3036\r\nx
200 ( all green)\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"ada6671165ecfc2c27014fa0aa43c58ed8e965df"}}]}]
BACKPORT-->

Co-authored-by: Ash <1849116+ashokaditya@users.noreply.github.com>
sphilipse pushed a commit to sphilipse/kibana that referenced this issue Sep 4, 2023
## Summary

Fixes and un-skips a test. Ensures that the test data doesn't create an
existing index. If it still does, as a temp. measure we're dismissing
the error toast that is blocking the button so the rest of the test can
continue.

closes elastic/issues/139260

**flakey test runner**

https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3036
x 200 ( all green)

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
failed-test A test failure on a tracked branch, potentially flaky-test OLM Sprint Team:Defend Workflows “EDR Workflows” sub-team of Security Solution Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc.
Projects
None yet
7 participants