Migrate location.spec.ts from Cypress to Playwright (#11945)

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2023-11-28 00:37:20 +00:00 committed by GitHub
parent 0bbb9e8c89
commit 33d527ee5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 93 additions and 74 deletions

View file

@ -61,6 +61,13 @@ export class ElementAppPage {
return this.page.locator(".mx_CreateRoomDialog");
}
/**
* Close dialog currently open dialog
*/
public async closeDialog(): Promise<void> {
return this.page.getByRole("button", { name: "Close dialog", exact: true }).click();
}
/**
* Create a room with given options.
* @param options the options to apply when creating the room
@ -74,4 +81,23 @@ export class ElementAppPage {
.then((res) => res.room_id);
}, options);
}
/**
* Get the composer element
* @param isRightPanel whether to select the right panel composer, otherwise the main timeline composer
*/
public async getComposer(isRightPanel?: boolean): Promise<Locator> {
const panelClass = isRightPanel ? ".mx_RightPanel" : ".mx_RoomView_body";
return this.page.locator(`${panelClass} .mx_MessageComposer`);
}
/**
* Open the message composer kebab menu
* @param isRightPanel whether to select the right panel composer, otherwise the main timeline composer
*/
public async openMessageComposerOptions(isRightPanel?: boolean): Promise<Locator> {
const composer = await this.getComposer(isRightPanel);
await composer.getByRole("button", { name: "More options", exact: true }).click();
return this.page.getByRole("menu");
}
}