Update key storage toggle when key storage status changes (#30934)

* update key storage toggle when key storage status changes

Listen for the CryptoEvent.KeyBackupStatus event and update the state
when it changes.

* fixup! update key storage toggle when key storage status changes

* add comment about handling event
This commit is contained in:
Hubert Chathi
2025-10-03 09:04:06 -04:00
committed by GitHub
parent da827129c7
commit 5f084c28c3
3 changed files with 69 additions and 22 deletions

View File

@@ -146,6 +146,29 @@ test.describe("Cryptography", function () {
}).toPass();
});
// When the user resets their identity, key storage also gets enabled.
// Check that the toggle updates to show the correct state.
test("Key backup status updates after resetting identity", async ({ page, app, user: aliceCredentials }) => {
await app.client.bootstrapCrossSigning(aliceCredentials);
const encryptionTab = await app.settings.openUserSettings("Encryption");
const keyStorageToggle = encryptionTab.getByRole("switch", { name: "Allow key storage" });
// Check that key storage starts off as disabled
expect(await keyStorageToggle.isChecked()).toBe(false);
// Find "the Reset cryptographic identity" button
await encryptionTab.getByRole("button", { name: "Reset cryptographic identity" }).click();
// Confirm
await encryptionTab.getByRole("button", { name: "Continue" }).click();
// Enter the password
await page.getByPlaceholder("Password").fill(aliceCredentials.password);
await page.getByRole("button", { name: "Continue" }).click();
// Key storage should now be enabled
expect(await keyStorageToggle.isChecked()).toBe(true);
});
test(
"creating a DM should work, being e2e-encrypted / user verification",
{ tag: "@screenshot" },