Alerting: Fix flakey FilterView test (#97882)

* increase timeout

* update assertion

* Add retry as well to prevent flakiness 🤞

---------

Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
This commit is contained in:
Gilles De Mey 2024-12-12 21:23:37 +01:00 committed by GitHub
parent 0e8702369a
commit 6dc41f0b18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -34,6 +34,7 @@ beforeEach(() => {
const io = mockIntersectionObserver();
describe('RuleList - FilterView', () => {
jest.retryTimes(2);
it('should render multiple pages of results', async () => {
render(<FilterView filterState={getFilter({ dataSourceNames: ['Mimir'] })} />);
@ -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();
});