@@ -133,7 +133,13 @@ test("record, preview, send and play the chat card with speed and seeking", {
133133 tag : "@media-recorder" ,
134134} , async ( { page } ) => {
135135 const errors = watchPageErrors ( page ) ;
136+ const initialCard = page
137+ . getByRole ( "group" , { name : "Voice note" , exact : true } )
138+ . first ( ) ;
139+ await expect ( initialCard . locator ( "audio" ) ) . toHaveJSProperty ( "readyState" , 0 ) ;
140+ await expect ( initialCard . getByRole ( "slider" ) ) . toBeDisabled ( ) ;
136141 await record ( page ) ;
142+ await expect ( page . getByRole ( "textbox" ) ) . toBeFocused ( ) ;
137143 const composer = page . getByRole ( "form" , {
138144 name : "Send a message to general" ,
139145 } ) ;
@@ -212,6 +218,7 @@ test("record, preview, send and play the chat card with speed and seeking", {
212218 await expect ( speedButton ) . toHaveCSS ( "color" , "rgb(255, 255, 255)" ) ;
213219 await firstCard . hover ( ) ;
214220 await expect ( speedButton ) . toHaveCSS ( "color" , "rgb(255, 255, 255)" ) ;
221+ await expect ( firstCard . getByRole ( "slider" ) ) . toBeEnabled ( ) ;
215222 await firstCard . getByRole ( "slider" ) . fill ( "1" ) ;
216223 await expect
217224 . poll ( ( ) =>
@@ -240,15 +247,20 @@ test("permission cancellation, denial and plugin removal release microphones", {
240247 await page . evaluate ( ( ) => {
241248 window . voiceMic . mode = "delay" ;
242249 } ) ;
243- await page
244- . getByRole ( "button" , { name : "Record voice note" , exact : true } )
245- . click ( ) ;
250+ const recordButton = page . getByRole ( "button" , {
251+ name : "Record voice note" ,
252+ exact : true ,
253+ } ) ;
254+ await recordButton . focus ( ) ;
255+ await page . keyboard . press ( "Enter" ) ;
246256 await expect (
247257 page . getByRole ( "status" ) . filter ( { hasText : "Waiting for microphone…" } ) ,
248258 ) . toBeVisible ( ) ;
249- await page
250- . getByRole ( "button" , { name : "Discard voice note" , exact : true } )
251- . click ( ) ;
259+ await expect (
260+ page . getByRole ( "button" , { name : "Discard voice note" , exact : true } ) ,
261+ ) . toBeFocused ( ) ;
262+ await page . keyboard . press ( "Enter" ) ;
263+ await expect ( page . getByRole ( "textbox" ) ) . toBeFocused ( ) ;
252264 await page . evaluate ( ( ) => window . voiceMic . release ( ) ) ;
253265 await expect . poll ( ( ) => page . evaluate ( ( ) => window . voiceMic . stopped ) ) . toBe ( 1 ) ;
254266 await page . evaluate ( ( ) => {
@@ -258,7 +270,11 @@ test("permission cancellation, denial and plugin removal release microphones", {
258270 . getByRole ( "button" , { name : "Record voice note" , exact : true } )
259271 . click ( ) ;
260272 await expect ( page . getByRole ( "alert" ) ) . toContainText ( "Allow Buzz" ) ;
261- await page . getByRole ( "button" , { name : "Close" , exact : true } ) . click ( ) ;
273+ await expect (
274+ page . getByRole ( "button" , { name : "Close" , exact : true } ) ,
275+ ) . toBeFocused ( ) ;
276+ await page . keyboard . press ( "Enter" ) ;
277+ await expect ( page . getByRole ( "textbox" ) ) . toBeFocused ( ) ;
262278 await page . evaluate ( ( ) => {
263279 window . voiceMic . mode = "allow" ;
264280 } ) ;
@@ -270,11 +286,15 @@ test("permission cancellation, denial and plugin removal release microphones", {
270286 ) . toBeEnabled ( ) ;
271287 await page
272288 . getByRole ( "button" , { name : "Disable Voice Notes" , exact : true } )
273- . click ( ) ;
289+ . focus ( ) ;
290+ await page . keyboard . press ( "Enter" ) ;
274291 await expect (
275292 page . getByRole ( "button" , { name : "Finish voice note" , exact : true } ) ,
276293 ) . toHaveCount ( 0 ) ;
277294 await expect . poll ( ( ) => page . evaluate ( ( ) => window . voiceMic . stopped ) ) . toBe ( 2 ) ;
295+ await expect (
296+ page . getByRole ( "button" , { name : "Enable Voice Notes" , exact : true } ) ,
297+ ) . toBeFocused ( ) ;
278298 expect ( await page . evaluate ( ( ) => window . voiceFixture . report . published ) ) . toBe (
279299 0 ,
280300 ) ;
0 commit comments