Skip to content

Commit f712fcd

Browse files
committed
playwright: test for verifying from Settings
1 parent c1e7d82 commit f712fcd

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

playwright/e2e/crypto/device-verification.spec.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,34 @@ test.describe("Device verification", { tag: "@no-webkit" }, () => {
174174
await enterRecoveryKeyAndCheckVerified(page, app, recoveryKey);
175175
});
176176

177-
/** Helper for the two tests above which verify by recovery key */
177+
test("Verify device with Recovery Key from settings", async ({ page, app, credentials }) => {
178+
const recoveryKey = (await aliceBotClient.getRecoveryKey()).encodedPrivateKey;
179+
180+
await logIntoElement(page, credentials);
181+
182+
/* Dismiss "Verify this device" */
183+
const authPage = page.locator(".mx_AuthPage");
184+
await authPage.getByRole("button", { name: "Skip verification for now" }).click();
185+
await authPage.getByRole("button", { name: "I'll verify later" }).click();
186+
await page.waitForSelector(".mx_MatrixChat");
187+
188+
const settings = await app.settings.openUserSettings("Encryption");
189+
await settings.getByRole("button", { name: "Verify this device" }).click();
190+
await enterRecoveryKeyAndCheckVerified(page, app, recoveryKey);
191+
});
192+
193+
/** Helper for the three tests above which verify by recovery key */
178194
async function enterRecoveryKeyAndCheckVerified(page: Page, app: ElementAppPage, recoveryKey: string) {
179-
await page.locator(".mx_AuthPage").getByRole("button", { name: "Verify with Recovery Key or Phrase" }).click();
195+
await page.getByRole("button", { name: "Verify with Recovery Key or Phrase" }).click();
180196

181197
// Enter the recovery key
182198
const dialog = page.locator(".mx_Dialog");
183-
await dialog.locator("textarea").fill(recoveryKey);
199+
// We use `pressSequentially` here to make sure that the FocusLock isn't causing us any problems
200+
// (cf https://github.com/element-hq/element-web/issues/30089)
201+
await dialog.locator("textarea").pressSequentially(recoveryKey);
184202
await dialog.getByRole("button", { name: "Continue", disabled: false }).click();
185203

186-
await page.locator(".mx_AuthPage").getByRole("button", { name: "Done" }).click();
204+
await page.getByRole("button", { name: "Done" }).click();
187205

188206
// Check that our device is now cross-signed
189207
await checkDeviceIsCrossSigned(app);

0 commit comments

Comments
 (0)