Playwright: Some tweaks to improve stability (#108667)

playwright stability tweaks
This commit is contained in:
Ashley Harrison
2025-07-25 10:54:07 +01:00
committed by GitHub
parent fa8b631a87
commit 11b49cf7bd
4 changed files with 14 additions and 6 deletions
@@ -51,8 +51,10 @@ test.describe(
// Get the tooltip ID from the aria-describedby attribute
const tooltipId = await descriptionIcon.getAttribute('aria-describedby');
const tooltip = page.locator(`[id="${tooltipId}"]`);
await expect(tooltip).toHaveText(`${newDescription}\n`);
await expect(async () => {
const tooltip = page.locator(`[id="${tooltipId}"]`);
await expect(tooltip).toHaveText(`${newDescription}\n`);
}).toPass();
});
}
);
@@ -42,6 +42,9 @@ test.describe(
await page.getByTestId(selectors.components.TimeZonePicker.containerV2).click();
await page.getByRole('option', { name: 'Asia/Tokyo' }).click();
await page.getByTestId(selectors.components.UserProfile.preferencesSaveButton).click();
// wait for the page to reload before trying to navigate, otherwise this can cause flakes
// see e.g. https://github.com/microsoft/playwright/issues/21451#issuecomment-1502251404
await page.waitForURL('/profile');
// Open dashboard with time range from 8th to end of 10th.
// Will be Tokyo time because of above preference
@@ -31,7 +31,7 @@ test.describe(
await expect(sandboxDiv).toBeHidden();
const appPage = page.getByTestId('sandbox-app-test-page-one');
await expect(appPage).toBeVisible({ timeout: 10000 });
await expect(appPage).toBeVisible();
});
test('Loads the app configuration without the sandbox div wrapper', async ({ page }) => {
@@ -41,7 +41,7 @@ test.describe(
await expect(sandboxDiv).toBeHidden();
const configPage = page.getByTestId('sandbox-app-test-config-page');
await expect(configPage).toBeVisible({ timeout: 10000 });
await expect(configPage).toBeVisible();
});
});
@@ -59,7 +59,7 @@ test.describe(
await expect(sandboxDiv).toBeVisible();
const appPage = page.getByTestId('sandbox-app-test-page-one');
await expect(appPage).toBeVisible({ timeout: 10000 });
await expect(appPage).toBeVisible();
});
test('Loads the app configuration with the sandbox div wrapper', async ({ page }) => {
@@ -69,7 +69,7 @@ test.describe(
await expect(sandboxDiv).toBeVisible();
const configPage = page.getByTestId('sandbox-app-test-config-page');
await expect(configPage).toBeVisible({ timeout: 10000 });
await expect(configPage).toBeVisible();
});
});
});
+3
View File
@@ -16,6 +16,9 @@ export default defineConfig<PluginOptions>({
reporter: [
['html'], // pretty
],
expect: {
timeout: 10_000,
},
use: {
baseURL: process.env.GRAFANA_URL ?? DEFAULT_URL,
trace: 'retain-on-failure',