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

Commit efd309f

Browse files
authored
Disable playwright tests for legacy crypto (#12662)
* Disable "legacy crypto" playwright project * playwight: Remove crypto stack conditions We only ever run under the rust stack now, so these conditions are redundant. * playwright: remove `cryptoBackend` test option * playwright: remove redundant `projects` We don't need this any more * playwright: remove redundant `TestOptions`
1 parent 9c86290 commit efd309f

File tree

6 files changed

+71
-125
lines changed

6 files changed

+71
-125
lines changed

playwright.config.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ limitations under the License.
1616

1717
import { defineConfig } from "@playwright/test";
1818

19-
import { TestOptions } from "./playwright/element-web-test";
20-
2119
const baseURL = process.env["BASE_URL"] ?? "http://localhost:8080";
2220

23-
export default defineConfig<TestOptions>({
21+
export default defineConfig({
2422
use: {
2523
viewport: { width: 1280, height: 720 },
2624
ignoreHTTPSErrors: true,
@@ -42,16 +40,6 @@ export default defineConfig<TestOptions>({
4240
workers: 1,
4341
retries: process.env.CI ? 2 : 0,
4442
reporter: process.env.CI ? [["blob"], ["github"]] : [["html", { outputFolder: "playwright/html-report" }]],
45-
projects: [
46-
{
47-
name: "Legacy Crypto",
48-
use: { cryptoBackend: "legacy" },
49-
},
50-
{
51-
name: "Rust Crypto",
52-
use: { cryptoBackend: "rust" },
53-
},
54-
],
5543
snapshotDir: "playwright/snapshots",
5644
snapshotPathTemplate: "{snapshotDir}/{testFilePath}/{arg}-{platform}{ext}",
5745
});

playwright/e2e/crypto/crypto.spec.ts

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -322,13 +322,7 @@ test.describe("Cryptography", function () {
322322
});
323323
});
324324

325-
test("should show the correct shield on e2e events", async ({
326-
page,
327-
app,
328-
bot: bob,
329-
homeserver,
330-
cryptoBackend,
331-
}) => {
325+
test("should show the correct shield on e2e events", async ({ page, app, bot: bob, homeserver }) => {
332326
// Bob has a second, not cross-signed, device
333327
const bobSecondDevice = new Bot(page, homeserver, {
334328
bootstrapSecretStorage: false,
@@ -432,16 +426,8 @@ test.describe("Cryptography", function () {
432426
await app.viewRoomByName("Bob");
433427
await app.viewRoomByName("TestRoom");
434428

435-
// some debate over whether this should have a red or a grey shield. Legacy crypto shows a grey shield,
436-
// Rust crypto a red one.
437429
await expect(last).toContainText("test encrypted from unverified");
438-
if (cryptoBackend === "rust") {
439-
await expect(lastE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_warning/);
440-
} else {
441-
// skip this for now: the legacy option no longer actually gives us a legacy stack.
442-
// We'll sort this out properly in https://github.com/matrix-org/matrix-react-sdk/pull/12662
443-
// await expect(lastE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_normal/);
444-
}
430+
await expect(lastE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_warning/);
445431
await lastE2eIcon.focus();
446432
await expect(page.getByRole("tooltip")).toContainText("Encrypted by an unknown or deleted device.");
447433
});
@@ -561,9 +547,7 @@ test.describe("Cryptography", function () {
561547
app,
562548
credentials,
563549
user,
564-
cryptoBackend,
565550
}) => {
566-
test.skip(cryptoBackend === "legacy", "Not implemented for legacy crypto");
567551
test.setTimeout(60000);
568552

569553
// Start with a logged-in session, without key backup, and send a message.
@@ -627,11 +611,8 @@ test.describe("Cryptography", function () {
627611
app,
628612
credentials: aliceCredentials,
629613
user: alice,
630-
cryptoBackend,
631614
bot: bob,
632615
}) => {
633-
test.skip(cryptoBackend === "legacy", "Not implemented for legacy crypto");
634-
635616
// Bob creates an encrypted room and sends a message to it. He then invites Alice
636617
const roomId = await bob.evaluate(
637618
async (client, { alice }) => {
@@ -735,15 +716,8 @@ test.describe("Cryptography", function () {
735716
app,
736717
credentials: aliceCredentials,
737718
user: alice,
738-
cryptoBackend,
739719
bot: bob,
740720
}) => {
741-
// The old pre-join UTD hiding code would hide events sent
742-
// before our latest join event, even if the event that we're
743-
// jumping to was decryptable. We test that this no longer happens.
744-
745-
test.skip(cryptoBackend === "legacy", "Not implemented for legacy crypto");
746-
747721
// Bob:
748722
// - creates an encrypted room,
749723
// - invites Alice,

playwright/e2e/crypto/verification.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,7 @@ test.describe("User verification", () => {
305305
user: aliceCredentials,
306306
toasts,
307307
room: { roomId: dmRoomId },
308-
cryptoBackend,
309308
}) => {
310-
test.skip(cryptoBackend === "legacy", "Not implemented for legacy crypto");
311-
312309
// once Alice has joined, Bob starts the verification
313310
const bobVerificationRequest = await bob.evaluateHandle(
314311
async (client, { dmRoomId, aliceCredentials }) => {

playwright/e2e/read-receipts/high-level.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ test.describe("Read receipts", () => {
249249
});
250250

251251
test("Paging up to find old threads that were never read keeps the room unread", async ({
252-
cryptoBackend,
253252
roomAlpha: room1,
254253
roomBeta: room2,
255254
util,
@@ -338,7 +337,6 @@ test.describe("Read receipts", () => {
338337
});
339338

340339
test("After marking room as read, paging up to find old threads that were never read leaves the room read", async ({
341-
cryptoBackend,
342340
roomAlpha: room1,
343341
roomBeta: room2,
344342
util,

playwright/e2e/timeline/timeline.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,9 +568,9 @@ test.describe("Timeline", () => {
568568
);
569569
});
570570

571-
test("should set inline start padding to a hidden event line", async ({ page, app, room, cryptoBackend }) => {
571+
test("should set inline start padding to a hidden event line", async ({ page, app, room }) => {
572572
test.skip(
573-
cryptoBackend === "rust",
573+
true,
574574
"Disabled due to screenshot test being flaky - https://github.com/element-hq/element-web/issues/26890",
575575
);
576576
await sendEvent(app.client, room.roomId);

playwright/element-web-test.ts

Lines changed: 66 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -63,84 +63,77 @@ const CONFIG_JSON: Partial<IConfigOptions> = {
6363
},
6464
};
6565

66-
export type TestOptions = {
67-
cryptoBackend: "legacy" | "rust";
68-
};
69-
7066
interface CredentialsWithDisplayName extends Credentials {
7167
displayName: string;
7268
}
7369

74-
export const test = base.extend<
75-
TestOptions & {
76-
axe: AxeBuilder;
77-
checkA11y: () => Promise<void>;
78-
79-
/**
80-
* The contents of the config.json to send when the client requests it.
81-
*/
82-
config: typeof CONFIG_JSON;
83-
84-
/**
85-
* The options with which to run the {@link #homeserver} fixture.
86-
*/
87-
startHomeserverOpts: StartHomeserverOpts | string;
88-
89-
homeserver: HomeserverInstance;
90-
oAuthServer: { port: number };
91-
92-
/**
93-
* The displayname to use for the user registered in {@link #credentials}.
94-
*
95-
* To set it, call `test.use({ displayName: "myDisplayName" })` in the test file or `describe` block.
96-
* See {@link https://playwright.dev/docs/api/class-test#test-use}.
97-
*/
98-
displayName?: string;
99-
100-
/**
101-
* A test fixture which registers a test user on the {@link #homeserver} and supplies the details
102-
* of the registered user.
103-
*/
104-
credentials: CredentialsWithDisplayName;
105-
106-
/**
107-
* The same as {@link https://playwright.dev/docs/api/class-fixtures#fixtures-page|`page`},
108-
* but adds an initScript which will populate localStorage with the user's details from
109-
* {@link #credentials} and {@link #homeserver}.
110-
*
111-
* Similar to {@link #user}, but doesn't load the app.
112-
*/
113-
pageWithCredentials: Page;
114-
115-
/**
116-
* A (rather poorly-named) test fixture which registers a user per {@link #credentials}, stores
117-
* the credentials into localStorage per {@link #homeserver}, and then loads the front page of the
118-
* app.
119-
*/
120-
user: CredentialsWithDisplayName;
121-
122-
/**
123-
* The same as {@link https://playwright.dev/docs/api/class-fixtures#fixtures-page|`page`},
124-
* but wraps the returned `Page` in a class of utilities for interacting with the Element-Web UI,
125-
* {@link ElementAppPage}.
126-
*/
127-
app: ElementAppPage;
128-
129-
mailhog: { api: mailhog.API; instance: Instance };
130-
crypto: Crypto;
131-
room?: { roomId: string };
132-
toasts: Toasts;
133-
uut?: Locator; // Unit Under Test, useful place to refer a prepared locator
134-
botCreateOpts: CreateBotOpts;
135-
bot: Bot;
136-
slidingSyncProxy: ProxyInstance;
137-
labsFlags: string[];
138-
webserver: Webserver;
139-
}
140-
>({
141-
cryptoBackend: ["legacy", { option: true }],
70+
export const test = base.extend<{
71+
axe: AxeBuilder;
72+
checkA11y: () => Promise<void>;
73+
74+
/**
75+
* The contents of the config.json to send when the client requests it.
76+
*/
77+
config: typeof CONFIG_JSON;
78+
79+
/**
80+
* The options with which to run the {@link #homeserver} fixture.
81+
*/
82+
startHomeserverOpts: StartHomeserverOpts | string;
83+
84+
homeserver: HomeserverInstance;
85+
oAuthServer: { port: number };
86+
87+
/**
88+
* The displayname to use for the user registered in {@link #credentials}.
89+
*
90+
* To set it, call `test.use({ displayName: "myDisplayName" })` in the test file or `describe` block.
91+
* See {@link https://playwright.dev/docs/api/class-test#test-use}.
92+
*/
93+
displayName?: string;
94+
95+
/**
96+
* A test fixture which registers a test user on the {@link #homeserver} and supplies the details
97+
* of the registered user.
98+
*/
99+
credentials: CredentialsWithDisplayName;
100+
101+
/**
102+
* The same as {@link https://playwright.dev/docs/api/class-fixtures#fixtures-page|`page`},
103+
* but adds an initScript which will populate localStorage with the user's details from
104+
* {@link #credentials} and {@link #homeserver}.
105+
*
106+
* Similar to {@link #user}, but doesn't load the app.
107+
*/
108+
pageWithCredentials: Page;
109+
110+
/**
111+
* A (rather poorly-named) test fixture which registers a user per {@link #credentials}, stores
112+
* the credentials into localStorage per {@link #homeserver}, and then loads the front page of the
113+
* app.
114+
*/
115+
user: CredentialsWithDisplayName;
116+
117+
/**
118+
* The same as {@link https://playwright.dev/docs/api/class-fixtures#fixtures-page|`page`},
119+
* but wraps the returned `Page` in a class of utilities for interacting with the Element-Web UI,
120+
* {@link ElementAppPage}.
121+
*/
122+
app: ElementAppPage;
123+
124+
mailhog: { api: mailhog.API; instance: Instance };
125+
crypto: Crypto;
126+
room?: { roomId: string };
127+
toasts: Toasts;
128+
uut?: Locator; // Unit Under Test, useful place to refer a prepared locator
129+
botCreateOpts: CreateBotOpts;
130+
bot: Bot;
131+
slidingSyncProxy: ProxyInstance;
132+
labsFlags: string[];
133+
webserver: Webserver;
134+
}>({
142135
config: CONFIG_JSON,
143-
page: async ({ context, page, config, cryptoBackend, labsFlags }, use) => {
136+
page: async ({ context, page, config, labsFlags }, use) => {
144137
await context.route(`http://localhost:8080/config.json*`, async (route) => {
145138
const json = { ...CONFIG_JSON, ...config };
146139
json["features"] = {
@@ -151,10 +144,6 @@ export const test = base.extend<
151144
return obj;
152145
}, {}),
153146
};
154-
// the default is to use rust now, so set to `false` if on legacy backend
155-
if (cryptoBackend === "legacy") {
156-
json.features.feature_rust_crypto = false;
157-
}
158147
await route.fulfill({ json });
159148
});
160149
await use(page);

0 commit comments

Comments
 (0)