From 2c605bc050c343439dd1042cc6d6619386c5c6fe Mon Sep 17 00:00:00 2001
From: Julian Gernun <17549662+jcger@users.noreply.github.com>
Date: Wed, 1 Feb 2023 15:13:33 +0100
Subject: [PATCH 1/2] remove unnecessary check and wait for element to show
---
.../rules_list/components/rules_list.test.tsx | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx
index b5f2cc2a0cb0a..0c91b379e0527 100644
--- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx
+++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx
@@ -332,15 +332,8 @@ describe('rules_list ', () => {
renderWithProviders(
);
- await waitFor(() => screen.getByText('Rule state'));
- expect(loadRulesWithKueryFilter).toHaveBeenLastCalledWith(
- expect.objectContaining({
- ruleStatusesFilter: ['disabled'],
- })
- );
-
- fireEvent.click(screen.getAllByTestId('ruleStatusFilterButton')[0]);
- fireEvent.click(screen.getAllByTestId('ruleStatusFilterOption-enabled')[0]);
+ fireEvent.click((await screen.findAllByTestId('ruleStatusFilterButton'))[0]);
+ fireEvent.click((await screen.findAllByTestId('ruleStatusFilterOption-enabled'))[0]);
expect(loadRulesWithKueryFilter).toHaveBeenLastCalledWith(
expect.objectContaining({
ruleStatusesFilter: ['disabled', 'enabled'],
From c2141dbe117a548639dd37d80e156baec82e018f Mon Sep 17 00:00:00 2001
From: Julian Gernun <17549662+jcger@users.noreply.github.com>
Date: Thu, 2 Feb 2023 11:43:52 +0100
Subject: [PATCH 2/2] add back initial check but waiting for spinner to exit
---
.../sections/rules_list/components/rules_list.test.tsx | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx
index 0c91b379e0527..67c5f7f7ac200 100644
--- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx
+++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx
@@ -332,6 +332,12 @@ describe('rules_list ', () => {
renderWithProviders(
);
+ await waitForElementToBeRemoved(() => screen.queryByTestId('centerJustifiedSpinner'));
+ expect(loadRulesWithKueryFilter).toHaveBeenLastCalledWith(
+ expect.objectContaining({
+ ruleStatusesFilter: ['disabled'],
+ })
+ );
fireEvent.click((await screen.findAllByTestId('ruleStatusFilterButton'))[0]);
fireEvent.click((await screen.findAllByTestId('ruleStatusFilterOption-enabled'))[0]);
expect(loadRulesWithKueryFilter).toHaveBeenLastCalledWith(