1
0
mirror of https://github.com/element-hq/element-web.git synced 2025-08-08 03:42:14 +03:00

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
This commit is contained in:
Florian Duros
2025-03-27 12:35:54 +01:00
committed by GitHub
parent 0c210b9b3a
commit a5673f603f
2 changed files with 18 additions and 6 deletions

View File

@@ -162,6 +162,7 @@ test.describe("Cryptography", function () {
}
test("Can reset cross-signing keys", async ({ page, app, user: aliceCredentials }) => {
await app.client.bootstrapCrossSigning(aliceCredentials);
const secretStorageKey = await enableKeyBackup(app);
// Fetch the current cross-signing keys

View File

@@ -292,17 +292,28 @@ export async function doTwoWaySasVerification(page: Page, verifier: JSHandle<Ver
}
/**
* Open the security settings and enable secure key backup.
*
* Assumes that the current device has been cross-signed (which means that we skip a step where we set it up).
* Open the encryption settings and enable key storage and recovery
* Assumes that the current device has been verified
*
* Returns the recovery key
*/
export async function enableKeyBackup(app: ElementAppPage): Promise<string> {
await app.settings.openUserSettings("Security & Privacy");
await app.page.getByRole("button", { name: "Set up Secure Backup" }).click();
const encryptionTab = await app.settings.openUserSettings("Encryption");
return await completeCreateSecretStorageDialog(app.page);
const keyStorageToggle = encryptionTab.getByRole("checkbox", { name: "Allow key storage" });
if (!(await keyStorageToggle.isChecked())) {
await encryptionTab.getByRole("checkbox", { name: "Allow key storage" }).click();
}
await encryptionTab.getByRole("button", { name: "Set up recovery" }).click();
await encryptionTab.getByRole("button", { name: "Continue" }).click();
const recoveryKey = await encryptionTab.getByTestId("recoveryKey").innerText();
await encryptionTab.getByRole("button", { name: "Continue" }).click();
await encryptionTab.getByRole("textbox").fill(recoveryKey);
await encryptionTab.getByRole("button", { name: "Finish set up" }).click();
await app.settings.closeDialog();
return recoveryKey;
}
/**