1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-30 02:21:17 +03:00

Migrate audio-player.spec.ts from Cypress to Playwright (#12008)

* Migrate audio-player.spec.ts from Cypress to Playwright

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

* Stabilise screenshots

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

* Stabilise bot MXID length

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

* Stabilise test user MXID

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

* Stabilise timestamps

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

* Update screenshots

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

* Update element-web-test.ts

* Use deterministic monospace font

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

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2023-12-11 14:36:30 +00:00
committed by GitHub
parent f9b50938de
commit 6199287fe7
21 changed files with 364 additions and 389 deletions

View File

@ -211,7 +211,17 @@ export const test = base.extend<
});
export const expect = baseExpect.extend({
async toMatchScreenshot(this: ExpectMatcherState, receiver: Page | Locator, ...args) {
async toMatchScreenshot(
this: ExpectMatcherState,
receiver: Page | Locator,
name?: `${string}.png`,
options?: {
mask?: Array<Locator>;
omitBackground?: boolean;
timeout?: number;
css?: string;
},
) {
const page = "page" in receiver ? receiver.page() : receiver;
// We add a custom style tag before taking screenshots
@ -233,10 +243,11 @@ export const expect = baseExpect.extend({
.mx_ReplyChain {
border-left-color: var(--cpd-color-blue-1200) !important;
}
${options?.css ?? ""}
`,
})) as ElementHandle<Element>;
await baseExpect(receiver).toHaveScreenshot(...args);
await baseExpect(receiver).toHaveScreenshot(name, options);
await style.evaluate((tag) => tag.remove());
return { pass: true, message: () => "", name: "toMatchScreenshot" };