Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: flaky tests fixes (#26714)

Pavel Feldman376f2850b363
diff --git a/tests/playwright-test/ui-mode-fixtures.ts b/tests/playwright-test/ui-mode-fixtures.ts
index ef016f047b..43f51722a6 100644
--- a/tests/playwright-test/ui-mode-fixtures.ts
+++ b/tests/playwright-test/ui-mode-fixtures.ts
@@ -77,7 +77,7 @@ export function dumpTestTree(page: Page, options: { time?: boolean } = {}): () =
const selected = listItem.classList.contains('selected') ? ' <=' : '';
const title = listItem.querySelector('.ui-mode-list-item-title').textContent;
const timeElement = options.time ? listItem.querySelector('.ui-mode-list-item-time') : undefined;
- const time = timeElement ? ' ' + timeElement.textContent.replace(/\d+m?s/, 'XXms') : '';
+ const time = timeElement ? ' ' + timeElement.textContent.replace(/[.\d]+m?s/, 'XXms') : '';
result.push(' ' + ' '.repeat(indent) + treeIcon + ' ' + statusIcon + ' ' + title + time + watch + selected);
}
return '\n' + result.join('\n') + '\n ';
diff --git a/tests/playwright-test/ui-mode-test-screencast.spec.ts b/tests/playwright-test/ui-mode-test-screencast.spec.ts
index 711af0465f..27e3393e99 100644
--- a/tests/playwright-test/ui-mode-test-screencast.spec.ts
+++ b/tests/playwright-test/ui-mode-test-screencast.spec.ts
@@ -39,11 +39,11 @@ test('should show screenshots', async ({ runUITest }) => {
await expect(
page.locator('.CodeMirror .source-line-running'),
).toContainText(`test('test 1', async ({ page }) => {`);
- await expect(page.locator('.film-strip-frame')).toBeVisible();
+ await expect(page.locator('.film-strip-frame').first()).toBeVisible();
await page.getByText('test 2', { exact: true }).click();
await expect(
page.locator('.CodeMirror .source-line-running'),
).toContainText(`test('test 2', async ({ page }) => {`);
- await expect(page.locator('.film-strip-frame')).toBeVisible();
+ await expect(page.locator('.film-strip-frame').first()).toBeVisible();
});