Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 5d6b8b6

Browse files
committed
Merge branch 'develop' into midhun/add-tabs-to-rightpanel
2 parents 0f4eb23 + b2a8915 commit 5d6b8b6

File tree

123 files changed

+2883
-1347
lines changed

Some content is hidden

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

123 files changed

+2883
-1347
lines changed

.eslintrc.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ module.exports = {
7878
name: "matrix-react-sdk/",
7979
message: "Please use matrix-react-sdk/src/index instead",
8080
},
81+
{
82+
name: "emojibase-regex",
83+
message:
84+
"This regex doesn't actually test for emoji. See the docs at https://emojibase.dev/docs/regex/ and prefer our own EMOJI_REGEX from HtmlUtils.",
85+
},
8186
],
8287
patterns: [
8388
{
@@ -115,13 +120,9 @@ module.exports = {
115120
"!matrix-js-sdk/src/extensible_events_v1/InvalidEventError",
116121
"!matrix-js-sdk/src/crypto",
117122
"!matrix-js-sdk/src/crypto/aes",
118-
"!matrix-js-sdk/src/crypto/olmlib",
119-
"!matrix-js-sdk/src/crypto/crypto",
120123
"!matrix-js-sdk/src/crypto/keybackup",
121-
"!matrix-js-sdk/src/crypto/RoomList",
122124
"!matrix-js-sdk/src/crypto/deviceinfo",
123125
"!matrix-js-sdk/src/crypto/key_passphrase",
124-
"!matrix-js-sdk/src/crypto/CrossSigning",
125126
"!matrix-js-sdk/src/crypto/recoverykey",
126127
"!matrix-js-sdk/src/crypto/dehydration",
127128
"!matrix-js-sdk/src/oidc",
@@ -144,6 +145,11 @@ module.exports = {
144145
],
145146
message: "Please use matrix-js-sdk/src/matrix instead",
146147
},
148+
{
149+
group: ["emojibase-regex/emoji*"],
150+
message:
151+
"This regex doesn't actually test for emoji. See the docs at https://emojibase.dev/docs/regex/ and prefer our own EMOJI_REGEX from HtmlUtils.",
152+
},
147153
],
148154
},
149155
],

