Skip to content

Some content is hidden

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

65 files changed

+3042
-1999
lines changed

Diff for: .gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,9 @@ yarn-error.log*
4040

4141
# docs
4242
/docs
43+
44+
# Snapshot test data
45+
/playwright-report/
46+
/playwright/.cache/
47+
/test-results/
48+
/blob-report/

Diff for: __visual_tests__/__fixtures__/form/interface.ts

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export interface MockMessageFormItemProps {
2+
name: string;
3+
required?: boolean;
4+
sort_order: number;
5+
placeholder?: string;
6+
style: object;
7+
values?: string[];
8+
validators?: object[];
9+
draft_values?: string[];
10+
}
11+
12+
export interface MockMessageFormProps {
13+
name?: string;
14+
items: MockMessageFormItemProps[];
15+
}
16+
17+
export interface FormFixtureProps {
18+
name: string;
19+
form: MockMessageFormProps;
20+
}

Diff for: __visual_tests__/form/form-multiple.spec.ts

+169
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
import { test } from '@playwright/test';
2+
3+
import { assertScreenshot, fillForm, runBeforeEach, testDraftValues } from '../utils';
4+
import { MockMessageFormProps } from '../__fixtures__/form/interface';
5+
6+
runBeforeEach();
7+
8+
// 201: Form with one text input (no fill), one text area input (no fill), and one chip input (no select)
9+
test('201', async ({ page }) => {
10+
const form: MockMessageFormProps = {
11+
name: 'test form',
12+
items: [
13+
{
14+
name: 'Text form',
15+
required: true,
16+
sort_order: 0,
17+
placeholder: 'Text hint',
18+
style: {
19+
layout: 'text',
20+
},
21+
draft_values: [],
22+
},
23+
{
24+
name: 'Textarea form',
25+
required: true,
26+
sort_order: 0,
27+
placeholder: 'Textarea hint',
28+
style: {
29+
layout: 'textarea',
30+
},
31+
},
32+
{
33+
name: 'Chip form',
34+
required: true,
35+
sort_order: 0,
36+
style: {
37+
layout: 'chip',
38+
options: [
39+
'Chip1',
40+
'Chip2',
41+
'Chip3',
42+
'Chip4Chip4Chip4Chip4Chip4Chip4Chip4Chip4Chip4Chip4Chip4Chip4Chip4Chip4Chip4Chip4Chip4Chip4'
43+
+ 'Chip4Chip4Chip4Chip4Chip4Chip4Chip4Chip4',
44+
],
45+
},
46+
},
47+
],
48+
};
49+
await fillForm(page, JSON.stringify(form));
50+
await testDraftValues(page, form);
51+
await assertScreenshot(page);
52+
});
53+
54+
// 202: Form with one text input (no fill), one text input (no fill, not required)
55+
test('202', async ({ page }) => {
56+
const form: MockMessageFormProps = {
57+
name: 'test form',
58+
items: [
59+
{
60+
name: 'Text form 1',
61+
required: true,
62+
sort_order: 0,
63+
placeholder: 'Text 1 hint',
64+
style: {
65+
layout: 'text',
66+
},
67+
},
68+
{
69+
name: 'Text form 1',
70+
required: false,
71+
sort_order: 1,
72+
placeholder: 'Text 2 hint',
73+
style: {
74+
layout: 'text',
75+
},
76+
},
77+
],
78+
};
79+
await fillForm(page, JSON.stringify(form));
80+
await testDraftValues(page, form);
81+
await assertScreenshot(page);
82+
});
83+
84+
// 203: Form with one text area input (no fill), one text area input (no fill, not required) and one chip input (no select)
85+
test('203', async ({ page }) => {
86+
const form: MockMessageFormProps = {
87+
name: 'test form',
88+
items: [
89+
{
90+
name: 'Textarea form 1',
91+
required: true,
92+
sort_order: 0,
93+
placeholder: 'Textarea 1 hint',
94+
style: {
95+
layout: 'textarea',
96+
},
97+
},
98+
{
99+
name: 'Textarea form 2',
100+
required: false,
101+
sort_order: 1,
102+
placeholder: 'Textarea 2 hint',
103+
style: {
104+
layout: 'textarea',
105+
},
106+
},
107+
],
108+
};
109+
await fillForm(page, JSON.stringify(form));
110+
await testDraftValues(page, form);
111+
await assertScreenshot(page);
112+
});
113+
114+
// 204: Form with one chip input (no select), and one chip input (select one chip)
115+
test('204', async ({ page }) => {
116+
const form: MockMessageFormProps = {
117+
name: 'test form',
118+
items: [
119+
{
120+
name: 'Chip form 1',
121+
required: true,
122+
sort_order: 0,
123+
style: {
124+
layout: 'chip',
125+
options: [
126+
'Chip1',
127+
'Chip2',
128+
'Chip3',
129+
'Chip4Chip4Chip4Chip4Chip4Chip4Chip4Chip4Chip4Chip4Chip4Chip4Chip4',
130+
],
131+
},
132+
},
133+
{
134+
name: 'Chip form 2',
135+
required: true,
136+
sort_order: 1,
137+
style: {
138+
layout: 'chip',
139+
options: [
140+
'Chip5',
141+
'Chip6',
142+
'Chip7',
143+
'Chip8',
144+
],
145+
default_options: [
146+
'Chip5',
147+
],
148+
},
149+
},
150+
{
151+
name: 'Chip form 3',
152+
required: true,
153+
sort_order: 2,
154+
style: {
155+
layout: 'chip',
156+
options: [
157+
'Chip9',
158+
'Chip10',
159+
'Chip11',
160+
'Chip12',
161+
],
162+
},
163+
},
164+
],
165+
};
166+
await fillForm(page, JSON.stringify(form));
167+
await testDraftValues(page, form);
168+
await assertScreenshot(page);
169+
});
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)