From e9abc5586915a61645710ad8e8b94811f78064bf Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 20 Jun 2024 16:38:03 +0100 Subject: [PATCH] Work around rust crypto bug which causes flakiness (#12656) * Work around rust crypto bug which causes flakiness Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add comment Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update playwright/e2e/crypto/crypto.spec.ts Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> --- playwright/e2e/crypto/crypto.spec.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/playwright/e2e/crypto/crypto.spec.ts b/playwright/e2e/crypto/crypto.spec.ts index 8cac8abcb8..4ce2f44306 100644 --- a/playwright/e2e/crypto/crypto.spec.ts +++ b/playwright/e2e/crypto/crypto.spec.ts @@ -451,6 +451,7 @@ test.describe("Cryptography", function () { homeserver, user: aliceCredentials, }) => { + test.slow(); const securityKey = await enableKeyBackup(app); // bob sends a valid event @@ -468,6 +469,15 @@ test.describe("Cryptography", function () { /* log out, and back in */ await logOutOfElement(page); + // Reload to work around a Rust crypto bug where it can hold onto the indexeddb even after logout + // https://github.com/element-hq/element-web/issues/25779 + await page.addInitScript(() => { + // When we reload, the initScript created by the `user`/`pageWithCredentials` fixtures + // will re-inject the original credentials into localStorage, which we don't want. + // To work around, we add a second initScript which will clear localStorage again. + window.localStorage.clear(); + }); + await page.reload(); await logIntoElement(page, homeserver, aliceCredentials, securityKey); /* go back to the test room and find Bob's message again */