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:
parent
eee1f78d27
commit
0af6a0324f
2 changed files with 9 additions and 7 deletions
|
|
@ -183,11 +183,13 @@ describe('Blueprints', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
await selectBlueprintById(blueprintIdWithComposes);
|
await selectBlueprintById(blueprintIdWithComposes);
|
||||||
expect(
|
await waitFor(() => {
|
||||||
screen.queryByText(
|
expect(
|
||||||
/CentOS Stream 8 is no longer supported, building images from this blueprint will fail./,
|
screen.queryByText(
|
||||||
),
|
/CentOS Stream 8 is no longer supported, building images from this blueprint will fail./,
|
||||||
).not.toBeInTheDocument();
|
),
|
||||||
|
).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('blueprint linting and fixing', async () => {
|
test('blueprint linting and fixing', async () => {
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ const openActivationKeyDropdown = async () => {
|
||||||
const activationKeyDropdown = await screen.findByPlaceholderText(
|
const activationKeyDropdown = await screen.findByPlaceholderText(
|
||||||
'Select activation key',
|
'Select activation key',
|
||||||
);
|
);
|
||||||
user.click(activationKeyDropdown);
|
await waitFor(() => user.click(activationKeyDropdown));
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectActivationKey = async (key: string) => {
|
const selectActivationKey = async (key: string) => {
|
||||||
|
|
@ -92,7 +92,7 @@ const selectActivationKey = async (key: string) => {
|
||||||
const activationKey = await screen.findByRole('option', {
|
const activationKey = await screen.findByRole('option', {
|
||||||
name: key,
|
name: key,
|
||||||
});
|
});
|
||||||
user.click(activationKey);
|
await waitFor(() => user.click(activationKey));
|
||||||
await screen.findByDisplayValue(key);
|
await screen.findByDisplayValue(key);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue