@@ -154,7 +154,7 @@ configs({ modes: ['ionic-md'] }).forEach(({ title, screenshot, config }) => {
154
154
await expect ( input ) . toHaveScreenshot ( screenshot ( `input-with-clear-button` ) ) ;
155
155
} ) ;
156
156
157
- test ( 'should not have visual regressions when clear button is focused' , async ( { page } ) => {
157
+ test ( 'should not have visual regressions when clear button is focused' , async ( { page, pageUtils } ) => {
158
158
// extra padding around input ensures focus ring doesn't get cut off at screenshot edges
159
159
await page . setContent (
160
160
`
@@ -180,9 +180,7 @@ configs({ modes: ['ionic-md'] }).forEach(({ title, screenshot, config }) => {
180
180
await input . evaluate ( ( el : HTMLIonInputElement ) => el . setFocus ( ) ) ;
181
181
await page . waitForChanges ( ) ;
182
182
183
- const clearButton = input . locator ( '.input-clear-icon' ) ;
184
- clearButton . evaluate ( ( el : HTMLElement ) => el . classList . add ( 'ion-focused' ) ) ;
185
- await page . waitForChanges ( ) ;
183
+ await pageUtils . pressKeys ( 'Tab' ) ;
186
184
187
185
const container = page . locator ( '#container' ) ;
188
186
await expect ( container ) . toHaveScreenshot ( screenshot ( `input-clear-button-focused` ) ) ;
@@ -192,7 +190,7 @@ configs({ modes: ['ionic-md'] }).forEach(({ title, screenshot, config }) => {
192
190
193
191
configs ( { modes : [ 'ionic-md' ] , directions : [ 'ltr' ] } ) . forEach ( ( { title, config } ) => {
194
192
test . describe ( title ( 'input: clear button in ionic theme, functionality checks' ) , ( ) => {
195
- test ( 'should show clear button when any part of input is focused' , async ( { page } ) => {
193
+ test ( 'should show clear button when any part of input is focused' , async ( { page, pageUtils } ) => {
196
194
await page . setContent (
197
195
`
198
196
<ion-input
@@ -214,7 +212,7 @@ configs({ modes: ['ionic-md'], directions: ['ltr'] }).forEach(({ title, config }
214
212
await expect ( clearButton ) . toBeVisible ( ) ;
215
213
216
214
// ensure blurring native input doesn't immediately hide clear button
217
- await page . keyboard . press ( 'Tab' ) ;
215
+ await pageUtils . pressKeys ( 'Tab' ) ;
218
216
await expect ( clearButton ) . toBeFocused ( ) ;
219
217
await expect ( clearButton ) . toBeVisible ( ) ;
220
218
} ) ;
0 commit comments