From f319a0289beeb0b4b465968eb4e6e676cbcd2063 Mon Sep 17 00:00:00 2001
From: "Eyo O. Eyo" <7893459+eokoneyo@users.noreply.github.com>
Date: Tue, 12 Mar 2024 20:16:13 +0100
Subject: [PATCH] Fix how sample data test install state is determined in test
(#178529)
## Summary
Closes https://github.com/elastic/kibana/issues/112103
Make sample data install status available to be read by test util, as
documented by @gsoldevila in the issue referenced above. The issue
happens because there's a slight delay that really can't be walked
around where the install status in this particular instance is still
'installed' but the call to mark the sample data completes so there's
that flicker where the `remove` element is displayed momentarily because
the component doesn't quite received the update to the sample data's
install status immediately.
The proposed fix opts to complement the current way of determining if
any sample data is installed using the newly introduced `data-status`
attribute, here we wait till the result of clicking the remove button
actually triggers a change in the value of the install state of said
sample data, which in turn is reflected in the value of `data-status`
alongside checking that the remove button exists.
### 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
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
(cherry picked from commit 910188e4e0baf6b2dbfbab88f4f4466a077f87c2)
---
.../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"
>