Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
2.9 KiB
TypeScript
Raw Permalink Normal View History

2024-02-02 12:43:59 +01:00
/*
2024-09-09 14:57:16 +01:00
Copyright 2024 New Vector Ltd.
2024-02-02 12:43:59 +01:00
Copyright 2024 The Matrix.org Foundation C.I.C.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
2024-09-09 14:57:16 +01:00
Please see LICENSE files in the repository root for full details.
2024-02-02 12:43:59 +01:00
*/
import { test, expect } from "../../element-web-test";
import { createRoom, enableKeyBackup, logIntoElement, sendMessageInCurrentRoom } from "./utils";
import { isDendrite } from "../../plugins/homeserver/dendrite";
2024-02-02 12:43:59 +01:00
test.describe("Logout tests", () => {
test.skip(isDendrite, "Dendrite lacks support for MSC3967 so requires additional auth here");
2024-02-02 12:43:59 +01:00
test.beforeEach(async ({ page, homeserver, credentials }) => {
await logIntoElement(page, credentials);
2024-02-02 12:43:59 +01:00
});
test("Ask to set up recovery on logout if not setup", async ({ page, app }) => {
await createRoom(page, "E2e room", true);
// send a message (will be the first one so will create a new megolm session)
await sendMessageInCurrentRoom(page, "Hello secret world");
const locator = await app.settings.openUserMenu();
2026-05-06 09:34:36 +01:00
await locator.getByRole("menuitem", { name: "All settings", exact: true }).click();
await page.getByRole("button", { name: "Remove this device", exact: true }).click();
2024-02-02 12:43:59 +01:00
const currentDialogLocator = page.locator(".mx_Dialog");
await expect(
currentDialogLocator.getByRole("heading", { name: "You're about to lose access to your encrypted chats" }),
2024-02-02 12:43:59 +01:00
).toBeVisible();
});
test("If backup is set up show standard confirm", async ({ page, app }) => {
await enableKeyBackup(app);
2024-02-02 12:43:59 +01:00
await createRoom(page, "E2e room", true);
// send a message (will be the first one so will create a new megolm session)
await sendMessageInCurrentRoom(page, "Hello secret world");
const locator = await app.settings.openUserMenu();
2026-05-06 09:34:36 +01:00
await locator.getByRole("menuitem", { name: "All settings", exact: true }).click();
await page.getByRole("button", { name: "Remove this device", exact: true }).click();
2024-02-02 12:43:59 +01:00
const currentDialogLocator = page.locator(".mx_Dialog");
2026-03-18 16:53:28 +01:00
await expect(currentDialogLocator.getByText("Are you sure you want to Remove this device?")).toBeVisible();
2024-02-02 12:43:59 +01:00
});
test("Ask to set up recovery on logout even if not in encrypted room", async ({ page, app }) => {
2024-02-02 12:43:59 +01:00
await createRoom(page, "Clear room", false);
await sendMessageInCurrentRoom(page, "Hello public world!");
const locator = await app.settings.openUserMenu();
2026-05-06 09:34:36 +01:00
await locator.getByRole("menuitem", { name: "All settings", exact: true }).click();
await page.getByRole("button", { name: "Remove this device", exact: true }).click();
2024-02-02 12:43:59 +01:00
const currentDialogLocator = page.locator(".mx_Dialog");
await expect(
currentDialogLocator.getByRole("heading", { name: "You're about to lose access to your encrypted chats" }),
).toBeVisible();
2024-02-02 12:43:59 +01:00
});
});