-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathbasic.e2e.ts
More file actions
39 lines (34 loc) · 1.14 KB
/
basic.e2e.ts
File metadata and controls
39 lines (34 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import {test, expect} from '@playwright/test';
[
['iframe', 'vanilla'],
['iframe', 'preact'],
['iframe', 'svelte'],
['iframe', 'vue'],
['iframe', 'htm'],
['iframe', 'react'],
['iframe', 'react-remote-ui'],
['worker', 'vanilla'],
['worker', 'preact'],
['worker', 'svelte'],
// ['worker', 'vue'],
['worker', 'htm'],
['worker', 'react'],
['worker', 'react-remote-ui'],
].forEach(([sandbox, example]) => {
test(`basic modal interaction with ${sandbox} sandbox and ${example} example`, async ({
page,
}) => {
await page.goto(`/?sandbox=${sandbox}&example=${example}`);
await page.getByRole('button', {name: 'Open modal'}).click();
await page.getByRole('button', {name: 'Click me!'}).click();
await page.getByRole('button', {name: 'Click me!'}).click();
await expect(page.getByText('Click Count: 2')).toBeVisible();
page.once('dialog', (dialog) => {
expect(dialog.message()).toBe('You clicked 2 times!');
dialog.dismiss().catch(() => {});
});
const dialogPromise = page.waitForEvent('dialog');
await page.getByRole('button', {name: 'Close'}).click();
await dialogPromise;
});
});