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

[Dashboard navigation] Fix flaky test #167896

Merged
merged 16 commits into from
Oct 23, 2023

Conversation

nickpeihl
Copy link
Member

@nickpeihl nickpeihl commented Oct 3, 2023

Fixes #167713 and #169276

Summary

It appears the dashboard links were not ready (still loading) when the test was trying to click on them. When they finish loading the element was stale, triggering the StaleElement error. This PR calls the RenderCompleteDispatcher on the Links embeddable when all of the child components have finished loading.

In a future PR, we should consider re-factoring such that the async dashboard fetching happens in the LinksComponent and the results are passed as props to the DashboardLinkComponents. This would be more React-like. I resisted making that change in this PR so that we can fix the reporting error for v8.11.

Flaky test runner 🤞

https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3636

@nickpeihl
Copy link
Member Author

@elasticmachine merge upstream

@nickpeihl nickpeihl marked this pull request as ready for review October 3, 2023 21:02
@nickpeihl nickpeihl requested a review from a team as a code owner October 3, 2023 21:02
@nickpeihl nickpeihl added the Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas label Oct 3, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@nickpeihl nickpeihl added Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas release_note:skip Skip the PR/issue when compiling release notes v8.11.0 and removed Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas labels Oct 3, 2023
@@ -137,7 +137,7 @@ export const DashboardLinkComponent = ({

return loadingDestinationDashboard ? (
<li id={`${id}--loading`}>
<EuiButtonEmpty size="s" isLoading={true} data-test-subj={`${id}--loading`}>
<EuiButtonEmpty size="s" isLoading={true} data-loading data-test-subj={`${id}--loading`}>
Copy link
Contributor

@Heenawter Heenawter Oct 3, 2023

Choose a reason for hiding this comment

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

Hmmm... do we maybe want to make use of the RenderCompleteDispatcher instead? 🤔 This is how Lens, the image embeddable, and saved searches handle this... But we seem to be pretty inconsistent.

@ThomThomson Any thoughts here? I know we've discussed this before for controls, and we ended up faking these attributes for them as well 😆 So I'm good either way - especially since I imagine this will all be changed as part of the embeddable refactor?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah it looks like it should be pretty straightforward to use the RenderCompleteDispatcher via the abstract Embeddable. I'm not completely sure how that ends up setting the attribute, but we definitely should be using it. The more consistent we are, the easier it will be to update it all.

This should fix the flaky test. However, we should consider
refactoring the LinksComponent in a future PR to handle the
dashboard fetching so we are "Lifting state up" rather than
having the children components telling the parent when they
have finished loading.
onLoading is not necessary since the component load synchronously
Copy link
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

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

Changes LGTM! Nicely updated unit and functional tests. Update to the renderComplete dispatcher looks good also.

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
links 91 92 +1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
links 59 62 +3

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
links 25.4KB 25.1KB -303.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
links 32.1KB 33.6KB +1.5KB
Unknown metric groups

API count

id before after diff
links 61 64 +3

History

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

@nickpeihl nickpeihl merged commit 513a31f into elastic:main Oct 23, 2023
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 23, 2023
Fixes elastic#167713 and elastic#169276

## Summary

It appears the dashboard links were not ready (still loading) when the
test was trying to click on them. When they finish loading the element
was stale, triggering the StaleElement error. This PR calls the
RenderCompleteDispatcher on the Links embeddable when all of the child
components have finished loading.

In a future PR, we should consider re-factoring such that the async
dashboard fetching happens in the LinksComponent and the results are
passed as props to the DashboardLinkComponents. This would be more
React-like. I resisted making that change in this PR so that we can fix
the reporting error for v8.11.

## Flaky test runner 🤞
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3636

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 513a31f)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.11

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Oct 23, 2023
# Backport

This will backport the following commits from `main` to `8.11`:
- [[Dashboard navigation] Fix flaky test
(#167896)](#167896)

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

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

<!--BACKPORT [{"author":{"name":"Nick
Peihl","email":"nick.peihl@elastic.co"},"sourceCommit":{"committedDate":"2023-10-23T19:28:04Z","message":"[Dashboard
navigation] Fix flaky test (#167896)\n\nFixes #167713 and
#169276\r\n\r\n## Summary\r\n\r\nIt appears the dashboard links were not
ready (still loading) when the\r\ntest was trying to click on them. When
they finish loading the element\r\nwas stale, triggering the
StaleElement error. This PR calls the\r\nRenderCompleteDispatcher on the
Links embeddable when all of the child\r\ncomponents have finished
loading.\r\n\r\nIn a future PR, we should consider re-factoring such
that the async\r\ndashboard fetching happens in the LinksComponent and
the results are\r\npassed as props to the DashboardLinkComponents. This
would be more\r\nReact-like. I resisted making that change in this PR so
that we can fix\r\nthe reporting error for v8.11.\r\n\r\n## Flaky test
runner 🤞
\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3636\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"513a31f83f454fbc83dfe983877620147c982833","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Presentation","release_note:skip","v8.11.0","v8.12.0"],"number":167896,"url":"https://github.com/elastic/kibana/pull/167896","mergeCommit":{"message":"[Dashboard
navigation] Fix flaky test (#167896)\n\nFixes #167713 and
#169276\r\n\r\n## Summary\r\n\r\nIt appears the dashboard links were not
ready (still loading) when the\r\ntest was trying to click on them. When
they finish loading the element\r\nwas stale, triggering the
StaleElement error. This PR calls the\r\nRenderCompleteDispatcher on the
Links embeddable when all of the child\r\ncomponents have finished
loading.\r\n\r\nIn a future PR, we should consider re-factoring such
that the async\r\ndashboard fetching happens in the LinksComponent and
the results are\r\npassed as props to the DashboardLinkComponents. This
would be more\r\nReact-like. I resisted making that change in this PR so
that we can fix\r\nthe reporting error for v8.11.\r\n\r\n## Flaky test
runner 🤞
\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3636\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"513a31f83f454fbc83dfe983877620147c982833"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/167896","number":167896,"mergeCommit":{"message":"[Dashboard
navigation] Fix flaky test (#167896)\n\nFixes #167713 and
#169276\r\n\r\n## Summary\r\n\r\nIt appears the dashboard links were not
ready (still loading) when the\r\ntest was trying to click on them. When
they finish loading the element\r\nwas stale, triggering the
StaleElement error. This PR calls the\r\nRenderCompleteDispatcher on the
Links embeddable when all of the child\r\ncomponents have finished
loading.\r\n\r\nIn a future PR, we should consider re-factoring such
that the async\r\ndashboard fetching happens in the LinksComponent and
the results are\r\npassed as props to the DashboardLinkComponents. This
would be more\r\nReact-like. I resisted making that change in this PR so
that we can fix\r\nthe reporting error for v8.11.\r\n\r\n## Flaky test
runner 🤞
\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3636\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"513a31f83f454fbc83dfe983877620147c982833"}}]}]
BACKPORT-->

Co-authored-by: Nick Peihl <nick.peihl@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v8.11.0 v8.12.0
Projects
None yet
6 participants