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

Commit be846e6

Browse files
committed
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into staging
# Conflicts: # package.json
2 parents 831c56d + dafc97f commit be846e6

File tree

263 files changed

+6694
-5289
lines changed

Some content is hidden

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

263 files changed

+6694
-5289
lines changed

.github/workflows/end-to-end-tests.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,14 @@ jobs:
190190

191191
- name: Merge into HTML Report
192192
if: inputs.skip != true
193-
run: yarn playwright merge-reports --reporter=html,./playwright/flaky-reporter.ts ./all-blob-reports
193+
run: yarn playwright merge-reports --reporter=html,./playwright/flaky-reporter.ts,./playwright/stale-screenshot-reporter.ts ./all-blob-reports
194194
env:
195195
# Only pass creds to the flaky-reporter on main branch runs
196196
GITHUB_TOKEN: ${{ github.ref_name == 'develop' && secrets.ELEMENT_BOT_TOKEN || '' }}
197197

198+
# Upload the HTML report even if one of our reporters fails, this can happen when stale screenshots are detected
198199
- name: Upload HTML report
199-
if: inputs.skip != true
200+
if: always() && inputs.skip != true
200201
uses: actions/upload-artifact@v4
201202
with:
202203
name: html-report

package.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@
7373
},
7474
"dependencies": {
7575
"@babel/runtime": "^7.12.5",
76-
"@matrix-org/analytics-events": "^0.23.0",
76+
"@matrix-org/analytics-events": "^0.24.0",
7777
"@matrix-org/emojibase-bindings": "^1.1.2",
7878
"@matrix-org/matrix-wysiwyg": "2.37.4",
7979
"@matrix-org/react-sdk-module-api": "^2.4.0",
8080
"@matrix-org/spec": "^1.7.0",
8181
"@sentry/browser": "^8.0.0",
8282
"@testing-library/react-hooks": "^8.0.1",
8383
"@vector-im/compound-design-tokens": "^1.2.0",
84-
"@vector-im/compound-web": "^5.2.3",
84+
"@vector-im/compound-web": "^5.4.0",
8585
"@zxcvbn-ts/core": "^3.0.4",
8686
"@zxcvbn-ts/language-common": "^3.0.4",
8787
"@zxcvbn-ts/language-en": "^3.0.2",
@@ -91,12 +91,13 @@
9191
"classnames": "^2.2.6",
9292
"commonmark": "^0.31.0",
9393
"counterpart": "^0.18.6",
94+
"css-tree": "^2.3.1",
9495
"diff-dom": "^5.0.0",
9596
"diff-match-patch": "^1.0.5",
9697
"emojibase-regex": "15.3.2",
9798
"escape-html": "^1.0.3",
9899
"file-saver": "^2.0.5",
99-
"filesize": "10.1.2",
100+
"filesize": "10.1.4",
100101
"github-markdown-css": "^5.5.1",
101102
"glob-to-regexp": "^0.4.1",
102103
"highlight.js": "^11.3.1",
@@ -121,7 +122,7 @@
121122
"opus-recorder": "^8.0.3",
122123
"pako": "^2.0.3",
123124
"png-chunks-extract": "^1.0.0",
124-
"posthog-js": "1.141.3",
125+
"posthog-js": "1.145.0",
125126
"qrcode": "1.5.3",
126127
"re-resizable": "^6.9.0",
127128
"react": "17.0.2",
@@ -167,6 +168,7 @@
167168
"@types/commonmark": "^0.27.4",
168169
"@types/content-type": "^1.1.5",
169170
"@types/counterpart": "^0.18.1",
171+
"@types/css-tree": "^2.3.8",
170172
"@types/diff-match-patch": "^1.0.32",
171173
"@types/escape-html": "^1.0.1",
172174
"@types/express": "^4.17.21",
@@ -211,6 +213,7 @@
211213
"fake-indexeddb": "^6.0.0",
212214
"fetch-mock-jest": "^1.5.1",
213215
"fs-extra": "^11.0.0",
216+
"glob": "^11.0.0",
214217
"jest": "^29.6.2",
215218
"jest-canvas-mock": "^2.5.2",
216219
"jest-environment-jsdom": "^29.6.2",
@@ -221,15 +224,16 @@
221224
"matrix-web-i18n": "^3.2.1",
222225
"mocha-junit-reporter": "^2.2.0",
223226
"node-fetch": "2",
227+
"playwright-core": "^1.45.1",
224228
"postcss-scss": "^4.0.4",
225229
"prettier": "3.3.2",
226230
"raw-loader": "^4.0.2",
227-
"rimraf": "^5.0.0",
231+
"rimraf": "^6.0.0",
228232
"stylelint": "^16.1.0",
229233
"stylelint-config-standard": "^36.0.0",
230234
"stylelint-scss": "^6.0.0",
231235
"ts-node": "^10.9.1",
232-
"typescript": "5.5.2",
236+
"typescript": "5.5.3",
233237
"web-streams-polyfill": "^4.0.0"
234238
},
235239
"peerDependencies": {

playwright.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ export default defineConfig({
3737
},
3838
testDir: "playwright/e2e",
3939
outputDir: "playwright/test-results",
40-
workers: 1,
40+
workers: process.env.CI ? "50%" : 1,
4141
retries: process.env.CI ? 2 : 0,
4242
reporter: process.env.CI ? [["blob"], ["github"]] : [["html", { outputFolder: "playwright/html-report" }]],
4343
snapshotDir: "playwright/snapshots",
4444
snapshotPathTemplate: "{snapshotDir}/{testFilePath}/{arg}-{platform}{ext}",
45+
forbidOnly: !!process.env.CI,
4546
});

