From 885d5098ab24e6e56590a012cac537417976e87d Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Tue, 7 Feb 2023 08:45:13 +0100 Subject: [PATCH] Fix flaky test crypto/decryption-failure.spec.ts "Decryption Failure Bar" (#10092) --- cypress/e2e/crypto/decryption-failure.spec.ts | 13 +++++++------ cypress/support/bot.ts | 2 ++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cypress/e2e/crypto/decryption-failure.spec.ts b/cypress/e2e/crypto/decryption-failure.spec.ts index 5f0a9056ad..b9e3265b76 100644 --- a/cypress/e2e/crypto/decryption-failure.spec.ts +++ b/cypress/e2e/crypto/decryption-failure.spec.ts @@ -52,6 +52,8 @@ const handleVerificationRequest = (request: VerificationRequest): Chainable { }) .then(() => { cy.botSendMessage(bot, roomId, "test"); - cy.wait(5000); - cy.get(".mx_DecryptionFailureBar .mx_DecryptionFailureBar_message_headline").should( - "have.text", + cy.contains( + ".mx_DecryptionFailureBar .mx_DecryptionFailureBar_message_headline", "Verify this device to access all messages", ); @@ -124,6 +125,7 @@ describe("Decryption Failure Bar", () => { const verificationRequestPromise = waitForVerificationRequest(otherDevice); cy.get(".mx_CompleteSecurity_actionRow .mx_AccessibleButton").click(); + cy.contains("To proceed, please accept the verification request on your other device."); cy.wrap(verificationRequestPromise).then((verificationRequest: VerificationRequest) => { cy.wrap(verificationRequest.accept()); handleVerificationRequest(verificationRequest).then((emojis) => { @@ -170,9 +172,8 @@ describe("Decryption Failure Bar", () => { ); cy.botSendMessage(bot, roomId, "test"); - cy.wait(5000); - cy.get(".mx_DecryptionFailureBar .mx_DecryptionFailureBar_message_headline").should( - "have.text", + cy.contains( + ".mx_DecryptionFailureBar .mx_DecryptionFailureBar_message_headline", "Reset your keys to prevent future decryption errors", ); diff --git a/cypress/support/bot.ts b/cypress/support/bot.ts index 9cb5e472de..2799927916 100644 --- a/cypress/support/bot.ts +++ b/cypress/support/bot.ts @@ -163,6 +163,8 @@ function setupBotClient( } }) .then(() => cli), + // extra timeout, as this sometimes takes a while + { timeout: 30_000 }, ); }); }