|
1 |
| -import { test, expect } from "@playwright/test"; |
| 1 | +import { test as testBase, expect } from "@playwright/test"; |
2 | 2 |
|
3 |
| -test.beforeEach(async ({ page }) => { |
4 |
| - await page.goto("/"); |
5 |
| -}) |
6 |
| - |
7 |
| -test("a is right", async ({ page }) => { |
8 |
| - const el = await page.getByText("A"); |
9 |
| - |
10 |
| - await expect(el).toBeVisible(); |
11 |
| - |
12 |
| - await expect(el).toHaveCSS("background-color", "rgb(0, 0, 255)"); |
13 |
| - await expect(el).toHaveCSS("color", "rgb(255, 0, 0)"); |
14 |
| - await expect(el).toHaveClass("mc_c mc_a"); |
| 3 | +const test = testBase.extend({ |
| 4 | + dir : [ "static", { option : true }], |
15 | 5 | });
|
16 | 6 |
|
17 |
| -test("b is right", async ({ page }) => { |
18 |
| - const el = await page.getByText("B"); |
| 7 | +test("style ordering", async ({ page, dir }) => { |
| 8 | + await page.goto(`/${dir}/`); |
| 9 | + |
| 10 | + const a = await page.getByText("A"); |
19 | 11 |
|
20 |
| - await expect(el).toBeVisible(); |
| 12 | + await expect(a).toBeVisible(); |
21 | 13 |
|
22 |
| - await expect(el).toHaveCSS("background-color", "rgb(0, 0, 255)"); |
23 |
| - await expect(el).toHaveCSS("color", "rgb(255, 255, 255)"); |
24 |
| - await expect(el).toHaveClass("mc_c mc_b"); |
| 14 | + await expect(a).toHaveCSS("background-color", "rgb(0, 0, 255)"); |
| 15 | + await expect(a).toHaveCSS("color", "rgb(255, 0, 0)"); |
| 16 | + await expect(a).toHaveClass("mc_c mc_a"); |
| 17 | + |
| 18 | + const b = await page.getByText("B"); |
| 19 | + |
| 20 | + await expect(b).toBeVisible(); |
| 21 | + |
| 22 | + await expect(b).toHaveCSS("background-color", "rgb(0, 0, 255)"); |
| 23 | + await expect(b).toHaveCSS("color", "rgb(255, 255, 255)"); |
| 24 | + await expect(b).toHaveClass("mc_c mc_b"); |
25 | 25 | });
|
0 commit comments