Skip to content

Commit a5673f6

Browse files
authored
e2e test: use encryption tab in enableKeyBackup instead of security & settings tab (#29234)
* test(e2e crypto): use encryption tab in `enableKeyBackup` instead of security & settings tab * test(e2e crypto): verify device before trying to enable key backup * doc: improve `enableKeyBackup` documentation
1 parent 0c210b9 commit a5673f6

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

playwright/e2e/crypto/crypto.spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ test.describe("Cryptography", function () {
162162
}
163163

164164
test("Can reset cross-signing keys", async ({ page, app, user: aliceCredentials }) => {
165+
await app.client.bootstrapCrossSigning(aliceCredentials);
165166
const secretStorageKey = await enableKeyBackup(app);
166167

167168
// Fetch the current cross-signing keys

playwright/e2e/crypto/utils.ts

+17-6
Original file line numberDiff line numberDiff line change
@@ -292,17 +292,28 @@ export async function doTwoWaySasVerification(page: Page, verifier: JSHandle<Ver
292292
}
293293

294294
/**
295-
* Open the security settings and enable secure key backup.
296-
*
297-
* Assumes that the current device has been cross-signed (which means that we skip a step where we set it up).
295+
* Open the encryption settings and enable key storage and recovery
296+
* Assumes that the current device has been verified
298297
*
299298
* Returns the recovery key
300299
*/
301300
export async function enableKeyBackup(app: ElementAppPage): Promise<string> {
302-
await app.settings.openUserSettings("Security & Privacy");
303-
await app.page.getByRole("button", { name: "Set up Secure Backup" }).click();
301+
const encryptionTab = await app.settings.openUserSettings("Encryption");
302+
303+
const keyStorageToggle = encryptionTab.getByRole("checkbox", { name: "Allow key storage" });
304+
if (!(await keyStorageToggle.isChecked())) {
305+
await encryptionTab.getByRole("checkbox", { name: "Allow key storage" }).click();
306+
}
304307

305-
return await completeCreateSecretStorageDialog(app.page);
308+
await encryptionTab.getByRole("button", { name: "Set up recovery" }).click();
309+
await encryptionTab.getByRole("button", { name: "Continue" }).click();
310+
311+
const recoveryKey = await encryptionTab.getByTestId("recoveryKey").innerText();
312+
await encryptionTab.getByRole("button", { name: "Continue" }).click();
313+
await encryptionTab.getByRole("textbox").fill(recoveryKey);
314+
await encryptionTab.getByRole("button", { name: "Finish set up" }).click();
315+
await app.settings.closeDialog();
316+
return recoveryKey;
306317
}
307318

308319
/**

0 commit comments

Comments
 (0)