Add tests about room list order (#12088)

This commit is contained in:
Florian Duros
2023-12-29 11:06:51 +01:00
committed by GitHub
parent b3fec2a0d9
commit f6fc91196f
2 changed files with 68 additions and 1 deletions
+31
View File
@@ -590,6 +590,37 @@ class Helpers {
async receiveMessages(room: string | { name: string }, messages: Message[]) {
await this.sendMessageAsClient(this.bot, room, messages);
}
/**
* Open the room list menu
*/
async toggleRoomListMenu() {
const tile = this.getRoomListTile("Rooms");
await tile.hover();
const button = tile.getByLabel("List options");
await button.click();
}
/**
* Toggle the `Show rooms with unread messages first` option for the room list
*/
async toggleRoomUnreadOrder() {
await this.toggleRoomListMenu();
await this.page.getByText("Show rooms with unread messages first").click();
// Close contextual menu
await this.page.locator(".mx_ContextualMenu_background").click();
}
/**
* Assert that the room list is ordered as expected
* @param rooms
*/
async assertRoomListOrder(rooms: Array<{ name: string }>) {
const roomList = this.page.locator(".mx_RoomTile_title");
for (const [i, room] of rooms.entries()) {
await expect(roomList.nth(i)).toHaveText(room.name);
}
}
}
/**