Skip to content

Commit 8ec2e8f

Browse files
committed
Attempt to fix flaky tests
1 parent c339e44 commit 8ec2e8f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

examples/new/template.spec.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ test('should exist an element with the welcome message text', async ({
1616
page
1717
}) => {
1818
await page.goto('chrome://newtab/')
19-
const h1 = page.locator('h1')
20-
test.expect(h1).toContainText('Welcome to your')
19+
20+
const h1 = await page.waitForSelector('h1', {state: 'visible', timeout: 5000})
21+
22+
const textContent = await h1.textContent()
23+
test.expect(textContent).toMatch(/Welcome to your/i)
2124
})
2225

2326
test('should exist a default color value', async ({page}) => {

0 commit comments

Comments
 (0)