Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
florianduros committed Jan 9, 2025
1 parent 0c18708 commit 0a52b7c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
11 changes: 5 additions & 6 deletions playwright/e2e/settings/encryption-user-tab/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}

/**
Expand Down
5 changes: 4 additions & 1 deletion playwright/e2e/settings/encryption-user-tab/recovery.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down

0 comments on commit 0a52b7c

Please sign in to comment.