Skip to content

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

test: unflake recently added toHaveText test (#37954)

Yury Semikhatsky21e7681a582b
diff --git a/tests/page/expect-to-have-text.spec.ts b/tests/page/expect-to-have-text.spec.ts
index 818dc77ff4..081e9a2eca 100644
--- a/tests/page/expect-to-have-text.spec.ts
+++ b/tests/page/expect-to-have-text.spec.ts
@@ -169,6 +169,7 @@ test.describe('toHaveText with text', () => {
});
test('do not show "element(s) not found" when the real failure is a string mismatch', async ({ page }) => {
+ test.skip(process.env.PW_CLOCK === 'frozen', 'The element is attached after 1 second.');
await page.setContent(`
<div>Initial</div>
<script>
@@ -181,7 +182,7 @@ test.describe('toHaveText with text', () => {
`);
const cell = page.locator('#field');
- const error = await expect(cell).toHaveText('Something', { timeout: 2000 }).catch(e => e);
+ const error = await expect(cell).toHaveText('Something', { timeout: 3000 }).catch(e => e);
expect(stripAnsi(error.message)).toContain('Expected: "Something"');
expect(stripAnsi(error.message)).toContain('Received: "Final value"');
});