Skip to content

Commit 8445221

Browse files
committed
Transform Layouts jest tests into playwright (#594)
1 parent 0cfcaa8 commit 8445221

File tree

203 files changed

+1658
-798
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

203 files changed

+1658
-798
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import React from 'react';
2+
import {
3+
expect,
4+
test,
5+
} from '@playwright/experimental-ct-react';
6+
import {
7+
mixPropTests,
8+
propTests,
9+
} from '../../../../tests/playwright';
10+
import {
11+
ButtonGroupForTest,
12+
SelectedButtonGroupForTest,
13+
} from './ButtonGroup.story';
14+
15+
test.describe('ButtonGroup', () => {
16+
test.describe('base', () => {
17+
test.describe('visual', () => {
18+
[
19+
...propTests.defaultComponentPropTest,
20+
...propTests.blockPropTest,
21+
...propTests.disabledPropTest,
22+
...propTests.sizePropTest,
23+
...mixPropTests([
24+
propTests.priorityPropTest,
25+
propTests.disabledPropTest,
26+
]),
27+
].forEach(({
28+
name,
29+
onBeforeTest,
30+
onBeforeSnapshot,
31+
props,
32+
}) => {
33+
test(name, async ({
34+
mount,
35+
page,
36+
}) => {
37+
if (onBeforeTest) {
38+
await onBeforeTest(page);
39+
}
40+
41+
const component = await mount(<ButtonGroupForTest {...props} />);
42+
43+
if (onBeforeSnapshot) {
44+
await onBeforeSnapshot(page, component);
45+
}
46+
47+
const screenshot = await component.screenshot();
48+
expect(screenshot).toMatchSnapshot();
49+
});
50+
});
51+
52+
test.describe('selectedButton', () => {
53+
[
54+
...mixPropTests([
55+
propTests.priorityPropTest,
56+
propTests.disabledPropTest,
57+
]),
58+
].forEach(({
59+
name,
60+
onBeforeTest,
61+
onBeforeSnapshot,
62+
props,
63+
}) => {
64+
test(name, async ({
65+
mount,
66+
page,
67+
}) => {
68+
if (onBeforeTest) {
69+
await onBeforeTest(page);
70+
}
71+
72+
const component = await mount(<SelectedButtonGroupForTest {...props} />);
73+
74+
if (onBeforeSnapshot) {
75+
await onBeforeSnapshot(page, component);
76+
}
77+
78+
const screenshot = await component.screenshot();
79+
expect(screenshot).toMatchSnapshot();
80+
});
81+
});
82+
});
83+
});
84+
});
85+
});

0 commit comments

Comments
 (0)