mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-10 09:15:16 +00:00
test(backup mas): use checkDeviceIsConnectedKeyBackup instead at looking at the Security & Privacy tab (#29146)
* test(backup mas): use `checkDeviceIsConnectedKeyBackup` instead at looking at the *Security & Privacy* tab * doc(backup mas): fix comment
This commit is contained in:
@@ -11,6 +11,7 @@ import { registerAccountMas } from "../oidc";
|
|||||||
import { isDendrite } from "../../plugins/homeserver/dendrite";
|
import { isDendrite } from "../../plugins/homeserver/dendrite";
|
||||||
import { TestClientServerAPI } from "../csAPI";
|
import { TestClientServerAPI } from "../csAPI";
|
||||||
import { masHomeserver } from "../../plugins/homeserver/synapse/masHomeserver.ts";
|
import { masHomeserver } from "../../plugins/homeserver/synapse/masHomeserver.ts";
|
||||||
|
import { checkDeviceIsConnectedKeyBackup } from "./utils";
|
||||||
|
|
||||||
// These tests register an account with MAS because then we go through the "normal" registration flow
|
// These tests register an account with MAS because then we go through the "normal" registration flow
|
||||||
// and crypto gets set up. Using the 'user' fixture create a user and synthesizes an existing login,
|
// and crypto gets set up. Using the 'user' fixture create a user and synthesizes an existing login,
|
||||||
@@ -24,8 +25,11 @@ test.describe("Encryption state after registration", () => {
|
|||||||
await page.getByRole("button", { name: "Continue" }).click();
|
await page.getByRole("button", { name: "Continue" }).click();
|
||||||
await registerAccountMas(page, mailpitClient, `alice_${testInfo.testId}`, "alice@email.com", "Pa$sW0rD!");
|
await registerAccountMas(page, mailpitClient, `alice_${testInfo.testId}`, "alice@email.com", "Pa$sW0rD!");
|
||||||
|
|
||||||
await app.settings.openUserSettings("Security & Privacy");
|
// Wait for the ui to load
|
||||||
await expect(page.getByText("This session is backing up your keys.")).toBeVisible();
|
await expect(page.locator(".mx_MatrixChat")).toBeVisible();
|
||||||
|
|
||||||
|
// Recovery is not set up yet
|
||||||
|
await checkDeviceIsConnectedKeyBackup(app, "1", true, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("user is prompted to set up recovery", async ({ page, mailpitClient, app }, testInfo) => {
|
test("user is prompted to set up recovery", async ({ page, mailpitClient, app }, testInfo) => {
|
||||||
|
|||||||
@@ -145,11 +145,13 @@ export async function checkDeviceIsCrossSigned(app: ElementAppPage): Promise<voi
|
|||||||
* @param app -` ElementAppPage` wrapper for the playwright `Page`.
|
* @param app -` ElementAppPage` wrapper for the playwright `Page`.
|
||||||
* @param expectedBackupVersion - the version of the backup we expect to be connected to.
|
* @param expectedBackupVersion - the version of the backup we expect to be connected to.
|
||||||
* @param checkBackupPrivateKeyInCache - whether to check that the backup decryption key is cached locally
|
* @param checkBackupPrivateKeyInCache - whether to check that the backup decryption key is cached locally
|
||||||
|
* @param checkBackupKeyIn4S - whether to check that the backup key is stored in 4S
|
||||||
*/
|
*/
|
||||||
export async function checkDeviceIsConnectedKeyBackup(
|
export async function checkDeviceIsConnectedKeyBackup(
|
||||||
app: ElementAppPage,
|
app: ElementAppPage,
|
||||||
expectedBackupVersion: string,
|
expectedBackupVersion: string,
|
||||||
checkBackupPrivateKeyInCache: boolean,
|
checkBackupPrivateKeyInCache: boolean,
|
||||||
|
checkBackupKeyIn4S: boolean = true,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// Sanity check the given backup version: if it's null, something went wrong earlier in the test.
|
// Sanity check the given backup version: if it's null, something went wrong earlier in the test.
|
||||||
if (!expectedBackupVersion) {
|
if (!expectedBackupVersion) {
|
||||||
@@ -192,7 +194,7 @@ export async function checkDeviceIsConnectedKeyBackup(
|
|||||||
// The active backup version is as expected
|
// The active backup version is as expected
|
||||||
expect(activeBackupVersion).toBe(expectedBackupVersion);
|
expect(activeBackupVersion).toBe(expectedBackupVersion);
|
||||||
// The backup key is stored in 4S
|
// The backup key is stored in 4S
|
||||||
expect(backupKeyIn4S).toBe(true);
|
if (checkBackupKeyIn4S) expect(backupKeyIn4S).toBe(true);
|
||||||
|
|
||||||
if (checkBackupPrivateKeyInCache) {
|
if (checkBackupPrivateKeyInCache) {
|
||||||
// The backup key is available locally
|
// The backup key is available locally
|
||||||
|
|||||||
Reference in New Issue
Block a user