forked from QwikDev/qwik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathe2e.resuming.spec.ts
41 lines (36 loc) · 1.26 KB
/
e2e.resuming.spec.ts
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
40
41
import { test, expect } from "@playwright/test";
test.describe("resuming", () => {
test.beforeEach(async ({ page }) => {
await page.goto("/e2e/resuming");
page.on("pageerror", (err) => expect(err).toEqual(undefined));
page.on("console", (msg) => {
if (msg.type() === "error") {
expect(msg.text()).toEqual(undefined);
}
});
});
test("should toggle without crash", async ({ page }) => {
const toggle = page.locator("#toggle");
const increment = page.locator("#increment");
const counter = page.locator("#counter");
const counterCopy = page.locator("#counter-copy");
await expect(counter).toBeVisible();
await expect(counter).toHaveText("0");
await expect(counterCopy).toHaveText("0");
// Hide
await toggle.click();
await expect(counter).not.toBeVisible();
await increment.click();
await increment.click();
await expect(counter).not.toBeVisible();
await expect(counterCopy).toHaveText("0");
// Show
await toggle.click();
await expect(counter).toBeVisible();
await expect(counter).toHaveText("2");
await expect(counterCopy).toHaveText("2");
await increment.click();
await expect(counter).toHaveText("3");
await expect(counterCopy).toHaveText("3");
});
});