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

Commit bb1b7f1

Browse files
Default the room header to on (#12803)
* Default the room header to on * Refactor code into helper method Add a method to open/close the room info panel and use it everywhere. * Fix broken tests, update snapshots and screenshots * Update room header tests to make sense with the new header
1 parent 25fcd6a commit bb1b7f1

File tree

59 files changed

+591
-393
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+591
-393
lines changed

playwright/e2e/app-loading/stored-credentials.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ test("Shows the last known page on reload", async ({ pageWithCredentials: page }
4848

4949
// Check that the room reloaded
5050
await expect(page).toHaveURL(/\/#\/room\//);
51-
await expect(page.locator(".mx_LegacyRoomHeader")).toContainText("Test Room");
51+
await expect(page.locator(".mx_RoomHeader")).toContainText("Test Room");
5252
});
5353

5454
test("Room link correctly loads a room view", async ({ pageWithCredentials: page }) => {

playwright/e2e/chat-export/html-export.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ test.describe("HTML Export", () => {
108108
page.locator(".mx_EventTile_last .mx_MTextBody .mx_EventTile_body").getByText("Testing 9"),
109109
).toBeVisible();
110110

111-
await page.getByRole("button", { name: "Room info" }).click();
111+
await app.toggleRoomInfoPanel();
112112
await page.getByRole("menuitem", { name: "Export Chat" }).click();
113113

114114
const downloadPromise = page.waitForEvent("download");

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test.describe("Create Room", () => {
3636
await dialog.getByRole("button", { name: "Create room" }).click();
3737

3838
await expect(page).toHaveURL(/\/#\/room\/#test-room-1:localhost/);
39-
const header = page.locator(".mx_LegacyRoomHeader");
39+
const header = page.locator(".mx_RoomHeader");
4040
await expect(header).toContainText(name);
4141
await expect(header).toContainText(topic);
4242
});

playwright/e2e/crypto/crypto.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ test.describe("Cryptography", function () {
224224
await checkDMRoom(page);
225225
const bobRoomId = await bobJoin(page, bob);
226226
await testMessages(page, bob, bobRoomId);
227-
await verify(page, bob);
227+
await verify(app, bob);
228228

229229
// Assert that verified icon is rendered
230230
await page.getByTestId("base-card-back-button").click();
@@ -246,6 +246,6 @@ test.describe("Cryptography", function () {
246246

247247
// we need to have a room with the other user present, so we can open the verification panel
248248
await createSharedRoomWithUser(app, bob.credentials.userId);
249-
await verify(page, bob);
249+
await verify(app, bob);
250250
});
251251
});

playwright/e2e/crypto/event-shields.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ test.describe("Cryptography", function () {
104104
await expect(lastTileE2eIcon).not.toBeVisible();
105105

106106
/* Now verify Bob */
107-
await verify(page, bob);
107+
await verify(app, bob);
108108

109109
/* Existing message should be updated when user is verified. */
110110
await expect(last).toContainText("test encrypted 1");
@@ -222,7 +222,7 @@ test.describe("Cryptography", function () {
222222
await bobSecondDevice.prepareClient();
223223

224224
// verify Bob
225-
await verify(page, bob);
225+
await verify(app, bob);
226226

227227
// bob sends a valid event
228228
const testEvent = await bob.sendMessage(testRoomId, "Hoo!");

playwright/e2e/crypto/utils.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -329,15 +329,6 @@ export async function createRoom(page: Page, roomName: string, isEncrypted: bool
329329
}
330330
}
331331

332-
/**
333-
* Open the room info panel and return the panel element
334-
* @param page - the page to use
335-
*/
336-
export const openRoomInfo = async (page: Page) => {
337-
await page.getByRole("button", { name: "Room info" }).click();
338-
return page.locator(".mx_RightPanel");
339-
};
340-
341332
/**
342333
* Configure the given MatrixClient to auto-accept any invites
343334
* @param client - the client to configure
@@ -357,10 +348,11 @@ export async function autoJoin(client: Client) {
357348
* @param page - the page to use
358349
* @param bob - the user to verify
359350
*/
360-
export const verify = async (page: Page, bob: Bot) => {
351+
export const verify = async (app: ElementAppPage, bob: Bot) => {
352+
const page = app.page;
361353
const bobsVerificationRequestPromise = waitForVerificationRequest(bob);
362354

363-
const roomInfo = await openRoomInfo(page);
355+
const roomInfo = await app.toggleRoomInfoPanel();
364356
await page.locator(".mx_RightPanelTabs").getByText("People").click();
365357
await roomInfo.getByText("Bob").click();
366358
await roomInfo.getByRole("button", { name: "Verify" }).click();

playwright/e2e/file-upload/image-upload.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ test.describe("Image Upload", () => {
3838
.locator(".mx_MessageComposer_actions input[type='file']")
3939
.setInputFiles("playwright/sample-files/riot.png");
4040

41-
expect(page.getByRole("button", { name: "Upload" })).toBeEnabled();
42-
expect(page.getByRole("button", { name: "Close dialog" })).toBeEnabled();
43-
expect(page).toMatchScreenshot("image-upload-preview.png");
41+
await expect(page.getByRole("button", { name: "Upload" })).toBeEnabled();
42+
await expect(page.getByRole("button", { name: "Close dialog" })).toBeEnabled();
43+
await expect(page).toMatchScreenshot("image-upload-preview.png");
4444
});
4545
});

playwright/e2e/integration-manager/get-openid-token.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ test.describe("Integration Manager: Get OpenID Token", () => {
118118
await app.viewRoomByName(ROOM_NAME);
119119
});
120120

121-
test("should successfully obtain an openID token", async ({ page }) => {
122-
await openIntegrationManager(page);
121+
test("should successfully obtain an openID token", async ({ page, app }) => {
122+
await openIntegrationManager(app);
123123
await sendActionFromIntegrationManager(page, integrationManagerUrl);
124124

125125
const iframe = page.frameLocator(`iframe[src*="${integrationManagerUrl}"]`);

playwright/e2e/integration-manager/kick.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ test.describe("Integration Manager: Kick", () => {
167167
await app.client.inviteUser(room.roomId, targetUser.credentials.userId);
168168
await expect(page.getByText(`${BOT_DISPLAY_NAME} joined the room`)).toBeVisible();
169169

170-
await openIntegrationManager(page);
170+
await openIntegrationManager(app);
171171
await sendActionFromIntegrationManager(page, integrationManagerUrl, room.roomId, targetUser.credentials.userId);
172172
await closeIntegrationManager(page, integrationManagerUrl);
173173
await expectKickedMessage(page, true);
@@ -185,7 +185,7 @@ test.describe("Integration Manager: Kick", () => {
185185
},
186186
});
187187

188-
await openIntegrationManager(page);
188+
await openIntegrationManager(app);
189189
await sendActionFromIntegrationManager(page, integrationManagerUrl, room.roomId, targetUser.credentials.userId);
190190
await closeIntegrationManager(page, integrationManagerUrl);
191191
await expectKickedMessage(page, false);
@@ -197,7 +197,7 @@ test.describe("Integration Manager: Kick", () => {
197197
await expect(page.getByText(`${BOT_DISPLAY_NAME} joined the room`)).toBeVisible();
198198
await targetUser.leave(room.roomId);
199199

200-
await openIntegrationManager(page);
200+
await openIntegrationManager(app);
201201
await sendActionFromIntegrationManager(page, integrationManagerUrl, room.roomId, targetUser.credentials.userId);
202202
await closeIntegrationManager(page, integrationManagerUrl);
203203
await expectKickedMessage(page, false);
@@ -209,7 +209,7 @@ test.describe("Integration Manager: Kick", () => {
209209
await expect(page.getByText(`${BOT_DISPLAY_NAME} joined the room`)).toBeVisible();
210210
await app.client.ban(room.roomId, targetUser.credentials.userId);
211211

212-
await openIntegrationManager(page);
212+
await openIntegrationManager(app);
213213
await sendActionFromIntegrationManager(page, integrationManagerUrl, room.roomId, targetUser.credentials.userId);
214214
await closeIntegrationManager(page, integrationManagerUrl);
215215
await expectKickedMessage(page, false);
@@ -218,7 +218,7 @@ test.describe("Integration Manager: Kick", () => {
218218
test("should no-op if the target was never a room member", async ({ page, app, bot: targetUser, room }) => {
219219
await app.viewRoomByName(ROOM_NAME);
220220

221-
await openIntegrationManager(page);
221+
await openIntegrationManager(app);
222222
await sendActionFromIntegrationManager(page, integrationManagerUrl, room.roomId, targetUser.credentials.userId);
223223
await closeIntegrationManager(page, integrationManagerUrl);
224224
await expectKickedMessage(page, false);

playwright/e2e/integration-manager/read_events.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ test.describe("Integration Manager: Read Events", () => {
142142

143143
// Send a state event
144144
const sendEventResponse = await app.client.sendStateEvent(room.roomId, eventType, eventContent, stateKey);
145-
await openIntegrationManager(page);
145+
await openIntegrationManager(app);
146146

147147
// Read state events
148148
await sendActionFromIntegrationManager(page, integrationManagerUrl, room.roomId, eventType, stateKey);
@@ -162,7 +162,7 @@ test.describe("Integration Manager: Read Events", () => {
162162

163163
// Send a state event
164164
const sendEventResponse = await app.client.sendStateEvent(room.roomId, eventType, eventContent, stateKey);
165-
await openIntegrationManager(page);
165+
await openIntegrationManager(app);
166166

167167
// Read state events
168168
await sendActionFromIntegrationManager(page, integrationManagerUrl, room.roomId, eventType, stateKey);
@@ -196,7 +196,7 @@ test.describe("Integration Manager: Read Events", () => {
196196
app.client.sendStateEvent(room.roomId, eventType, eventContent3, stateKey3),
197197
]);
198198

199-
await openIntegrationManager(page);
199+
await openIntegrationManager(app);
200200

201201
// Read state events
202202
await sendActionFromIntegrationManager(
@@ -217,11 +217,11 @@ test.describe("Integration Manager: Read Events", () => {
217217
await expect(iframe.locator("#message-response")).toContainText(`"content":${JSON.stringify(eventContent3)}`);
218218
});
219219

220-
test("should fail to read an event type which is not allowed", async ({ page, room }) => {
220+
test("should fail to read an event type which is not allowed", async ({ page, app, room }) => {
221221
const eventType = "com.example.event";
222222
const stateKey = "";
223223

224-
await openIntegrationManager(page);
224+
await openIntegrationManager(app);
225225

226226
// Read state events
227227
await sendActionFromIntegrationManager(page, integrationManagerUrl, room.roomId, eventType, stateKey);

0 commit comments

Comments
 (0)