diff --git a/playwright/e2e/crypto/utils.ts b/playwright/e2e/crypto/utils.ts index 070e615e874..907aa94a28a 100644 --- a/playwright/e2e/crypto/utils.ts +++ b/playwright/e2e/crypto/utils.ts @@ -103,12 +103,29 @@ export async function checkDeviceIsCrossSigned(app: ElementAppPage): Promise { await page.getByRole("button", { name: "User menu" }).click(); await page.locator(".mx_UserMenu_contextMenu").getByRole("menuitem", { name: "Security & Privacy" }).click(); await expect(page.locator(".mx_Dialog").getByRole("button", { name: "Restore from Backup" })).toBeVisible(); + + // expand the advanced section to see the active version in the reports + const summary = page.locator(".mx_SecureBackupPanel_advanced"); + await summary.locator("..").click(); + + const cacheDecryptionKeyStatusElement = page.locator(".mx_SecureBackupPanel_statusList tr:nth-child(2) td"); + await expect(cacheDecryptionKeyStatusElement).toHaveText("cached locally, well formed"); + + const serverVersion = await page.locator(".mx_SecureBackupPanel_statusList tr:nth-child(5) td").textContent(); + expect(serverVersion.trim()).toBe(expectedBackupVersion + " (Algorithm: m.megolm_backup.v1.curve25519-aes-sha2)"); + + const activeVersion = await page.locator(".mx_SecureBackupPanel_statusList tr:nth-child(6) td").textContent(); + expect(activeVersion.trim()).toBe(expectedBackupVersion); } /** diff --git a/playwright/e2e/crypto/verification.spec.ts b/playwright/e2e/crypto/verification.spec.ts index fc499f3f726..dbe0ace981a 100644 --- a/playwright/e2e/crypto/verification.spec.ts +++ b/playwright/e2e/crypto/verification.spec.ts @@ -32,6 +32,7 @@ import { Bot } from "../../pages/bot"; test.describe("Device verification", () => { let aliceBotClient: Bot; + let expectedBackupVersion: string; test.beforeEach(async ({ page, homeserver, credentials }) => { // Visit the login page of the app, to load the matrix sdk @@ -49,7 +50,10 @@ test.describe("Device verification", () => { bootstrapSecretStorage: true, }); aliceBotClient.setCredentials(credentials); - await aliceBotClient.prepareClient(); + const mxClientHandle = await aliceBotClient.prepareClient(); + expectedBackupVersion = await mxClientHandle.evaluate(async (mxClient) => { + return await mxClient.getCrypto()!.getActiveSessionBackupVersion(); + }); await page.waitForTimeout(20000); }); @@ -87,7 +91,7 @@ test.describe("Device verification", () => { await checkDeviceIsCrossSigned(app); // Check that the current device is connected to key backup - await checkDeviceIsConnectedKeyBackup(page); + await checkDeviceIsConnectedKeyBackup(page, expectedBackupVersion); }); test("Verify device with QR code during login", async ({ page, app, credentials, homeserver }) => { @@ -130,7 +134,7 @@ test.describe("Device verification", () => { await checkDeviceIsCrossSigned(app); // Check that the current device is connected to key backup - await checkDeviceIsConnectedKeyBackup(page); + await checkDeviceIsConnectedKeyBackup(page, expectedBackupVersion); }); test("Verify device with Security Phrase during login", async ({ page, app, credentials, homeserver }) => { @@ -150,7 +154,7 @@ test.describe("Device verification", () => { await checkDeviceIsCrossSigned(app); // Check that the current device is connected to key backup - await checkDeviceIsConnectedKeyBackup(page); + await checkDeviceIsConnectedKeyBackup(page, expectedBackupVersion); }); test("Verify device with Security Key during login", async ({ page, app, credentials, homeserver }) => { @@ -172,7 +176,7 @@ test.describe("Device verification", () => { await checkDeviceIsCrossSigned(app); // Check that the current device is connected to key backup - await checkDeviceIsConnectedKeyBackup(page); + await checkDeviceIsConnectedKeyBackup(page, expectedBackupVersion); }); test("Handle incoming verification request with SAS", async ({ page, credentials, homeserver, toasts }) => {