test: Add retry to the flakiest tests

This adds three possible retries to three of the flakiest tests.
This commit is contained in:
regexowl 2024-07-25 11:18:58 +02:00 committed by Ondřej Ezr
parent fabb24c02d
commit cba54c54c6
3 changed files with 36 additions and 32 deletions

View file

@ -138,7 +138,7 @@ describe('Step Upload to Azure', () => {
await verifyCancelButton(router);
});
test('azure step basics works', async () => {
test('azure step basics works', { retry: 3 }, async () => {
await setUp();
const nextButton = await getNextButton();
@ -233,7 +233,7 @@ describe('Step Upload to Azure', () => {
);
expect(nextButton).not.toHaveClass('pf-m-disabled');
}, 10000);
});
test('handles change of selected Source', async () => {
await setUp();

View file

@ -197,41 +197,45 @@ describe('Repositories edit mode', () => {
const expectedRequest = repositoriesCreateBlueprintRequest;
expect(receivedRequest).toEqual(expectedRequest);
});
test('modal pops up when deselecting previously used repository', async () => {
const id = mockBlueprintIds['repositories'];
await renderEditMode(id);
test(
'modal pops up when deselecting previously used repository',
{ retry: 3 },
async () => {
const id = mockBlueprintIds['repositories'];
await renderEditMode(id);
const customRepositories = await screen.findByRole('button', {
name: /Custom repositories/,
});
const customRepositories = await screen.findByRole('button', {
name: /Custom repositories/,
});
user.click(customRepositories);
user.click(customRepositories);
await screen.findByText(
/Removing previously added repositories may lead to issues with selected packages/i
);
await screen.findByText(
/Removing previously added repositories may lead to issues with selected packages/i
);
const selectedRepositories = await screen.findByRole('button', {
name: /Selected repositories/,
});
user.click(selectedRepositories);
const selectedRepositories = await screen.findByRole('button', {
name: /Selected repositories/,
});
user.click(selectedRepositories);
const repoCheckbox = await screen.findByRole('checkbox', {
name: /select row 0/i,
});
await waitFor(() => expect(repoCheckbox).toBeChecked());
const repoCheckbox = await screen.findByRole('checkbox', {
name: /select row 0/i,
});
await waitFor(() => expect(repoCheckbox).toBeChecked());
user.click(repoCheckbox);
await screen.findByText(/Are you sure?/);
const removeAnywayBtn = await screen.findByRole('button', {
name: /Remove anyway/,
});
user.click(removeAnywayBtn);
user.click(repoCheckbox);
await screen.findByText(/Are you sure?/);
const removeAnywayBtn = await screen.findByRole('button', {
name: /Remove anyway/,
});
user.click(removeAnywayBtn);
await waitFor(() =>
expect(screen.queryByText(/Are you sure?/)).not.toBeInTheDocument()
);
await waitFor(() =>
expect(screen.queryByText(/Are you sure?/)).not.toBeInTheDocument()
);
await waitFor(() => expect(repoCheckbox).not.toBeChecked());
});
await waitFor(() => expect(repoCheckbox).not.toBeChecked());
}
);
});

View file

@ -133,7 +133,7 @@ describe('Images Table', () => {
expect(await screen.findByText(/ami-0e778053cd490ad21/i)).not.toBeVisible();
});
test('check error details', async () => {
test('check error details', { retry: 3 }, async () => {
await renderWithReduxRouter('', {});
let table = await screen.findByTestId('images-table');