-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wire up the "Forgot recovery key" button for the "Key storage out of …
…sync" toast (#29138) * Wire up the "Forgot recovery key" button for the "Key storage out of sync" toast * Unused import & fix test * Test 'forgot' variant * Fix dependencies * Add more toast tests * Unused import * Test initialState in Encryption Tab * Let's see if github has any more luck running this test than me * Working playwright test with screenshot * year * Convert playwright test to use the bot client * Disambiguate Co-authored-by: Florian Duros <florianduros@element.io> * Add doc & do other part of rename * Split out into custom hook * Fix tests --------- Co-authored-by: Florian Duros <florianduros@element.io> (cherry picked from commit 9657d39)
- Loading branch information
1 parent
0a8393c
commit 159acef
Showing
13 changed files
with
389 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright 2025 New Vector Ltd. | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial | ||
* Please see LICENSE files in the repository root for full details. | ||
*/ | ||
|
||
import { GeneratedSecretStorageKey } from "matrix-js-sdk/src/crypto-api"; | ||
|
||
import { test, expect } from "../../element-web-test"; | ||
import { createBot, deleteCachedSecrets, logIntoElement } from "./utils"; | ||
|
||
test.describe("Key storage out of sync toast", () => { | ||
let recoveryKey: GeneratedSecretStorageKey; | ||
|
||
test.beforeEach(async ({ page, homeserver, credentials }) => { | ||
const res = await createBot(page, homeserver, credentials); | ||
recoveryKey = res.recoveryKey; | ||
|
||
await logIntoElement(page, credentials, recoveryKey.encodedPrivateKey); | ||
|
||
await deleteCachedSecrets(page); | ||
|
||
// We won't be prompted for crypto setup unless we have an e2e room, so make one | ||
await page.getByRole("button", { name: "Add room" }).click(); | ||
await page.getByRole("menuitem", { name: "New room" }).click(); | ||
await page.getByRole("textbox", { name: "Name" }).fill("Test room"); | ||
await page.getByRole("button", { name: "Create room" }).click(); | ||
}); | ||
|
||
test("should prompt for recovery key if 'enter recovery key' pressed", { tag: "@screenshot" }, async ({ page }) => { | ||
// Need to wait for 2 to appear since playwright only evaluates 'first()' initially, so the waiting won't work | ||
await expect(page.getByRole("alert")).toHaveCount(2); | ||
await expect(page.getByRole("alert").first()).toMatchScreenshot("key-storage-out-of-sync-toast.png"); | ||
|
||
await page.getByRole("button", { name: "Enter recovery key" }).click(); | ||
await page.locator(".mx_Dialog").getByRole("button", { name: "use your Security Key" }).click(); | ||
|
||
await page.getByRole("textbox", { name: "Security key" }).fill(recoveryKey.encodedPrivateKey); | ||
await page.getByRole("button", { name: "Continue" }).click(); | ||
|
||
await expect(page.getByRole("button", { name: "Enter recovery key" })).not.toBeVisible(); | ||
}); | ||
|
||
test("should open settings to reset flow if 'forgot recovery key' pressed", async ({ page, app, credentials }) => { | ||
await expect(page.getByRole("button", { name: "Enter recovery key" })).toBeVisible(); | ||
|
||
await page.getByRole("button", { name: "Forgot recovery key?" }).click(); | ||
|
||
await expect( | ||
page.getByRole("heading", { name: "Forgot your recovery key? You’ll need to reset your identity." }), | ||
).toBeVisible(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+18.7 KB
playwright/snapshots/crypto/toasts.spec.ts/key-storage-out-of-sync-toast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.