Skip to content

Commit b5027fc

Browse files
authored
Merge branch 'develop' into rav/cleanup_modal_onfinished
2 parents 8432f00 + 4bf28f8 commit b5027fc

File tree

44 files changed

+1286
-477
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1286
-477
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ electron/pub
2525
.env
2626
/coverage
2727
# Auto-generated file
28-
/src/modules.ts
2928
/src/modules.js
3029
/build_config.yaml
3130
/book

playwright/e2e/crypto/dehydration.spec.ts

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
88

99
import { test, expect } from "../../element-web-test";
1010
import { isDendrite } from "../../plugins/homeserver/dendrite";
11-
import { completeCreateSecretStorageDialog, createBot, logIntoElement } from "./utils.ts";
11+
import { createBot, logIntoElement } from "./utils.ts";
1212
import { type Client } from "../../pages/client.ts";
1313
import { type ElementAppPage } from "../../pages/ElementAppPage.ts";
1414

@@ -28,21 +28,27 @@ test.describe("Dehydration", () => {
2828
test.skip(isDendrite, "does not yet support dehydration v2");
2929

3030
test("Verify device and reset creates dehydrated device", async ({ page, user, credentials, app }, workerInfo) => {
31-
// Verify the device by resetting the key (which will create SSSS, and dehydrated device)
31+
// Verify the device by resetting the identity key, and then set up recovery (which will create SSSS, and dehydrated device)
3232

3333
const securityTab = await app.settings.openUserSettings("Security & Privacy");
3434
await expect(securityTab.getByText("Offline device enabled")).not.toBeVisible();
3535

3636
await app.closeDialog();
3737

38-
// Verify the device by resetting the key
38+
// Reset the identity key
3939
const settings = await app.settings.openUserSettings("Encryption");
4040
await settings.getByRole("button", { name: "Verify this device" }).click();
4141
await page.getByRole("button", { name: "Proceed with reset" }).click();
4242
await page.getByRole("button", { name: "Continue" }).click();
43-
await page.getByRole("button", { name: "Copy" }).click();
43+
44+
// Set up recovery
45+
await page.getByRole("button", { name: "Set up recovery" }).click();
46+
await page.getByRole("button", { name: "Continue" }).click();
47+
const recoveryKey = await page.getByTestId("recoveryKey").innerText();
4448
await page.getByRole("button", { name: "Continue" }).click();
45-
await page.getByRole("button", { name: "Done" }).click();
49+
await page.getByRole("textbox").fill(recoveryKey);
50+
await page.getByRole("button", { name: "Finish set up" }).click();
51+
await page.getByRole("button", { name: "Close" }).click();
4652

4753
await expectDehydratedDeviceEnabled(app);
4854

@@ -80,7 +86,7 @@ test.describe("Dehydration", () => {
8086
await expectDehydratedDeviceEnabled(app);
8187
});
8288

83-
test("Reset recovery key during login re-creates dehydrated device", async ({
89+
test("Reset identity during login and set up recovery re-creates dehydrated device", async ({
8490
page,
8591
homeserver,
8692
app,
@@ -99,16 +105,26 @@ test.describe("Dehydration", () => {
99105
// Log in our client
100106
await logIntoElement(page, credentials);
101107

102-
// Oh no, we forgot our recovery key
108+
// Oh no, we forgot our recovery key - reset our identity
103109
await page.locator(".mx_AuthPage").getByRole("button", { name: "Reset all" }).click();
104-
await page.locator(".mx_AuthPage").getByRole("button", { name: "Proceed with reset" }).click();
110+
await expect(
111+
page.getByRole("heading", { name: "Are you sure you want to reset your identity?" }),
112+
).toBeVisible();
113+
await page.getByRole("button", { name: "Continue", exact: true }).click();
114+
await page.getByPlaceholder("Password").fill(credentials.password);
115+
await page.getByRole("button", { name: "Continue" }).click();
105116

106-
await completeCreateSecretStorageDialog(page, { accountPassword: credentials.password });
117+
// And set up recovery
118+
const settings = await app.settings.openUserSettings("Encryption");
119+
await settings.getByRole("button", { name: "Set up recovery" }).click();
120+
await settings.getByRole("button", { name: "Continue" }).click();
121+
const recoveryKey = await settings.getByTestId("recoveryKey").innerText();
122+
await settings.getByRole("button", { name: "Continue" }).click();
123+
await settings.getByRole("textbox").fill(recoveryKey);
124+
await settings.getByRole("button", { name: "Finish set up" }).click();
107125

108126
// There should be a brand new dehydrated device
109-
const dehydratedDeviceIds = await getDehydratedDeviceIds(app.client);
110-
expect(dehydratedDeviceIds.length).toBe(1);
111-
expect(dehydratedDeviceIds[0]).not.toEqual(initialDehydratedDeviceIds[0]);
127+
await expectDehydratedDeviceEnabled(app);
112128
});
113129

114130
test("'Reset cryptographic identity' removes dehydrated device", async ({ page, homeserver, app, credentials }) => {

playwright/e2e/left-panel/room-list-panel/room-list-filter-sort.spec.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import { expect, test } from "../../../element-web-test";
9-
import type { Page } from "@playwright/test";
9+
import type { Locator, Page } from "@playwright/test";
1010

1111
test.describe("Room list filters and sort", () => {
1212
test.use({
@@ -18,10 +18,14 @@ test.describe("Room list filters and sort", () => {
1818
labsFlags: ["feature_new_room_list"],
1919
});
2020

21-
function getPrimaryFilters(page: Page) {
21+
function getPrimaryFilters(page: Page): Locator {
2222
return page.getByRole("listbox", { name: "Room list filters" });
2323
}
2424

25+
function getSecondaryFilters(page: Page): Locator {
26+
return page.getByRole("button", { name: "Filter" });
27+
}
28+
2529
/**
2630
* Get the room list
2731
* @param page
@@ -106,6 +110,11 @@ test.describe("Room list filters and sort", () => {
106110
await app.client.evaluate(async (client, favouriteId) => {
107111
await client.setRoomTag(favouriteId, "m.favourite", { order: 0.5 });
108112
}, favouriteId);
113+
114+
const lowPrioId = await app.client.createRoom({ name: "Low prio room" });
115+
await app.client.evaluate(async (client, id) => {
116+
await client.setRoomTag(id, "m.lowpriority", { order: 0.5 });
117+
}, lowPrioId);
109118
});
110119

111120
test("should filter the list (with primary filters)", { tag: "@screenshot" }, async ({ page, app, user }) => {
@@ -137,7 +146,19 @@ test.describe("Room list filters and sort", () => {
137146
await expect(roomList.getByRole("gridcell", { name: "unread room" })).toBeVisible();
138147
await expect(roomList.getByRole("gridcell", { name: "favourite room" })).toBeVisible();
139148
await expect(roomList.getByRole("gridcell", { name: "empty room" })).toBeVisible();
140-
expect(await roomList.locator("role=gridcell").count()).toBe(3);
149+
expect(await roomList.locator("role=gridcell").count()).toBe(4);
150+
});
151+
152+
test("should filter the list (with secondary filters)", { tag: "@screenshot" }, async ({ page, app, user }) => {
153+
const roomList = getRoomList(page);
154+
const secondaryFilters = getSecondaryFilters(page);
155+
await secondaryFilters.click();
156+
157+
await expect(page.getByRole("menu", { name: "Filter" })).toMatchScreenshot("filter-menu.png");
158+
159+
await page.getByRole("menuitem", { name: "Low priority" }).click();
160+
await expect(roomList.getByRole("gridcell", { name: "Low prio room" })).toBeVisible();
161+
expect(await roomList.locator("role=gridcell").count()).toBe(1);
141162
});
142163

143164
test(

playwright/e2e/login/login-consent.spec.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,43 @@ test.describe("Login", () => {
288288
await expect(h1).toBeVisible();
289289
});
290290
});
291+
292+
test("Can reset identity to become verified", async ({ page, homeserver, request, credentials }) => {
293+
// Log in
294+
const res = await request.post(`${homeserver.baseUrl}/_matrix/client/v3/keys/device_signing/upload`, {
295+
headers: { Authorization: `Bearer ${credentials.accessToken}` },
296+
data: DEVICE_SIGNING_KEYS_BODY,
297+
});
298+
if (!res.ok()) {
299+
console.log(`Uploading dummy keys failed with HTTP status ${res.status}`, await res.json());
300+
throw new Error("Uploading dummy keys failed");
301+
}
302+
303+
await page.goto("/");
304+
await login(page, homeserver, credentials);
305+
306+
await expect(page.getByRole("heading", { name: "Verify this device", level: 1 })).toBeVisible();
307+
308+
// Start the reset process
309+
await page.getByRole("button", { name: "Proceed with reset" }).click();
310+
311+
// First try cancelling and restarting
312+
await page.getByRole("button", { name: "Cancel" }).click();
313+
await page.getByRole("button", { name: "Proceed with reset" }).click();
314+
315+
// Then click outside the dialog and restart
316+
await page.getByRole("link", { name: "Powered by Matrix" }).click({ force: true });
317+
await page.getByRole("button", { name: "Proceed with reset" }).click();
318+
319+
// Finally we actually continue
320+
await page.getByRole("button", { name: "Continue" }).click();
321+
await page.getByPlaceholder("Password").fill(credentials.password);
322+
await page.getByRole("button", { name: "Continue" }).click();
323+
324+
// We end up at the Home screen
325+
await expect(page).toHaveURL(/\/#\/home$/, { timeout: 10000 });
326+
await expect(page.getByRole("heading", { name: "Welcome Dave", exact: true })).toBeVisible();
327+
});
291328
});
292329
});
293330

0 commit comments

Comments
 (0)