Skip to content

Commit 400f466

Browse files
authored
test: unflake 'Copy Prompt' tests (#35714)
1 parent 444f759 commit 400f466

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

tests/playwright-test/reporter-html.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2890,6 +2890,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
28902890

28912891
await page.getByRole('link', { name: 'sample' }).click();
28922892
await page.getByRole('button', { name: 'Copy prompt' }).click();
2893+
await page.waitForFunction(() => navigator.clipboard.readText());
28932894
const prompt = await page.evaluate(() => navigator.clipboard.readText());
28942895
expect(prompt, 'first line').toContain(`Playwright test failed.`);
28952896
expect(prompt, 'contains error').toContain('expect(received).toBe(expected)');
@@ -2930,6 +2931,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
29302931
await page.context().grantPermissions(['clipboard-read', 'clipboard-write']);
29312932
await page.getByRole('link', { name: 'sample' }).click();
29322933
await page.getByRole('button', { name: 'Copy prompt' }).click();
2934+
await page.waitForFunction(() => navigator.clipboard.readText());
29332935
const prompt = await page.evaluate(() => navigator.clipboard.readText());
29342936
expect(prompt, 'contains snapshot').toContain('- button "Click me"');
29352937
});

tests/playwright-test/ui-mode-trace.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ test('fails', async ({ page }) => {
570570
await page.context().grantPermissions(['clipboard-read', 'clipboard-write']);
571571
await page.getByText('Errors', { exact: true }).click();
572572
await page.locator('.tab-errors').getByRole('button', { name: 'Copy prompt' }).click();
573+
await page.waitForFunction(() => navigator.clipboard.readText());
573574
const prompt = await page.evaluate(() => navigator.clipboard.readText());
574575
expect(prompt, 'contains error').toContain('expect(received).toBe(expected)');
575576
expect(prompt.replaceAll('\r\n', '\n'), 'contains test sources').toContain(`

0 commit comments

Comments
 (0)