Test: Fix race conditions in coverage tests with proper await handling

Add waitFor() for CentOS Stream 8 warning dismissal check
Add await to activation key dropdown interactions
Fixes test failures that only occurred during coverage runs due to timing delays

The changes address timing issues where UI elements don't update fast enough during coverage test runs, which are slower due to code instrumentation.
This commit is contained in:
Michal Gold 2025-08-06 21:36:47 +03:00 committed by Klara Simickova
parent eee1f78d27
commit 0af6a0324f
2 changed files with 9 additions and 7 deletions

View file

@ -183,11 +183,13 @@ describe('Blueprints', () => {
);
await selectBlueprintById(blueprintIdWithComposes);
expect(
screen.queryByText(
/CentOS Stream 8 is no longer supported, building images from this blueprint will fail./,
),
).not.toBeInTheDocument();
await waitFor(() => {
expect(
screen.queryByText(
/CentOS Stream 8 is no longer supported, building images from this blueprint will fail./,
),
).not.toBeInTheDocument();
});
});
test('blueprint linting and fixing', async () => {

View file

@ -84,7 +84,7 @@ const openActivationKeyDropdown = async () => {
const activationKeyDropdown = await screen.findByPlaceholderText(
'Select activation key',
);
user.click(activationKeyDropdown);
await waitFor(() => user.click(activationKeyDropdown));
};
const selectActivationKey = async (key: string) => {
@ -92,7 +92,7 @@ const selectActivationKey = async (key: string) => {
const activationKey = await screen.findByRole('option', {
name: key,
});
user.click(activationKey);
await waitFor(() => user.click(activationKey));
await screen.findByDisplayValue(key);
};