@@ -176,7 +176,7 @@ describe("Audio player", () => {
176
176
177
177
// Enable high contrast manually
178
178
cy . openUserSettings ( "Appearance" )
179
- . get ( ". mx_ThemeChoicePanel")
179
+ . findByTestId ( " mx_ThemeChoicePanel")
180
180
. findByLabelText ( "Use high contrast" )
181
181
. click ( { force : true } ) ; // force click because the size of the checkbox is zero
182
182
@@ -333,30 +333,33 @@ describe("Audio player", () => {
333
333
334
334
// On a thread
335
335
cy . get ( ".mx_ThreadView" ) . within ( ( ) => {
336
- cy . get ( ".mx_EventTile_last" )
337
- . within ( ( ) => {
338
- // Assert that the player is correctly rendered on a thread
339
- cy . get ( ".mx_EventTile_mediaLine .mx_MAudioBody .mx_AudioPlayer_container" ) . within ( ( ) => {
340
- // Assert that the counter is zero before clicking the play button
341
- cy . contains ( ".mx_AudioPlayer_seek [role='timer']" , "00:00" ) . should ( "exist" ) ;
342
-
343
- // Find and click "Play" button, the wait is to make the test less flaky
344
- cy . findByRole ( "button" , { name : "Play" } ) . should ( "exist" ) ;
345
- cy . wait ( 500 ) . findByRole ( "button" , { name : "Play" } ) . click ( ) ;
346
-
347
- // Assert that "Pause" button can be found
348
- cy . findByRole ( "button" , { name : "Pause" } ) . should ( "exist" ) ;
349
-
350
- // Assert that the timer is reset when the audio file finished playing
351
- cy . contains ( ".mx_AudioPlayer_seek [role='timer']" , "00:00" ) . should ( "exist" ) ;
352
-
353
- // Assert that "Play" button can be found
354
- cy . findByRole ( "button" , { name : "Play" } ) . should ( "exist" ) . should ( "not.have.attr" , "disabled" ) ;
355
- } ) ;
356
- } )
357
- . realHover ( )
358
- . findByRole ( "button" , { name : "Reply" } )
359
- . click ( ) ; // Find and click "Reply" button
336
+ cy . get ( ".mx_EventTile_last" ) . within ( ( ) => {
337
+ // Assert that the player is correctly rendered on a thread
338
+ cy . get ( ".mx_EventTile_mediaLine .mx_MAudioBody .mx_AudioPlayer_container" ) . within ( ( ) => {
339
+ // Assert that the counter is zero before clicking the play button
340
+ cy . contains ( ".mx_AudioPlayer_seek [role='timer']" , "00:00" ) . should ( "exist" ) ;
341
+
342
+ // Find and click "Play" button, the wait is to make the test less flaky
343
+ cy . findByRole ( "button" , { name : "Play" } ) . should ( "exist" ) ;
344
+ cy . wait ( 500 ) . findByRole ( "button" , { name : "Play" } ) . click ( ) ;
345
+
346
+ // Assert that "Pause" button can be found
347
+ cy . findByRole ( "button" , { name : "Pause" } ) . should ( "exist" ) ;
348
+
349
+ // Assert that the timer is reset when the audio file finished playing
350
+ cy . contains ( ".mx_AudioPlayer_seek [role='timer']" , "00:00" ) . should ( "exist" ) ;
351
+
352
+ // Assert that "Play" button can be found
353
+ cy . findByRole ( "button" , { name : "Play" } ) . should ( "exist" ) . should ( "not.have.attr" , "disabled" ) ;
354
+ } ) ;
355
+ } ) ;
356
+
357
+ // Find and click "Reply" button
358
+ //
359
+ // Calling cy.get(".mx_EventTile_last") again here is a workaround for
360
+ // https://github.com/matrix-org/matrix-js-sdk/issues/3394: the event tile may have been re-mounted while
361
+ // the audio was playing.
362
+ cy . get ( ".mx_EventTile_last" ) . realHover ( ) . findByRole ( "button" , { name : "Reply" } ) . click ( ) ;
360
363
361
364
cy . get ( ".mx_MessageComposer--compact" ) . within ( ( ) => {
362
365
// Assert that the reply preview is rendered on the message composer
0 commit comments