From daffde599273833cba301fc197b98584678231dd Mon Sep 17 00:00:00 2001 From: "Eyo O. Eyo" <7893459+eokoneyo@users.noreply.github.com> Date: Wed, 13 Mar 2024 18:36:36 +0100 Subject: [PATCH] [8.13] Fix how sample data test install state is determined in test (#178529) (#178601) # Backport This will backport the following commits from `main` to `8.13`: - [Fix how sample data test install state is determined in test (#178529)](https://github.com/elastic/kibana/pull/178529) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) \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\r\n- [x] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n","sha":"910188e4e0baf6b2dbfbab88f4f4466a077f87c2","branchLabelMapping":{"^v8.14.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:skip","Team:SharedUX","v8.13.0","v8.14.0"],"number":178529,"url":"https://github.com/elastic/kibana/pull/178529","mergeCommit":{"message":"Fix how sample data test install state is determined in test (#178529)\n\n## Summary\r\nCloses https://github.com/elastic/kibana/issues/112103\r\n\r\nMake sample data install status available to be read by test util, as\r\ndocumented by @gsoldevila in the issue referenced above. The issue\r\nhappens because there's a slight delay that really can't be walked\r\naround where the install status in this particular instance is still\r\n'installed' but the call to mark the sample data completes so there's\r\nthat flicker where the `remove` element is displayed momentarily because\r\nthe component doesn't quite received the update to the sample data's\r\ninstall status immediately.\r\n\r\nThe proposed fix opts to complement the current way of determining if\r\nany sample data is installed using the newly introduced `data-status`\r\nattribute, here we wait till the result of clicking the remove button\r\nactually triggers a change in the value of the install state of said\r\nsample data, which in turn is reflected in the value of `data-status`\r\nalongside checking that the remove button exists.\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\r\n- [x] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n","sha":"910188e4e0baf6b2dbfbab88f4f4466a077f87c2"}},"sourceBranch":"main","suggestedTargetBranches":["8.13"],"targetPullRequestStates":[{"branch":"8.13","label":"v8.13.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.14.0","labelRegex":"^v8.14.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/178529","number":178529,"mergeCommit":{"message":"Fix how sample data test install state is determined in test (#178529)\n\n## Summary\r\nCloses https://github.com/elastic/kibana/issues/112103\r\n\r\nMake sample data install status available to be read by test util, as\r\ndocumented by @gsoldevila in the issue referenced above. The issue\r\nhappens because there's a slight delay that really can't be walked\r\naround where the install status in this particular instance is still\r\n'installed' but the call to mark the sample data completes so there's\r\nthat flicker where the `remove` element is displayed momentarily because\r\nthe component doesn't quite received the update to the sample data's\r\ninstall status immediately.\r\n\r\nThe proposed fix opts to complement the current way of determining if\r\nany sample data is installed using the newly introduced `data-status`\r\nattribute, here we wait till the result of clicking the remove button\r\nactually triggers a change in the value of the install state of said\r\nsample data, which in turn is reflected in the value of `data-status`\r\nalongside checking that the remove button exists.\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\r\n- [x] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n","sha":"910188e4e0baf6b2dbfbab88f4f4466a077f87c2"}}]}] BACKPORT--> --- .../sample_data_card.test.tsx.snap | 165 ++++++++++-------- .../sample_data_card/src/footer/index.tsx | 30 +++- test/functional/page_objects/home_page.ts | 5 +- .../tests/browser.ts | 3 +- 4 files changed, 117 insertions(+), 86 deletions(-) diff --git a/packages/home/sample_data_card/src/__snapshots__/sample_data_card.test.tsx.snap b/packages/home/sample_data_card/src/__snapshots__/sample_data_card.test.tsx.snap index 269499f65547a..76a56fb33c5e4 100644 --- a/packages/home/sample_data_card/src/__snapshots__/sample_data_card.test.tsx.snap +++ b/packages/home/sample_data_card/src/__snapshots__/sample_data_card.test.tsx.snap @@ -57,56 +57,61 @@ exports[`SampleDataCard installed renders with app links 1`] = ` class="emotion-euiCard__footer" >