res/css/structures/_NotificationPanel.pcss renamed to playwright/@types/playwright-core.d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2015, 2016 OpenMarket Ltd
2+
Copyright 2024 The Matrix.org Foundation C.I.C.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
.mx_NotificationPanel_empty::before {
18-
--maskImage: url("$(res)/img/element-icons/notifications.svg"); /* See: _RightPanel.pcss */
17+
declare module "playwright-core/lib/utils" {
18+
// This type is not public in playwright-core utils
19+
export function sanitizeForFilePath(filePath: string): string;
1920
}

playwright/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mcr.microsoft.com/playwright:v1.45.0-jammy
1+
FROM mcr.microsoft.com/playwright:v1.45.1-jammy
22

33
WORKDIR /work/matrix-react-sdk
44
VOLUME ["/work/element-web/node_modules"]
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
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 { test, expect } from "../../element-web-test";
18+
import { Bot } from "../../pages/bot";
19+
20+
test.describe("Landmark navigation tests", () => {
21+
test.use({
22+
displayName: "Alice",
23+
});
24+
25+
test("without any rooms", async ({ page, homeserver, app, user }) => {
26+
/**
27+
* Without any rooms, there is no tile in the roomlist to be focused.
28+
* So the next landmark in the list should be focused instead.
29+
*/
30+
31+
// Pressing Control+F6 will first focus the space button
32+
await page.keyboard.press("ControlOrMeta+F6");
33+
await expect(page.locator(".mx_SpaceButton_active")).toBeFocused();
34+
35+
// Pressing Control+F6 again will focus room search
36+
await page.keyboard.press("ControlOrMeta+F6");
37+
await expect(page.locator(".mx_RoomSearch")).toBeFocused();
38+
39+
// Pressing Control+F6 again will focus the message composer
40+
await page.keyboard.press("ControlOrMeta+F6");
41+
await expect(page.locator(".mx_HomePage")).toBeFocused();
42+
43+
// Pressing Control+F6 again will bring focus back to the space button
44+
await page.keyboard.press("ControlOrMeta+F6");
45+
await expect(page.locator(".mx_SpaceButton_active")).toBeFocused();
46+
47+
// Now go back in the same order
48+
await page.keyboard.press("ControlOrMeta+Shift+F6");
49+
await expect(page.locator(".mx_HomePage")).toBeFocused();
50+
51+
await page.keyboard.press("ControlOrMeta+Shift+F6");
52+
await expect(page.locator(".mx_RoomSearch")).toBeFocused();
53+
54+
await page.keyboard.press("ControlOrMeta+Shift+F6");
55+
await expect(page.locator(".mx_SpaceButton_active")).toBeFocused();
56+
});
57+
58+
test("with an open room", async ({ page, homeserver, app, user }) => {
59+
const bob = new Bot(page, homeserver, { displayName: "Bob" });
60+
await bob.prepareClient();
61+
62+
// create dm with bob
63+
await app.client.evaluate(
64+
async (cli, { bob }) => {
65+
const bobRoom = await cli.createRoom({ is_direct: true });
66+
await cli.invite(bobRoom.room_id, bob);
67+
},
68+
{
69+
bob: bob.credentials.userId,
70+
},
71+
);
72+
73+
await app.viewRoomByName("Bob");
74+
// confirm the room was loaded
75+
await expect(page.getByText("Bob joined the room")).toBeVisible();
76+
77+
// Pressing Control+F6 will first focus the space button
78+
await page.keyboard.press("ControlOrMeta+F6");
79+
await expect(page.locator(".mx_SpaceButton_active")).toBeFocused();
80+
81+
// Pressing Control+F6 again will focus room search
82+
await page.keyboard.press("ControlOrMeta+F6");
83+
await expect(page.locator(".mx_RoomSearch")).toBeFocused();
84+
85+
// Pressing Control+F6 again will focus the room tile in the room list
86+
await page.keyboard.press("ControlOrMeta+F6");
87+
await expect(page.locator(".mx_RoomTile_selected")).toBeFocused();
88+
89+
// Pressing Control+F6 again will focus the message composer
90+
await page.keyboard.press("ControlOrMeta+F6");
91+
await expect(page.locator(".mx_BasicMessageComposer_input")).toBeFocused();
92+
93+
// Pressing Control+F6 again will bring focus back to the space button
94+
await page.keyboard.press("ControlOrMeta+F6");
95+
await expect(page.locator(".mx_SpaceButton_active")).toBeFocused();
96+
97+
// Now go back in the same order
98+
await page.keyboard.press("ControlOrMeta+Shift+F6");
99+
await expect(page.locator(".mx_BasicMessageComposer_input")).toBeFocused();
100+
101+
await page.keyboard.press("ControlOrMeta+Shift+F6");
102+
await expect(page.locator(".mx_RoomTile_selected")).toBeFocused();
103+
104+
await page.keyboard.press("ControlOrMeta+Shift+F6");
105+
await expect(page.locator(".mx_RoomSearch")).toBeFocused();
106+
107+
await page.keyboard.press("ControlOrMeta+Shift+F6");
108+
await expect(page.locator(".mx_SpaceButton_active")).toBeFocused();
109+
});
110+
111+
test("without an open room", async ({ page, homeserver, app, user }) => {
112+
const bob = new Bot(page, homeserver, { displayName: "Bob" });
113+
await bob.prepareClient();
114+
115+
// create a dm with bob
116+
await app.client.evaluate(
117+
async (cli, { bob }) => {
118+
const bobRoom = await cli.createRoom({ is_direct: true });
119+
await cli.invite(bobRoom.room_id, bob);
120+
},
121+
{
122+
bob: bob.credentials.userId,
123+
},
124+
);
125+
126+
await app.viewRoomByName("Bob");
127+
// confirm the room was loaded
128+
await expect(page.getByText("Bob joined the room")).toBeVisible();
129+
130+
// Close the room
131+
page.goto("/#/home");
132+
133+
// Pressing Control+F6 will first focus the space button
134+
await page.keyboard.press("ControlOrMeta+F6");
135+
await expect(page.locator(".mx_SpaceButton_active")).toBeFocused();
136+
137+
// Pressing Control+F6 again will focus room search
138+
await page.keyboard.press("ControlOrMeta+F6");
139+
await expect(page.locator(".mx_RoomSearch")).toBeFocused();
140+
141+
// Pressing Control+F6 again will focus the room tile in the room list
142+
await page.keyboard.press("ControlOrMeta+F6");
143+
await expect(page.locator(".mx_RoomTile")).toBeFocused();
144+
145+
// Pressing Control+F6 again will focus the home section
146+
await page.keyboard.press("ControlOrMeta+F6");
147+
await expect(page.locator(".mx_HomePage")).toBeFocused();
148+
149+
// Pressing Control+F6 will bring focus back to the space button
150+
await page.keyboard.press("ControlOrMeta+F6");
151+
await expect(page.locator(".mx_SpaceButton_active")).toBeFocused();
152+
153+
// Now go back in same order
154+
await page.keyboard.press("ControlOrMeta+Shift+F6");
155+
await expect(page.locator(".mx_HomePage")).toBeFocused();
156+
157+
await page.keyboard.press("ControlOrMeta+Shift+F6");
158+
await expect(page.locator(".mx_RoomTile")).toBeFocused();
159+
160+
await page.keyboard.press("ControlOrMeta+Shift+F6");
161+
await expect(page.locator(".mx_RoomSearch")).toBeFocused();
162+
163+
await page.keyboard.press("ControlOrMeta+Shift+F6");
164+
await expect(page.locator(".mx_SpaceButton_active")).toBeFocused();
165+
});
166+
});
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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 { test, expect } from "../../element-web-test";
18+
19+
test(`shows error page if browser lacks Intl support`, async ({ page }) => {
20+
await page.addInitScript({ content: `delete window.Intl;` });
21+
await page.goto("/");
22+
23+
// Lack of Intl support causes the app bundle to fail to load, so we get the iframed
24+
// static error page and need to explicitly look in the iframe becuse Playwright doesn't
25+
// recurse into iframes when looking for elements
26+
const header = await page.frameLocator("iframe").getByText("Unsupported browser");
27+
await expect(header).toBeVisible();
28+
29+
await expect(page).toMatchScreenshot("unsupported-browser.png");
30+
});
31+
32+
test(`shows error page if browser lacks WebAssembly support`, async ({ page }) => {
33+
await page.addInitScript({ content: `delete window.WebAssembly;` });
34+
await page.goto("/");
35+
36+
// Lack of WebAssembly support doesn't cause the bundle to fail loading, so we get
37+
// CompatibilityView, ie. no iframes.
38+
const header = await page.getByText("Unsupported browser");
39+
await expect(header).toBeVisible();
40+
41+
await expect(page).toMatchScreenshot("unsupported-browser-CompatibilityView.png");
42+
});

playwright/e2e/app-loading/stored-credentials.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ test("Shows the last known page on reload", async ({ pageWithCredentials: page }
4848

4949
// Check that the room reloaded
5050
await expect(page).toHaveURL(/\/#\/room\//);
51-
await expect(page.locator(".mx_LegacyRoomHeader")).toContainText("Test Room");
51+
await expect(page.locator(".mx_RoomHeader")).toContainText("Test Room");
5252
});
5353

5454
test("Room link correctly loads a room view", async ({ pageWithCredentials: page }) => {

0 commit comments

Comments
 (0)