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

Commit fbd64d3

Browse files
Migrate create-room.spec.ts from Cypress to Playwright (#11941)
* Install playwright Signed-off-by: Michael Telatynski <[email protected]> * Add foundations for writing tests under Playwright Signed-off-by: Michael Telatynski <[email protected]> * .gitignore juggling Signed-off-by: Michael Telatynski <[email protected]> * Add tsconfig and fix eslint rules Signed-off-by: Michael Telatynski <[email protected]> * Add docker & synapse plugins Signed-off-by: Michael Telatynski <[email protected]> * Add login.spec.ts Signed-off-by: Michael Telatynski <[email protected]> * Wire up fixture which sets up ElementAppPage & bakes config.json Signed-off-by: Michael Telatynski <[email protected]> * Remove launch test, it has served its purpose Signed-off-by: Michael Telatynski <[email protected]> * Remove test which has been ported to Playwright Signed-off-by: Michael Telatynski <[email protected]> * Fix test not cleaning up after itself Signed-off-by: Michael Telatynski <[email protected]> * Move registerUser to the Homeserver interface Signed-off-by: Michael Telatynski <[email protected]> * Remove unused fixture param Signed-off-by: Michael Telatynski <[email protected]> * Remove redundant launch test Signed-off-by: Michael Telatynski <[email protected]> * Add newline * Run both legacy & rust crypto tests in Playwright Signed-off-by: Michael Telatynski <[email protected]> * Remove redundant comment Signed-off-by: Michael Telatynski <[email protected]> * Create plugin for mail-hog * Move injectAxe into element-web-test.ts Signed-off-by: Michael Telatynski <[email protected]> * Switch out axe-playwright for @axe-core/playwright Signed-off-by: Michael Telatynski <[email protected]> * Migrate email.spec.ts from Cypress to Playwright Signed-off-by: Michael Telatynski <[email protected]> * prettier Signed-off-by: Michael Telatynski <[email protected]> * Use Playwright snapshot utility over Percy Signed-off-by: Michael Telatynski <[email protected]> * Remove commented our Percy badge as we're unlikely to want to go back Signed-off-by: Michael Telatynski <[email protected]> * Migrate user-onboarding-old.spec.ts Signed-off-by: Michael Telatynski <[email protected]> * Migrate user-onboarding-new.spec.ts Signed-off-by: Michael Telatynski <[email protected]> * Add screenshots Signed-off-by: Michael Telatynski <[email protected]> * Fix bad merge Signed-off-by: Michael Telatynski <[email protected]> * Fix test and re-enable Signed-off-by: Michael Telatynski <[email protected]> * Run linters on playwright Signed-off-by: Michael Telatynski <[email protected]> * Make typescript happier Signed-off-by: Michael Telatynski <[email protected]> * Fix types Signed-off-by: Michael Telatynski <[email protected]> * Update typescript Signed-off-by: Michael Telatynski <[email protected]> * Migrate create-room.spec.ts from Cypress to Playwright Signed-off-by: Michael Telatynski <[email protected]> * prettier Signed-off-by: Michael Telatynski <[email protected]> --------- Signed-off-by: Michael Telatynski <[email protected]> Co-authored-by: R Midhun Suresh <[email protected]>
1 parent f7aab0e commit fbd64d3

File tree

3 files changed

+52
-60
lines changed

3 files changed

+52
-60
lines changed

cypress/e2e/create-room/create-room.spec.ts

Lines changed: 0 additions & 60 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
19+
test.describe("Create Room", () => {
20+
test.use({ displayName: "Jim" });
21+
22+
test("should allow us to create a public room with name, topic & address set", async ({ page, user, app }) => {
23+
const name = "Test room 1";
24+
const topic = "This room is dedicated to this test and this test only!";
25+
26+
const dialog = await app.openCreateRoomDialog();
27+
// Fill name & topic
28+
await dialog.getByRole("textbox", { name: "Name" }).fill(name);
29+
await dialog.getByRole("textbox", { name: "Topic" }).fill(topic);
30+
// Change room to public
31+
await dialog.getByRole("button", { name: "Room visibility" }).click();
32+
await dialog.getByRole("option", { name: "Public room" }).click();
33+
// Fill room address
34+
await dialog.getByRole("textbox", { name: "Room address" }).fill("test-room-1");
35+
// Submit
36+
await dialog.getByRole("button", { name: "Create room" }).click();
37+
38+
await expect(page).toHaveURL(/\/#\/room\/#test-room-1:localhost/);
39+
const header = page.locator(".mx_LegacyRoomHeader");
40+
await expect(header).toContainText(name);
41+
await expect(header).toContainText(topic);
42+
});
43+
});

playwright/pages/ElementAppPage.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ export class ElementAppPage {
5252
return this.page.locator(".mx_UserSettingsDialog");
5353
}
5454

55+
/**
56+
* Open room creation dialog.
57+
*/
58+
public async openCreateRoomDialog(): Promise<Locator> {
59+
await this.page.getByRole("button", { name: "Add room", exact: true }).click();
60+
await this.page.getByRole("menuitem", { name: "New room", exact: true }).click();
61+
return this.page.locator(".mx_CreateRoomDialog");
62+
}
63+
5564
/**
5665
* Create a room with given options.
5766
* @param options the options to apply when creating the room

0 commit comments

Comments
 (0)