Migrate room/* from Cypress to Playwright (#11985)

* Remove old percy media query CSS

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Stabilise soft_logout.spec.ts

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update screenshots using `toMatchScreenshot` assertion with CSS overrides

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Fix accidentally commented test

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Migrate room/* from Cypress to Playwright

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* delint

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add screenshots

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update labs.ts

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2023-12-04 12:01:06 +00:00 committed by GitHub
parent eb6101cc1b
commit b02ff16a21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 409 additions and 373 deletions

View file

@ -82,7 +82,7 @@ export class ElementAppPage {
* 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> {
public getComposer(isRightPanel?: boolean): Locator {
const panelClass = isRightPanel ? ".mx_RightPanel" : ".mx_RoomView_body";
return this.page.locator(`${panelClass} .mx_MessageComposer`);
}
@ -92,7 +92,7 @@ export class ElementAppPage {
* @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);
const composer = this.getComposer(isRightPanel);
await composer.getByRole("button", { name: "More options", exact: true }).click();
return this.page.getByRole("menu");
}

View file

@ -21,12 +21,17 @@ export class Labs {
/**
* Enables a labs feature for an element session.
* Has to be called before the session is initialized
* @param feature labsFeature to enable (e.g. "feature_spotlight")
*/
public async enableLabsFeature(feature: string): Promise<void> {
await this.page.evaluate((feature) => {
window.localStorage.setItem(`mx_labs_feature_${feature}`, "true");
}, feature);
if (this.page.url() === "about:blank") {
await this.page.addInitScript((feature) => {
window.localStorage.setItem(`mx_labs_feature_${feature}`, "true");
}, feature);
} else {
await this.page.evaluate((feature) => {
window.localStorage.setItem(`mx_labs_feature_${feature}`, "true");
}, feature);
}
}
}