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

Commit c894beb

Browse files
authored
Split up slow Playwright tests (#12741)
* Split up slow Playwright tests To optimise parallelism Deals with: ``` Slow test file: read-receipts/redactions.spec.ts (5.4m) Slow test file: read-receipts/new-messages.spec.ts (3.9m) Slow test file: read-receipts/high-level.spec.ts (3.6m) Slow test file: read-receipts/editing-messages.spec.ts (3.1m) Slow test file: read-receipts/reactions.spec.ts (2.2m) Slow test file: crypto/crypto.spec.ts (2.4m) Slow test file: settings/appearance-user-settings-tab/appearance-user-settings-tab.spec.ts (1.2m) Slow test file: composer/composer.spec.ts (1.1m) Slow test file: crypto/verification.spec.ts (1.1m) ``` Signed-off-by: Michael Telatynski <[email protected]> * Move around snapshots Signed-off-by: Michael Telatynski <[email protected]> * Fix test Signed-off-by: Michael Telatynski <[email protected]> --------- Signed-off-by: Michael Telatynski <[email protected]>
1 parent 2712803 commit c894beb

33 files changed

+2868
-2452
lines changed

playwright/e2e/composer/CIDER.spec.ts

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/*
2+
Copyright 2022 - 2023 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 { SettingLevel } from "../../../src/settings/SettingLevel";
19+
20+
const CtrlOrMeta = process.platform === "darwin" ? "Meta" : "Control";
21+
22+
test.describe("Composer", () => {
23+
test.use({
24+
displayName: "Janet",
25+
});
26+
27+
test.use({
28+
room: async ({ app, user }, use) => {
29+
const roomId = await app.client.createRoom({ name: "Composing Room" });
30+
await app.viewRoomByName("Composing Room");
31+
await use({ roomId });
32+
},
33+
});
34+
35+
test.beforeEach(async ({ room }) => {}); // trigger room fixture
36+
37+
test.describe("CIDER", () => {
38+
test("sends a message when you click send or press Enter", async ({ page }) => {
39+
const composer = page.getByRole("textbox", { name: "Send a message…" });
40+
41+
// Type a message
42+
await composer.pressSequentially("my message 0");
43+
// It has not been sent yet
44+
await expect(page.locator(".mx_EventTile_body", { hasText: "my message 0" })).not.toBeVisible();
45+
46+
// Click send
47+
await page.getByRole("button", { name: "Send message" }).click();
48+
// It has been sent
49+
await expect(
50+
page.locator(".mx_EventTile_last .mx_EventTile_body", { hasText: "my message 0" }),
51+
).toBeVisible();
52+
53+
// Type another and press Enter afterward
54+
await composer.pressSequentially("my message 1");
55+
await composer.press("Enter");
56+
// It was sent
57+
await expect(
58+
page.locator(".mx_EventTile_last .mx_EventTile_body", { hasText: "my message 1" }),
59+
).toBeVisible();
60+
});
61+
62+
test("can write formatted text", async ({ page }) => {
63+
const composer = page.getByRole("textbox", { name: "Send a message…" });
64+
65+
await composer.pressSequentially("my bold");
66+
await composer.press(`${CtrlOrMeta}+KeyB`);
67+
await composer.pressSequentially(" message");
68+
await page.getByRole("button", { name: "Send message" }).click();
69+
// Note: both "bold" and "message" are bold, which is probably surprising
70+
await expect(page.locator(".mx_EventTile_body strong", { hasText: "bold message" })).toBeVisible();
71+
});
72+
73+
test("should allow user to input emoji via graphical picker", async ({ page, app }) => {
74+
await app.getComposer(false).getByRole("button", { name: "Emoji" }).click();
75+
76+
await page.getByTestId("mx_EmojiPicker").locator(".mx_EmojiPicker_item", { hasText: "😇" }).click();
77+
78+
await page.locator(".mx_ContextualMenu_background").click(); // Close emoji picker
79+
await page.getByRole("textbox", { name: "Send a message…" }).press("Enter"); // Send message
80+
81+
await expect(page.locator(".mx_EventTile_body", { hasText: "😇" })).toBeVisible();
82+
});
83+
84+
test.describe("when Control+Enter is required to send", () => {
85+
test.beforeEach(async ({ app }) => {
86+
await app.settings.setValue("MessageComposerInput.ctrlEnterToSend", null, SettingLevel.ACCOUNT, true);
87+
});
88+
89+
test("only sends when you press Control+Enter", async ({ page }) => {
90+
const composer = page.getByRole("textbox", { name: "Send a message…" });
91+
// Type a message and press Enter
92+
await composer.pressSequentially("my message 3");
93+
await composer.press("Enter");
94+
// It has not been sent yet
95+
await expect(page.locator(".mx_EventTile_body", { hasText: "my message 3" })).not.toBeVisible();
96+
97+
// Press Control+Enter
98+
await composer.press(`${CtrlOrMeta}+Enter`);
99+
// It was sent
100+
await expect(
101+
page.locator(".mx_EventTile_last .mx_EventTile_body", { hasText: "my message 3" }),
102+
).toBeVisible();
103+
});
104+
});
105+
});
106+
});

playwright/e2e/composer/composer.spec.ts renamed to playwright/e2e/composer/RTE.spec.ts

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -34,76 +34,6 @@ test.describe("Composer", () => {
3434

3535
test.beforeEach(async ({ room }) => {}); // trigger room fixture
3636

37-
test.describe("CIDER", () => {
38-
test("sends a message when you click send or press Enter", async ({ page }) => {
39-
const composer = page.getByRole("textbox", { name: "Send a message…" });
40-
41-
// Type a message
42-
await composer.pressSequentially("my message 0");
43-
// It has not been sent yet
44-
await expect(page.locator(".mx_EventTile_body", { hasText: "my message 0" })).not.toBeVisible();
45-
46-
// Click send
47-
await page.getByRole("button", { name: "Send message" }).click();
48-
// It has been sent
49-
await expect(
50-
page.locator(".mx_EventTile_last .mx_EventTile_body", { hasText: "my message 0" }),
51-
).toBeVisible();
52-
53-
// Type another and press Enter afterward
54-
await composer.pressSequentially("my message 1");
55-
await composer.press("Enter");
56-
// It was sent
57-
await expect(
58-
page.locator(".mx_EventTile_last .mx_EventTile_body", { hasText: "my message 1" }),
59-
).toBeVisible();
60-
});
61-
62-
test("can write formatted text", async ({ page }) => {
63-
const composer = page.getByRole("textbox", { name: "Send a message…" });
64-
65-
await composer.pressSequentially("my bold");
66-
await composer.press(`${CtrlOrMeta}+KeyB`);
67-
await composer.pressSequentially(" message");
68-
await page.getByRole("button", { name: "Send message" }).click();
69-
// Note: both "bold" and "message" are bold, which is probably surprising
70-
await expect(page.locator(".mx_EventTile_body strong", { hasText: "bold message" })).toBeVisible();
71-
});
72-
73-
test("should allow user to input emoji via graphical picker", async ({ page, app }) => {
74-
await app.getComposer(false).getByRole("button", { name: "Emoji" }).click();
75-
76-
await page.getByTestId("mx_EmojiPicker").locator(".mx_EmojiPicker_item", { hasText: "😇" }).click();
77-
78-
await page.locator(".mx_ContextualMenu_background").click(); // Close emoji picker
79-
await page.getByRole("textbox", { name: "Send a message…" }).press("Enter"); // Send message
80-
81-
await expect(page.locator(".mx_EventTile_body", { hasText: "😇" })).toBeVisible();
82-
});
83-
84-
test.describe("when Control+Enter is required to send", () => {
85-
test.beforeEach(async ({ app }) => {
86-
await app.settings.setValue("MessageComposerInput.ctrlEnterToSend", null, SettingLevel.ACCOUNT, true);
87-
});
88-
89-
test("only sends when you press Control+Enter", async ({ page }) => {
90-
const composer = page.getByRole("textbox", { name: "Send a message…" });
91-
// Type a message and press Enter
92-
await composer.pressSequentially("my message 3");
93-
await composer.press("Enter");
94-
// It has not been sent yet
95-
await expect(page.locator(".mx_EventTile_body", { hasText: "my message 3" })).not.toBeVisible();
96-
97-
// Press Control+Enter
98-
await composer.press(`${CtrlOrMeta}+Enter`);
99-
// It was sent
100-
await expect(
101-
page.locator(".mx_EventTile_last .mx_EventTile_body", { hasText: "my message 3" }),
102-
).toBeVisible();
103-
});
104-
});
105-
});
106-
10737
test.describe("Rich text editor", () => {
10838
test.use({
10939
labsFlags: ["feature_wysiwyg_composer"],

0 commit comments

Comments
 (0)