@@ -3,9 +3,9 @@ import React from 'react';
3
3
import { test } from '~playwright/core' ;
4
4
5
5
import { createSmokeScenarios } from '../../../stories/tests-factory/create-smoke-scenarios' ;
6
- import type { SelectProps } from '../Select' ;
7
6
import { Select } from '../Select' ;
8
7
import { SelectQa } from '../constants' ;
8
+ import type { SelectProps } from '../types' ;
9
9
10
10
import {
11
11
errorPlacementCases ,
@@ -88,21 +88,21 @@ test.describe('Select', {tag: '@Select'}, () => {
88
88
await root . getByTestId ( SelectTestQA . trigger ) . hover ( ) ;
89
89
90
90
await expectScreenshot ( {
91
- screenshotPostfix : 'after hover on trigger' ,
91
+ nameSuffix : 'after hover on trigger' ,
92
92
} ) ;
93
93
94
94
await root . getByTestId ( SelectTestQA . trigger ) . click ( ) ;
95
95
96
96
await expectScreenshot ( {
97
97
component : page ,
98
- screenshotPostfix : 'after click on trigger' ,
98
+ nameSuffix : 'after click on trigger' ,
99
99
} ) ;
100
100
101
101
await page . getByTestId ( getSelectOptionTestQA ( 'val2' ) ) . hover ( ) ;
102
102
103
103
await expectScreenshot ( {
104
104
component : page ,
105
- screenshotPostfix : 'after hover on item' ,
105
+ nameSuffix : 'after hover on item' ,
106
106
} ) ;
107
107
} ) ;
108
108
} ) ;
@@ -113,8 +113,11 @@ test.describe('Select', {tag: '@Select'}, () => {
113
113
hasClear : true ,
114
114
} ,
115
115
{ } ,
116
+ {
117
+ scenarioName : 'clear button' ,
118
+ } ,
116
119
) . forEach ( ( [ title , details , props ] ) => {
117
- test ( `clear button ${ title } ` , details , async ( { mount, expectScreenshot} ) => {
120
+ test ( title , details , async ( { mount, expectScreenshot} ) => {
118
121
const root = await mount (
119
122
< Select { ...props } >
120
123
< Select . Option
@@ -130,13 +133,13 @@ test.describe('Select', {tag: '@Select'}, () => {
130
133
await root . getByTestId ( SelectTestQA . trigger ) . hover ( ) ;
131
134
132
135
await expectScreenshot ( {
133
- screenshotPostfix : 'after hover on trigger' ,
136
+ nameSuffix : 'after hover on trigger' ,
134
137
} ) ;
135
138
136
139
await root . getByTestId ( SelectQa . CLEAR ) . hover ( ) ;
137
140
138
141
await expectScreenshot ( {
139
- screenshotPostfix : 'after hover on clear button' ,
142
+ nameSuffix : 'after hover on clear button' ,
140
143
} ) ;
141
144
} ) ;
142
145
} ) ;
@@ -148,18 +151,27 @@ test.describe('Select', {tag: '@Select'}, () => {
148
151
{
149
152
placeholder : placeholderLabelCases ,
150
153
} ,
154
+ {
155
+ scenarioName : 'empty state' ,
156
+ } ,
151
157
) . forEach ( ( [ title , details , props ] ) => {
152
- test ( `empty state ${ title } ` , details , async ( { mount, expectScreenshot} ) => {
158
+ test ( title , details , async ( { mount, expectScreenshot} ) => {
153
159
await mount ( < Select { ...props } /> ) ;
154
160
155
161
await expectScreenshot ( ) ;
156
162
} ) ;
157
163
} ) ;
158
164
159
- createSmokeScenarios ( defaultProps , {
160
- popupPlacement : popupPlacementCases ,
161
- } ) . forEach ( ( [ title , details , props ] ) => {
162
- test ( `popup placement ${ title } ` , details , async ( { mount, page, expectScreenshot} ) => {
165
+ createSmokeScenarios (
166
+ defaultProps ,
167
+ {
168
+ popupPlacement : popupPlacementCases ,
169
+ } ,
170
+ {
171
+ scenarioName : 'popup placement' ,
172
+ } ,
173
+ ) . forEach ( ( [ title , details , props ] ) => {
174
+ test ( title , details , async ( { mount, page, expectScreenshot} ) => {
163
175
await page . setViewportSize ( { width : 500 , height : 500 } ) ;
164
176
165
177
const root = await mount (
@@ -196,8 +208,11 @@ test.describe('Select', {tag: '@Select'}, () => {
196
208
{
197
209
errorPlacement : errorPlacementCases ,
198
210
} ,
211
+ {
212
+ scenarioName : 'error state' ,
213
+ } ,
199
214
) . forEach ( ( [ title , details , props ] ) => {
200
- test ( `error state ${ title } ` , details , async ( { mount, page, expectScreenshot} ) => {
215
+ test ( title , details , async ( { mount, page, expectScreenshot} ) => {
201
216
await page . setViewportSize ( { width : 500 , height : 500 } ) ;
202
217
203
218
await mount (
@@ -229,8 +244,11 @@ test.describe('Select', {tag: '@Select'}, () => {
229
244
hasCounter : hasCounterCases ,
230
245
validationState : validationStateCases ,
231
246
} ,
247
+ {
248
+ scenarioName : 'multiple' ,
249
+ } ,
232
250
) . forEach ( ( [ title , details , props ] ) => {
233
- test ( `multiple ${ title } ` , details , async ( { mount, page, expectScreenshot} ) => {
251
+ test ( title , details , async ( { mount, page, expectScreenshot} ) => {
234
252
await page . setViewportSize ( { width : 500 , height : 500 } ) ;
235
253
236
254
const root = await mount (
@@ -279,29 +297,35 @@ test.describe('Select', {tag: '@Select'}, () => {
279
297
await root . getByTestId ( SelectTestQA . trigger ) . hover ( ) ;
280
298
281
299
await expectScreenshot ( {
282
- screenshotPostfix : 'after hover on trigger' ,
300
+ nameSuffix : 'after hover on trigger' ,
283
301
} ) ;
284
302
285
303
await root . getByTestId ( SelectTestQA . trigger ) . click ( ) ;
286
304
287
305
await expectScreenshot ( {
288
306
component : page ,
289
- screenshotPostfix : 'after click on trigger' ,
307
+ nameSuffix : 'after click on trigger' ,
290
308
} ) ;
291
309
292
310
await page . getByTestId ( getSelectOptionTestQA ( 'val2' ) ) . hover ( ) ;
293
311
294
312
await expectScreenshot ( {
295
313
component : page ,
296
- screenshotPostfix : 'after hover on item' ,
314
+ nameSuffix : 'after hover on item' ,
297
315
} ) ;
298
316
} ) ;
299
317
} ) ;
300
318
301
- createSmokeScenarios ( defaultProps , {
302
- filterPlaceholder : filterPlaceholderCases ,
303
- } ) . forEach ( ( [ title , details , props ] ) => {
304
- test ( `with filter ${ title } ` , details , async ( { mount, page, expectScreenshot} ) => {
319
+ createSmokeScenarios (
320
+ defaultProps ,
321
+ {
322
+ filterPlaceholder : filterPlaceholderCases ,
323
+ } ,
324
+ {
325
+ scenarioName : 'with filter' ,
326
+ } ,
327
+ ) . forEach ( ( [ title , details , props ] ) => {
328
+ test ( title , details , async ( { mount, page, expectScreenshot} ) => {
305
329
await page . setViewportSize ( { width : 500 , height : 500 } ) ;
306
330
307
331
const root = await mount ( < TestSelectWithFilter { ...props } /> ) ;
@@ -318,7 +342,7 @@ test.describe('Select', {tag: '@Select'}, () => {
318
342
319
343
await expectScreenshot ( {
320
344
component : page ,
321
- screenshotPostfix : 'after type filter value' ,
345
+ nameSuffix : 'after type filter value' ,
322
346
} ) ;
323
347
} ) ;
324
348
} ) ;
0 commit comments