From 6dc41f0b18194d209f5838282b743980639a5eac Mon Sep 17 00:00:00 2001 From: Gilles De Mey Date: Thu, 12 Dec 2024 21:23:37 +0100 Subject: [PATCH] Alerting: Fix flakey FilterView test (#97882) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * increase timeout * update assertion * Add retry as well to prevent flakiness 🤞 --------- Co-authored-by: Tom Ratcliffe --- .../features/alerting/unified/rule-list/FilterView.test.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/app/features/alerting/unified/rule-list/FilterView.test.tsx b/public/app/features/alerting/unified/rule-list/FilterView.test.tsx index 01b8e64663c..b436e84941a 100644 --- a/public/app/features/alerting/unified/rule-list/FilterView.test.tsx +++ b/public/app/features/alerting/unified/rule-list/FilterView.test.tsx @@ -34,6 +34,7 @@ beforeEach(() => { const io = mockIntersectionObserver(); describe('RuleList - FilterView', () => { + jest.retryTimes(2); it('should render multiple pages of results', async () => { render(); @@ -53,12 +54,11 @@ describe('RuleList - FilterView', () => { await loadMoreResults(); - const matchingRule = await screen.findByRole('treeitem', { - name: /test-rule-8 test-mimir-namespace test-group-4501/, - }); + const matchingRule = (await screen.findAllByRole('treeitem')).at(0); expect(matchingRule).toBeInTheDocument(); expect(matchingRule).toHaveTextContent('test-rule-8'); + expect(matchingRule).toHaveTextContent('test-mimir-namespace'); expect(matchingRule).toHaveTextContent('test-group-4501'); expect(await screen.findByText(/No more results/)).toBeInTheDocument(); });