forked from ASOS/web-toggle-point
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.spec.js
More file actions
34 lines (30 loc) · 1.13 KB
/
Copy pathplaywright.spec.js
File metadata and controls
34 lines (30 loc) · 1.13 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
import { test, expect } from "@playwright/test";
const scenarios = [
{ size: "Small", port: 3003 },
{ size: "Medium", port: 3002 },
{ size: "Large", port: 3004 }
];
test.describe("config endpoint", () => {
scenarios.forEach(({ size, port }) => {
test.describe(`server rendering a config as props to a component (size ${size})`, () => {
test.beforeEach(async ({ page }) => {
await page.goto(`http://localhost:${port}/config`);
});
test("it shows a varied experience", async ({ page }) => {
await expect(page.getByText(`I am ${size}`)).toBeVisible();
});
scenarios
.filter((scenario) => scenario.size !== size)
.forEach(({ size: otherSize }) => {
test.describe(`when clicking on the ${otherSize} button`, () => {
test("it shows an updated experience, overriding the settings configured on the server", async ({
page
}) => {
await page.getByRole("button", { name: otherSize }).click();
await expect(page.getByText(`I am ${otherSize}`)).toBeVisible();
});
});
});
});
});
});