@@ -96,20 +96,26 @@ test("Social Security", async ({ page }, testInfo) => {
9696 await page
9797 . getByRole ( "textbox" , { name : "City of birth" } )
9898 . fill ( "Springfield" ) ;
99- await page . getByRole ( "combobox" , { name : "Country" } ) . click ( ) ;
100- await page . getByRole ( "combobox" , { name : "Country" } ) . fill ( "can" ) ;
101- await page . getByRole ( "option" , { name : "Canada" } ) . click ( ) ;
102- await expect ( page . getByRole ( "combobox" , { name : "State" } ) ) . toHaveCount ( 0 ) ;
10399
104- await page . getByRole ( "combobox" , { name : "Country" } ) . click ( ) ;
105- await page . getByRole ( "combobox" , { name : "Country" } ) . fill ( "unite" ) ;
106- await page
107- . getByRole ( "option" , { name : "United States of America" } )
108- . click ( ) ;
109- await expect ( page . getByRole ( "combobox" , { name : "State" } ) ) . toBeVisible ( ) ;
110- await page . getByRole ( "combobox" , { name : "State" } ) . click ( ) ;
111- await page . getByRole ( "combobox" , { name : "State" } ) . fill ( "mas" ) ;
112- await page . getByRole ( "option" , { name : "Massachusetts" } ) . click ( ) ;
100+ const countryCombobox = page . getByRole ( "combobox" , { name : "Country" } ) ;
101+ await countryCombobox . fill ( "canada" ) ;
102+ await countryCombobox . press ( "ArrowDown" ) ;
103+ await countryCombobox . press ( "Enter" ) ;
104+ await expect ( countryCombobox ) . toHaveValue ( "Canada" ) ;
105+
106+ const stateCombobox = page . getByRole ( "combobox" , { name : "State" } ) ;
107+ await expect ( stateCombobox ) . toHaveCount ( 0 ) ;
108+
109+ await countryCombobox . fill ( "united sta" ) ;
110+ await countryCombobox . press ( "ArrowDown" ) ;
111+ await countryCombobox . press ( "Enter" ) ;
112+ await expect ( countryCombobox ) . toHaveValue ( "United States of America" ) ;
113+
114+ await expect ( stateCombobox ) . toBeVisible ( ) ;
115+ await stateCombobox . fill ( "mas" ) ;
116+ await stateCombobox . press ( "ArrowDown" ) ;
117+ await stateCombobox . press ( "Enter" ) ;
118+ await expect ( stateCombobox ) . toHaveValue ( "Massachusetts" ) ;
113119
114120 await page . getByRole ( "button" , { name : "Continue" } ) . click ( ) ;
115121 } ) ;
@@ -285,9 +291,14 @@ test("Social Security", async ({ page }, testInfo) => {
285291 . getByRole ( "textbox" , { name : "Street address" } )
286292 . fill ( "200 Oak St" ) ;
287293 await page . getByRole ( "textbox" , { name : "City" } ) . fill ( "Boston" ) ;
288- await page . getByRole ( "combobox" , { name : "State" } ) . click ( ) ;
289- await page . getByRole ( "combobox" , { name : "State" } ) . fill ( "ma" ) ;
290- await page . getByRole ( "option" , { name : "Massachusetts" } ) . click ( ) ;
294+
295+ const stateCombobox = page . getByRole ( "combobox" , { name : "State" } ) ;
296+ await stateCombobox . click ( ) ;
297+ await stateCombobox . fill ( "mass" ) ;
298+ await stateCombobox . press ( "ArrowDown" ) ;
299+ await stateCombobox . press ( "Enter" ) ;
300+ await expect ( stateCombobox ) . toHaveValue ( "Massachusetts" ) ;
301+
291302 await page . getByRole ( "textbox" , { name : "ZIP" } ) . fill ( "02110" ) ;
292303 await page . getByRole ( "button" , { name : "Continue" } ) . click ( ) ;
293304 } ) ;
0 commit comments