-
-
Notifications
You must be signed in to change notification settings - Fork 142
/
Copy pathrsc-css-modules.spec.ts
42 lines (34 loc) · 1.21 KB
/
rsc-css-modules.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
42
import { expect } from '@playwright/test';
import { test, prepareNormalSetup } from './utils.js';
const startApp = prepareNormalSetup('rsc-css-modules');
for (const mode of ['DEV', 'PRD'] as const) {
test.describe(`rsc-css-modules: ${mode}`, () => {
let port: number;
let stopApp: () => Promise<void>;
test.beforeAll(async () => {
({ port, stopApp } = await startApp(mode));
});
test.afterAll(async () => {
await stopApp();
});
test('css-modules classes', async ({ page }) => {
await page.goto(`http://localhost:${port}/`);
const wrapperClass = await page
.getByTestId('app-wrapper')
.getAttribute('class');
expect(wrapperClass).toContain('wrapper');
const appNameClass = await page
.getByTestId('app-name')
.getAttribute('class');
expect(appNameClass).toContain('text');
const clientcounterClass = await page
.getByTestId('client-counter')
.getAttribute('class');
expect(clientcounterClass).toContain('counterWrapper');
const incrementClass = await page
.getByTestId('increment')
.getAttribute('class');
expect(incrementClass).toContain('counterButton');
});
});
}