Add new playwright test for shield migration (#12237)

* Add new playwright test for shield migration

* missing import

* fix merge error duplicated tests
This commit is contained in:
Valere 2024-02-13 09:46:39 +01:00 committed by GitHub
parent 9b5401dcec
commit 5f8a390f2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 125 additions and 45 deletions

View file

@ -260,3 +260,35 @@ export async function createSharedRoomWithUser(
return roomId;
}
/**
* Send a message in the current room
* @param page
* @param message - The message text to send
*/
export async function sendMessageInCurrentRoom(page: Page, message: string): Promise<void> {
await page.locator(".mx_MessageComposer").getByRole("textbox").fill(message);
await page.getByTestId("sendmessagebtn").click();
}
/**
* Create a room with the given name and encryption status using the room creation dialog.
*
* @param roomName - The name of the room to create
* @param isEncrypted - Whether the room should be encrypted
*/
export async function createRoom(page: Page, roomName: string, isEncrypted: boolean): Promise<void> {
await page.getByRole("button", { name: "Add room" }).click();
await page.locator(".mx_IconizedContextMenu").getByRole("menuitem", { name: "New room" }).click();
const dialog = page.locator(".mx_Dialog");
await dialog.getByLabel("Name").fill(roomName);
if (!isEncrypted) {
// it's enabled by default
await page.getByLabel("Enable end-to-end encryption").click();
}
await dialog.getByRole("button", { name: "Create room" }).click();
}