Skip to content

Commit aa64a70

Browse files
committed
update: landing-page.spec.ts — only handle on download test
1 parent 4b00c34 commit aa64a70

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

tests/landing-page.spec.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,14 @@ test('has title', async ({ page }) => {
55
await expect(page).toHaveTitle(/EmptyWork/);
66
});
77

8-
test('find a curriculum vitae and download', async ({ page, browserName }, testInfo) => {
9-
const isHeaded = testInfo.project.name.includes('headed')
8+
test('find a curriculum vitae and download', async ({ page }) => {
109

1110
await page.goto('/');
1211

13-
if (browserName === 'chromium' && isHeaded) {
14-
const [popup] = await Promise.all([
15-
page.waitForEvent('popup'),
16-
await page.getByRole('link', { name: 'Open PDF of my Curriculum' }).click(),
17-
]);
18-
await popup.waitForLoadState('domcontentloaded');
19-
const url = popup.url();
20-
return expect(url).toMatch(/\.pdf$/);
21-
}
22-
23-
const [download] = await Promise.all([
24-
page.waitForEvent('download'),
25-
page.getByRole('link', { name: 'Open PDF of my Curriculum' }).click(),
26-
]);
27-
12+
const downloadPromise = page.waitForEvent('download');
13+
await page.getByRole('link', { name: 'Download my Curriculum Vitae' }).click();
14+
const download = await downloadPromise;
15+
2816
const fileName = download.suggestedFilename();
2917
expect(fileName).toMatch(/\.pdf$/);
3018

0 commit comments

Comments
 (0)