Skip to content

Commit 6b1774f

Browse files
committed
create: landing-page.spec.ts
1 parent 69ab32b commit 6b1774f

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/landing-page.spec.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test('has title', async ({ page }) => {
4+
await page.goto('/');
5+
await expect(page).toHaveTitle(/EmptyWork/);
6+
});
7+
8+
test('find a curriculum vitae and download', async ({ page, browserName }, testInfo) => {
9+
const isHeaded = testInfo.project.name.includes('headed')
10+
11+
await page.goto('/');
12+
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+
28+
const fileName = download.suggestedFilename();
29+
expect(fileName).toMatch(/\.pdf$/);
30+
31+
});

0 commit comments

Comments
 (0)