Playwright: Convert sliding-sync test to playwright (#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
This commit is contained in:
R Midhun Suresh 2023-12-16 15:31:26 +05:30 committed by GitHub
parent de5931d5a8
commit 7b3d5b5f21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 547 additions and 770 deletions

View file

@ -25,10 +25,9 @@ test.describe("Room Header", () => {
});
test.describe("with feature_notifications enabled", () => {
test.beforeEach(async ({ app }) => {
await app.labs.enableLabsFeature("feature_notifications");
test.use({
labsFlags: ["feature_notifications"],
});
test("should render default buttons properly", async ({ page, app, user }) => {
await app.client.createRoom({ name: "Test Room" });
await app.viewRoomByName("Test Room");
@ -101,9 +100,7 @@ test.describe("Room Header", () => {
});
test.describe("with feature_pinning enabled", () => {
test.beforeEach(async ({ app }) => {
await app.labs.enableLabsFeature("feature_pinning");
});
test.use({ labsFlags: ["feature_pinning"] });
test("should render the pin button for pinned messages card", async ({ page, app, user }) => {
await app.client.createRoom({ name: "Test Room" });
@ -126,9 +123,7 @@ test.describe("Room Header", () => {
});
test.describe("with a video room", () => {
test.beforeEach(async ({ app }) => {
await app.labs.enableLabsFeature("feature_video_rooms");
});
test.use({ labsFlags: ["feature_video_rooms"] });
const createVideoRoom = async (page: Page, app: ElementAppPage) => {
await page.locator(".mx_LeftPanel_roomListContainer").getByRole("button", { name: "Add room" }).click();
@ -142,33 +137,36 @@ test.describe("Room Header", () => {
await app.viewRoomByName("Test video room");
};
test("should render buttons for room options, beta pill, invite, chat, and room info", async ({
page,
app,
user,
}) => {
await app.labs.enableLabsFeature("feature_notifications");
await createVideoRoom(page, app);
test.describe("and with feature_notifications enabled", () => {
test.use({ labsFlags: ["feature_video_rooms", "feature_notifications"] });
const header = page.locator(".mx_LegacyRoomHeader");
// Names (aria-label) of the buttons on the video room header
const expectedButtonNames = [
"Room options",
"Video rooms are a beta feature Click for more info", // Beta pill
"Invite",
"Chat",
"Room info",
];
test("should render buttons for room options, beta pill, invite, chat, and room info", async ({
page,
app,
user,
}) => {
await createVideoRoom(page, app);
// Assert they are found and visible
for (const name of expectedButtonNames) {
await expect(header.getByRole("button", { name })).toBeVisible();
}
const header = page.locator(".mx_LegacyRoomHeader");
// Names (aria-label) of the buttons on the video room header
const expectedButtonNames = [
"Room options",
"Video rooms are a beta feature Click for more info", // Beta pill
"Invite",
"Chat",
"Room info",
];
// Assert that there is not a button except those buttons
await expect(header.getByRole("button")).toHaveCount(7);
// Assert they are found and visible
for (const name of expectedButtonNames) {
await expect(header.getByRole("button", { name })).toBeVisible();
}
await expect(header).toMatchScreenshot("room-header-video-room.png");
// Assert that there is not a button except those buttons
await expect(header.getByRole("button")).toHaveCount(7);
await expect(header).toMatchScreenshot("room-header-video-room.png");
});
});
test("should render a working chat button which opens the timeline on a right panel", async ({