Cypress: workaround for EventTile being remounted (#10961)

(Hopefully) fixes https://github.com/vector-im/element-web/issues/25417
This commit is contained in:
Richard van der Hoff 2023-05-23 11:09:31 +01:00 committed by GitHub
parent f9e99ed302
commit 7c34d66bde
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -333,8 +333,7 @@ describe("Audio player", () => {
// On a thread // On a thread
cy.get(".mx_ThreadView").within(() => { cy.get(".mx_ThreadView").within(() => {
cy.get(".mx_EventTile_last") cy.get(".mx_EventTile_last").within(() => {
.within(() => {
// Assert that the player is correctly rendered on a thread // Assert that the player is correctly rendered on a thread
cy.get(".mx_EventTile_mediaLine .mx_MAudioBody .mx_AudioPlayer_container").within(() => { cy.get(".mx_EventTile_mediaLine .mx_MAudioBody .mx_AudioPlayer_container").within(() => {
// Assert that the counter is zero before clicking the play button // Assert that the counter is zero before clicking the play button
@ -353,10 +352,14 @@ describe("Audio player", () => {
// Assert that "Play" button can be found // Assert that "Play" button can be found
cy.findByRole("button", { name: "Play" }).should("exist").should("not.have.attr", "disabled"); cy.findByRole("button", { name: "Play" }).should("exist").should("not.have.attr", "disabled");
}); });
}) });
.realHover()
.findByRole("button", { name: "Reply" }) // Find and click "Reply" button
.click(); // Find and click "Reply" button //
// Calling cy.get(".mx_EventTile_last") again here is a workaround for
// https://github.com/matrix-org/matrix-js-sdk/issues/3394: the event tile may have been re-mounted while
// the audio was playing.
cy.get(".mx_EventTile_last").realHover().findByRole("button", { name: "Reply" }).click();
cy.get(".mx_MessageComposer--compact").within(() => { cy.get(".mx_MessageComposer--compact").within(() => {
// Assert that the reply preview is rendered on the message composer // Assert that the reply preview is rendered on the message composer