test: await click instead of element not in doc

This commit is contained in:
Ondrej Ezr 2024-07-18 14:35:53 +02:00 committed by Klara Simickova
parent 7d537bcb66
commit 69b7c574ae

View file

@ -222,16 +222,14 @@ describe('Repositories edit mode', () => {
});
expect(repoCheckbox).toBeChecked();
user.click(repoCheckbox);
await user.click(repoCheckbox);
await new Promise((r) => setTimeout(r, 1000));
await screen.findByText(/Are you sure?/);
const removeAnywayBtn = await screen.findByRole('button', {
name: /Remove anyway/,
});
user.click(removeAnywayBtn);
await user.click(removeAnywayBtn);
await waitFor(() =>
expect(screen.queryByText(/Are you sure?/)).not.toBeInTheDocument()
);
expect(repoCheckbox).not.toBeChecked();
});
});