From 0a52b7c488a9adbc8860fce645958f5972003e41 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Thu, 9 Jan 2025 17:28:29 +0100 Subject: [PATCH] Update tests --- playwright/e2e/settings/encryption-user-tab/index.ts | 11 +++++------ .../e2e/settings/encryption-user-tab/recovery.spec.ts | 5 ++++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/playwright/e2e/settings/encryption-user-tab/index.ts b/playwright/e2e/settings/encryption-user-tab/index.ts index 9fb009ef4d2..70f0e0e6171 100644 --- a/playwright/e2e/settings/encryption-user-tab/index.ts +++ b/playwright/e2e/settings/encryption-user-tab/index.ts @@ -68,14 +68,13 @@ class Helpers { } /** - * Delete the key backup for the given version - * @param backupVersion + * Set the default key id of the secret storage at null */ - async deleteKeyBackup(backupVersion: string) { + async removeSecretStorageDefaultKeyId() { const client = await this.app.client.prepareClient(); - await client.evaluate(async (client, backupVersion) => { - await client.getCrypto()?.deleteKeyBackupVersion(backupVersion); - }, backupVersion); + await client.evaluate(async (client) => { + await client.secretStorage.setDefaultKeyId(null); + }); } /** diff --git a/playwright/e2e/settings/encryption-user-tab/recovery.spec.ts b/playwright/e2e/settings/encryption-user-tab/recovery.spec.ts index 4e15bc90e06..5fb07f4d214 100644 --- a/playwright/e2e/settings/encryption-user-tab/recovery.spec.ts +++ b/playwright/e2e/settings/encryption-user-tab/recovery.spec.ts @@ -79,7 +79,7 @@ test.describe("Recovery section in Encryption tab", () => { test("should setup the recovery key", { tag: "@screenshot" }, async ({ page, app, util }) => { await verifySession(app, "new passphrase"); - await util.deleteKeyBackup(expectedBackupVersion); + await util.removeSecretStorageDefaultKeyId(); // The key backup is deleted and the user needs to set it up const dialog = await util.openEncryptionTab(); @@ -104,6 +104,9 @@ test.describe("Recovery section in Encryption tab", () => { // Confirm the recovery key await util.confirmRecoveryKey("set-up-key-3-encryption-tab.png"); + // The recovery key is now set up and the user can change it + await expect(dialog.getByRole("button", { name: "Change recovery key" })).toBeVisible(); + await app.closeDialog(); // Check that the current device is connected to key backup and the backup version is the expected one await checkDeviceIsConnectedKeyBackup(page, "2", true);