[8.11] [docs] Fix functional test doc formatting (#169715) (#169722)

# Backport

This will backport the following commits from `main` to `8.11`:
- [[docs] Fix functional test doc formatting
(#169715)](https://github.com/elastic/kibana/pull/169715)

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

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

<!--BACKPORT [{"author":{"name":"Adam
Kasztenny","email":"adam.kasztenny@elastic.co"},"sourceCommit":{"committedDate":"2023-10-24T20:45:52Z","message":"[docs]
Fix functional test doc formatting (#169715)\n\n## Summary\r\n\r\nFollow
up to
https://github.com/elastic/kibana/pull/169596\r\n\r\n---------\r\n\r\nCo-authored-by:
Christiane (Tina) Heiligers
<christiane.heiligers@elastic.co>","sha":"6f30fa32857fa8352c50327ecb55e60e1f879a29","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:prev-minor","v8.12.0"],"number":169715,"url":"https://github.com/elastic/kibana/pull/169715","mergeCommit":{"message":"[docs]
Fix functional test doc formatting (#169715)\n\n## Summary\r\n\r\nFollow
up to
https://github.com/elastic/kibana/pull/169596\r\n\r\n---------\r\n\r\nCo-authored-by:
Christiane (Tina) Heiligers
<christiane.heiligers@elastic.co>","sha":"6f30fa32857fa8352c50327ecb55e60e1f879a29"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/169715","number":169715,"mergeCommit":{"message":"[docs]
Fix functional test doc formatting (#169715)\n\n## Summary\r\n\r\nFollow
up to
https://github.com/elastic/kibana/pull/169596\r\n\r\n---------\r\n\r\nCo-authored-by:
Christiane (Tina) Heiligers
<christiane.heiligers@elastic.co>","sha":"6f30fa32857fa8352c50327ecb55e60e1f879a29"}}]}]
BACKPORT-->

Co-authored-by: Adam Kasztenny <adam.kasztenny@elastic.co>
This commit is contained in:
Kibana Machine 2023-10-24 17:11:10 -04:00 committed by GitHub
parent 636f90e215
commit 389585c8f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,7 +10,7 @@ Consistently writing functional tests that aren't flaky is impossible. There are
When you watch tests execute locally it can be tempting to think "after I click this button I can click this other button" but this assumes that the first button click will always execute its click handler immediately, or that the render of the second button will be done immediately. The reality is that user interfaces are super complex and these types of assumptions are by far the most common cause of flakiness in tests.
We also have to remember that we can't assume a test passing locally will mean it will pass in CI. The two environments are different. There is a lot we could mention, but at a high level, most functional tests are run on 4 core 16 GB machines, and these machines are virtualized, which means neighbors can cause modest but variable levels of performance. Additionally, end-to-end tests in CI are run against {kib} distributions, using default memory configurations, while we run the tests under the `--dev` flag locally with, most likely, a different memory configuration.
We also have to remember that we can't assume a test passing locally will mean it will pass in CI. The two environments are different. There is a lot we could mention, but at a high level, most functional tests are run on 4 core 16 GB machines, and these machines are virtualized, which means neighbors can cause modest but variable levels of performance. Additionally, end-to-end tests in CI are run against Kibana distributions, using default memory configurations, while we run the tests under the `--dev` flag locally with, most likely, a different memory configuration.
There are all sorts of things that can happen to delay a click handler, or react render, and we need to be prepared for those in our tests. We can do this using appropriate timeouts for specific actions, retry logic, and validating our assumptions with code.