Skip to content

Commit 7b3d5b5

Browse files
Playwright: Convert sliding-sync test to playwright (matrix-org#11989)
* Add method to send text message * Add dockerUrl to HomeServerConfig * Implement sliding sync proxy * Convert tests * Reload page after applying labs feature * Remove converted files * Remove timeout * Remove sliding-sync * Remove proxy import * Remove reference to proxy * wait for load * Update date * Convert enableLabsFeature to separate fixture * Enable feature in fixture * Skip over config and just write to local-storage * Rename fixture * Fix room header test * Use type inference * Override config instead of setting localstorage * Set default language * Always add labs feature * Put this one test into a separate describe block * Move labs lag within describe block
1 parent de5931d commit 7b3d5b5

File tree

16 files changed

+551
-774
lines changed

16 files changed

+551
-774
lines changed

cypress/e2e/sliding-sync/sliding-sync.spec.ts

Lines changed: 0 additions & 502 deletions
This file was deleted.

cypress/plugins/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import PluginEvents = Cypress.PluginEvents;
2222
import PluginConfigOptions = Cypress.PluginConfigOptions;
2323
import { synapseDocker } from "./synapsedocker";
2424
import { dendriteDocker } from "./dendritedocker";
25-
import { slidingSyncProxyDocker } from "./sliding-sync";
2625
import { webserver } from "./webserver";
2726
import { docker } from "./docker";
2827
import { log } from "./log";
@@ -31,7 +30,7 @@ import { log } from "./log";
3130
* @type {Cypress.PluginConfig}
3231
*/
3332
export default function (on: PluginEvents, config: PluginConfigOptions) {
34-
initPlugins(on, [docker, synapseDocker, dendriteDocker, slidingSyncProxyDocker, webserver, log], config);
33+
initPlugins(on, [docker, synapseDocker, dendriteDocker, webserver, log], config);
3534
installLogsPrinter(on, {
3635
printLogsToConsole: "never",
3736

cypress/plugins/sliding-sync/index.ts

Lines changed: 0 additions & 129 deletions
This file was deleted.

cypress/support/e2e.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import "./iframes";
3838
import "./timeline";
3939
import "./network";
4040
import "./composer";
41-
import "./proxy";
4241
import "./axe";
4342
import "./promise";
4443

cypress/support/proxy.ts

Lines changed: 0 additions & 58 deletions
This file was deleted.

playwright/e2e/right-panel/notification-panel.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ const NAME = "Alice";
2222
test.describe("NotificationPanel", () => {
2323
test.use({
2424
displayName: NAME,
25+
labsFlags: ["feature_notifications"],
2526
});
2627

2728
test.beforeEach(async ({ app, user }) => {
2829
await app.client.createRoom({ name: ROOM_NAME });
2930
});
3031

3132
test("should render empty state", async ({ page, app }) => {
32-
await app.labs.enableLabsFeature("feature_notifications");
3333
await app.viewRoomByName(ROOM_NAME);
3434

3535
await page.getByRole("button", { name: "Notifications" }).click();

playwright/e2e/room/room-header.spec.ts

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ test.describe("Room Header", () => {
2525
});
2626

2727
test.describe("with feature_notifications enabled", () => {
28-
test.beforeEach(async ({ app }) => {
29-
await app.labs.enableLabsFeature("feature_notifications");
28+
test.use({
29+
labsFlags: ["feature_notifications"],
3030
});
31-
3231
test("should render default buttons properly", async ({ page, app, user }) => {
3332
await app.client.createRoom({ name: "Test Room" });
3433
await app.viewRoomByName("Test Room");
@@ -101,9 +100,7 @@ test.describe("Room Header", () => {
101100
});
102101

103102
test.describe("with feature_pinning enabled", () => {
104-
test.beforeEach(async ({ app }) => {
105-
await app.labs.enableLabsFeature("feature_pinning");
106-
});
103+
test.use({ labsFlags: ["feature_pinning"] });
107104

108105
test("should render the pin button for pinned messages card", async ({ page, app, user }) => {
109106
await app.client.createRoom({ name: "Test Room" });
@@ -126,9 +123,7 @@ test.describe("Room Header", () => {
126123
});
127124

128125
test.describe("with a video room", () => {
129-
test.beforeEach(async ({ app }) => {
130-
await app.labs.enableLabsFeature("feature_video_rooms");
131-
});
126+
test.use({ labsFlags: ["feature_video_rooms"] });
132127

133128
const createVideoRoom = async (page: Page, app: ElementAppPage) => {
134129
await page.locator(".mx_LeftPanel_roomListContainer").getByRole("button", { name: "Add room" }).click();
@@ -142,33 +137,36 @@ test.describe("Room Header", () => {
142137
await app.viewRoomByName("Test video room");
143138
};
144139

145-
test("should render buttons for room options, beta pill, invite, chat, and room info", async ({
146-
page,
147-
app,
148-
user,
149-
}) => {
150-
await app.labs.enableLabsFeature("feature_notifications");
151-
await createVideoRoom(page, app);
152-
153-
const header = page.locator(".mx_LegacyRoomHeader");
154-
// Names (aria-label) of the buttons on the video room header
155-
const expectedButtonNames = [
156-
"Room options",
157-
"Video rooms are a beta feature Click for more info", // Beta pill
158-
"Invite",
159-
"Chat",
160-
"Room info",
161-
];
162-
163-
// Assert they are found and visible
164-
for (const name of expectedButtonNames) {
165-
await expect(header.getByRole("button", { name })).toBeVisible();
166-
}
167-
168-
// Assert that there is not a button except those buttons
169-
await expect(header.getByRole("button")).toHaveCount(7);
170-
171-
await expect(header).toMatchScreenshot("room-header-video-room.png");
140+
test.describe("and with feature_notifications enabled", () => {
141+
test.use({ labsFlags: ["feature_video_rooms", "feature_notifications"] });
142+
143+
test("should render buttons for room options, beta pill, invite, chat, and room info", async ({
144+
page,
145+
app,
146+
user,
147+
}) => {
148+
await createVideoRoom(page, app);
149+
150+
const header = page.locator(".mx_LegacyRoomHeader");
151+
// Names (aria-label) of the buttons on the video room header
152+
const expectedButtonNames = [
153+
"Room options",
154+
"Video rooms are a beta feature Click for more info", // Beta pill
155+
"Invite",
156+
"Chat",
157+
"Room info",
158+
];
159+
160+
// Assert they are found and visible
161+
for (const name of expectedButtonNames) {
162+
await expect(header.getByRole("button", { name })).toBeVisible();
163+
}
164+
165+
// Assert that there is not a button except those buttons
166+
await expect(header.getByRole("button")).toHaveCount(7);
167+
168+
await expect(header).toMatchScreenshot("room-header-video-room.png");
169+
});
172170
});
173171

174172
test("should render a working chat button which opens the timeline on a right panel", async ({

0 commit comments

Comments
 (0)