jest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const config: Config = {
2222
testEnvironment: "jsdom",
2323
testMatch: ["<rootDir>/test/**/*-test.[jt]s?(x)"],
2424
globalSetup: "<rootDir>/test/globalSetup.ts",
25-
setupFiles: ["jest-canvas-mock"],
25+
setupFiles: ["jest-canvas-mock", "web-streams-polyfill/polyfill"],
2626
setupFilesAfterEnv: ["<rootDir>/test/setupTests.ts"],
2727
moduleNameMapper: {
2828
"\\.(gif|png|ttf|woff2)$": "<rootDir>/__mocks__/imageMock.js",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
"@matrix-org/analytics-events": "^0.23.0",
7474
"@matrix-org/emojibase-bindings": "^1.1.2",
7575
"@matrix-org/matrix-wysiwyg": "2.37.4",
76-
"@matrix-org/olm": "3.2.15",
7776
"@matrix-org/react-sdk-module-api": "^2.4.0",
7877
"@matrix-org/spec": "^1.7.0",
7978
"@sentry/browser": "^8.0.0",
@@ -227,7 +226,8 @@
227226
"stylelint-config-standard": "^36.0.0",
228227
"stylelint-scss": "^6.0.0",
229228
"ts-node": "^10.9.1",
230-
"typescript": "5.5.2"
229+
"typescript": "5.5.2",
230+
"web-streams-polyfill": "^4.0.0"
231231
},
232232
"peerDependencies": {
233233
"postcss": "^8.4.19",
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
Copyright 2024 The Matrix.org Foundation C.I.C.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
import { expect, test } from "../../element-web-test";
18+
import { selectHomeserver } from "../utils";
19+
20+
const username = "user1234";
21+
// this has to be password-like enough to please zxcvbn. Needless to say it's just from pwgen.
22+
const password = "oETo7MPf0o";
23+
const email = "[email protected]";
24+
25+
test.describe("Forgot Password", () => {
26+
test.use({
27+
startHomeserverOpts: ({ mailhog }, use) =>
28+
use({
29+
template: "email",
30+
variables: {
31+
SMTP_HOST: "host.containers.internal",
32+
SMTP_PORT: mailhog.instance.smtpPort,
33+
},
34+
}),
35+
});
36+
37+
test("renders properly", async ({ page, homeserver }) => {
38+
await page.goto("/");
39+
40+
await page.getByRole("link", { name: "Sign in" }).click();
41+
42+
// need to select a homeserver at this stage, before entering the forgot password flow
43+
await selectHomeserver(page, homeserver.config.baseUrl);
44+
45+
await page.getByRole("button", { name: "Forgot password?" }).click();
46+
47+
await expect(page.getByRole("main")).toMatchScreenshot("forgot-password.png");
48+
});
49+
50+
test("renders email verification dialog properly", async ({ page, homeserver }) => {
51+
const user = await homeserver.registerUser(username, password);
52+
53+
await homeserver.setThreepid(user.userId, "email", email);
54+
55+
await page.goto("/");
56+
57+
await page.getByRole("link", { name: "Sign in" }).click();
58+
await selectHomeserver(page, homeserver.config.baseUrl);
59+
60+
await page.getByRole("button", { name: "Forgot password?" }).click();
61+
62+
await page.getByRole("textbox", { name: "Email address" }).fill(email);
63+
64+
await page.getByRole("button", { name: "Send email" }).click();
65+
66+
await page.getByRole("button", { name: "Next" }).click();
67+
68+
await page.getByRole("textbox", { name: "New Password", exact: true }).fill(password);
69+
await page.getByRole("textbox", { name: "Confirm new password", exact: true }).fill(password);
70+
71+
await page.getByRole("button", { name: "Reset password" }).click();
72+
73+
await expect(page.getByRole("button", { name: "Resend" })).toBeInViewport();
74+
75+
await expect(page.locator(".mx_Dialog")).toMatchScreenshot("forgot-password-verify-email.png");
76+
});
77+
});

playwright/e2e/login/login.spec.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import { Page } from "@playwright/test";
18-
1917
import { expect, test } from "../../element-web-test";
2018
import { doTokenRegistration } from "./utils";
2119
import { isDendrite } from "../../plugins/homeserver/dendrite";
20+
import { selectHomeserver } from "../utils";
2221

2322
test.describe("Login", () => {
2423
test.describe("Password login", () => {
@@ -85,17 +84,6 @@ test.describe("Login", () => {
8584
await expect(page).toHaveURL(/\/#\/room\/!room:id$/);
8685
await expect(page.getByRole("button", { name: "Join the discussion" })).toBeVisible();
8786
});
88-
89-
async function selectHomeserver(page: Page, homeserverUrl: string) {
90-
await page.getByRole("button", { name: "Edit" }).click();
91-
await page.getByRole("textbox", { name: "Other homeserver" }).fill(homeserverUrl);
92-
await page.getByRole("button", { name: "Continue", exact: true }).click();
93-
// wait for the dialog to go away
94-
await expect(page.locator(".mx_ServerPickerDialog")).toHaveCount(0);
95-
96-
await expect(page.locator(".mx_Spinner")).toHaveCount(0);
97-
await expect(page.locator(".mx_ServerPicker_server")).toHaveText(homeserverUrl);
98-
}
9987
});
10088

10189
// tests for old-style SSO login, in which we exchange tokens with Synapse, and Synapse talks to an auth server

playwright/e2e/settings/appearance-user-settings-tab/appearance-user-settings-tab.spec.ts

Lines changed: 40 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -33,43 +33,6 @@ test.describe("Appearance user settings tab", () => {
3333
await expect(tab).toMatchScreenshot("appearance-tab.png");
3434
});
3535

36-
test("should support switching layouts", async ({ page, user, app }) => {
37-
// Create and view a room first
38-
await app.client.createRoom({ name: "Test Room" });
39-
await app.viewRoomByName("Test Room");
40-
41-
await app.settings.openUserSettings("Appearance");
42-
43-
const buttons = page.locator(".mx_LayoutSwitcher_RadioButton");
44-
45-
// Assert that the layout selected by default is "Modern"
46-
await expect(
47-
buttons.locator(".mx_StyledRadioButton_enabled", {
48-
hasText: "Modern",
49-
}),
50-
).toBeVisible();
51-
52-
// Assert that the room layout is set to group (modern) layout
53-
await expect(page.locator(".mx_RoomView_body[data-layout='group']")).toBeVisible();
54-
55-
// Select the first layout
56-
await buttons.first().click();
57-
// Assert that the layout selected is "IRC (Experimental)"
58-
await expect(buttons.locator(".mx_StyledRadioButton_enabled", { hasText: "IRC (Experimental)" })).toBeVisible();
59-
60-
// Assert that the room layout is set to IRC layout
61-
await expect(page.locator(".mx_RoomView_body[data-layout='irc']")).toBeVisible();
62-
63-
// Select the last layout
64-
await buttons.last().click();
65-
66-
// Assert that the layout selected is "Message bubbles"
67-
await expect(buttons.locator(".mx_StyledRadioButton_enabled", { hasText: "Message bubbles" })).toBeVisible();
68-
69-
// Assert that the room layout is set to bubble layout
70-
await expect(page.locator(".mx_RoomView_body[data-layout='bubble']")).toBeVisible();
71-
});
72-
7336
test("should support changing font size by using the font size dropdown", async ({ page, app, user }) => {
7437
await app.settings.openUserSettings("Appearance");
7538

@@ -84,69 +47,61 @@ test.describe("Appearance user settings tab", () => {
8447
await expect(page).toMatchScreenshot("window-12px.png");
8548
});
8649

87-
test("should support enabling compact group (modern) layout", async ({ page, app, user }) => {
88-
// Create and view a room first
89-
await app.client.createRoom({ name: "Test Room" });
90-
await app.viewRoomByName("Test Room");
91-
92-
await app.settings.openUserSettings("Appearance");
93-
94-
// Click "Show advanced" link button
95-
const tab = page.getByTestId("mx_AppearanceUserSettingsTab");
96-
await tab.getByRole("button", { name: "Show advanced" }).click();
97-
98-
await tab.locator("label", { hasText: "Use a more compact 'Modern' layout" }).click();
99-
100-
// Assert that the room layout is set to compact group (modern) layout
101-
await expect(page.locator("#matrixchat .mx_MatrixChat_wrapper.mx_MatrixChat_useCompactLayout")).toBeVisible();
102-
});
103-
104-
test("should disable compact group (modern) layout option on IRC layout and bubble layout", async ({
105-
page,
106-
app,
107-
user,
108-
}) => {
50+
test("should support enabling system font", async ({ page, app, user }) => {
10951
await app.settings.openUserSettings("Appearance");
11052
const tab = page.getByTestId("mx_AppearanceUserSettingsTab");
11153

112-
const checkDisabled = async () => {
113-
await expect(tab.getByRole("checkbox", { name: "Use a more compact 'Modern' layout" })).toBeDisabled();
114-
};
115-
11654
// Click "Show advanced" link button
11755
await tab.getByRole("button", { name: "Show advanced" }).click();
11856

119-
const buttons = page.locator(".mx_LayoutSwitcher_RadioButton");
120-
121-
// Enable IRC layout
122-
await buttons.first().click();
57+
await tab.locator(".mx_Checkbox", { hasText: "Use bundled emoji font" }).click();
58+
await tab.locator(".mx_Checkbox", { hasText: "Use a system font" }).click();
12359

124-
// Assert that the layout selected is "IRC (Experimental)"
125-
await expect(buttons.locator(".mx_StyledRadioButton_enabled", { hasText: "IRC (Experimental)" })).toBeVisible();
60+
// Assert that the font-family value was removed
61+
await expect(page.locator("body")).toHaveCSS("font-family", '""');
62+
});
12663

127-
await checkDisabled();
64+
test.describe("Message Layout Panel", () => {
65+
test.beforeEach(async ({ app, user, util }) => {
66+
await util.createAndDisplayRoom();
67+
await util.assertModernLayout();
68+
await util.openAppearanceTab();
69+
});
12870

129-
// Enable bubble layout
130-
await buttons.last().click();
71+
test("should change the message layout from modern to bubble", async ({ page, app, user, util }) => {
72+
await util.assertScreenshot(util.getMessageLayoutPanel(), "message-layout-panel-modern.png");
13173

132-
// Assert that the layout selected is "IRC (Experimental)"
133-
await expect(buttons.locator(".mx_StyledRadioButton_enabled", { hasText: "Message bubbles" })).toBeVisible();
74+
await util.getBubbleLayout().click();
13475

135-
await checkDisabled();
136-
});
76+
// Assert that modern are irc layout are not selected
77+
await expect(util.getBubbleLayout()).toBeChecked();
78+
await expect(util.getModernLayout()).not.toBeChecked();
79+
await expect(util.getIRCLayout()).not.toBeChecked();
13780

138-
test("should support enabling system font", async ({ page, app, user }) => {
139-
await app.settings.openUserSettings("Appearance");
140-
const tab = page.getByTestId("mx_AppearanceUserSettingsTab");
81+
// Assert that the room layout is set to bubble layout
82+
await util.assertBubbleLayout();
83+
await util.assertScreenshot(util.getMessageLayoutPanel(), "message-layout-panel-bubble.png");
84+
});
14185

142-
// Click "Show advanced" link button
143-
await tab.getByRole("button", { name: "Show advanced" }).click();
86+
test("should enable compact layout when the modern layout is selected", async ({ page, app, user, util }) => {
87+
await expect(util.getCompactLayoutCheckbox()).not.toBeChecked();
14488

145-
await tab.locator(".mx_Checkbox", { hasText: "Use bundled emoji font" }).click();
146-
await tab.locator(".mx_Checkbox", { hasText: "Use a system font" }).click();
89+
await util.getCompactLayoutCheckbox().click();
90+
await util.assertCompactLayout();
91+
});
14792

148-
// Assert that the font-family value was removed
149-
await expect(page.locator("body")).toHaveCSS("font-family", '""');
93+
test("should disable compact layout when the modern layout is not selected", async ({
94+
page,
95+
app,
96+
user,
97+
util,
98+
}) => {
99+
await expect(util.getCompactLayoutCheckbox()).not.toBeDisabled();
100+
101+
// Select the bubble layout, which should disable the compact layout checkbox
102+
await util.getBubbleLayout().click();
103+
await expect(util.getCompactLayoutCheckbox()).toBeDisabled();
104+
});
150105
});
151106

152107
test.describe("Theme Choice Panel", () => {

0 commit comments

Comments
 (0)