Improve stability of Playwright screenshots (#12009)

* Stabilise bot MXID length

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

* Stabilise test user MXID

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-07 10:32:23 +00:00 committed by GitHub
parent d6d3585c30
commit 5ae5855fd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 15 additions and 22 deletions

View file

@ -48,9 +48,7 @@ test.describe("Invite dialog", function () {
// Assert that the bar is rendered
await expect(other.locator(".mx_InviteDialog_addressBar")).toBeVisible();
await expect(page.locator(".mx_Dialog")).toMatchScreenshot("invite-dialog-room-without-user.png", {
mask: [page.locator(".mx_InviteDialog_helpText_userId")],
});
await expect(page.locator(".mx_Dialog")).toMatchScreenshot("invite-dialog-room-without-user.png");
await expect(other.locator(".mx_InviteDialog_identityServer")).not.toBeVisible();
@ -71,9 +69,7 @@ test.describe("Invite dialog", function () {
).toBeVisible();
// Take a snapshot of the invite dialog with a user pill
await expect(page.locator(".mx_Dialog")).toMatchScreenshot("invite-dialog-room-with-user-pill.png", {
mask: [page.locator(".mx_InviteDialog_helpText_userId")],
});
await expect(page.locator(".mx_Dialog")).toMatchScreenshot("invite-dialog-room-with-user-pill.png");
// Invite the bot
await other.getByRole("button", { name: "Invite" }).click();
@ -96,9 +92,7 @@ test.describe("Invite dialog", function () {
await expect(other.locator(".mx_InviteDialog_addressBar")).toBeVisible();
// Take a snapshot of the invite dialog
await expect(page.locator(".mx_Dialog")).toMatchScreenshot("invite-dialog-dm-without-user.png", {
mask: [page.locator(".mx_InviteDialog_footer_link, .mx_InviteDialog_helpText a")],
});
await expect(page.locator(".mx_Dialog")).toMatchScreenshot("invite-dialog-dm-without-user.png");
await other.getByTestId("invite-dialog-input").fill(bot.credentials.userId);
@ -110,9 +104,7 @@ test.describe("Invite dialog", function () {
).toBeVisible();
// Take a snapshot of the invite dialog with a user pill
await expect(page.locator(".mx_Dialog")).toMatchScreenshot("invite-dialog-dm-with-user-pill.png", {
mask: [page.locator(".mx_InviteDialog_footer_link, .mx_InviteDialog_helpText a")],
});
await expect(page.locator(".mx_Dialog")).toMatchScreenshot("invite-dialog-dm-with-user-pill.png");
// Open a direct message UI
await other.getByRole("button", { name: "Go" }).click();

View file

@ -136,8 +136,8 @@ test.describe("FilePanel", () => {
// Take a snapshot of file tiles list on FilePanel
await expect(filePanelMessageList).toMatchScreenshot("file-tiles-list.png", {
// Exclude timestamps, profile & flaky seek bar from snapshot
mask: [page.locator(".mx_MessageTimestamp, .mx_DisambiguatedProfile, .mx_AudioPlayer_seek")],
// Exclude timestamps & flaky seek bar from snapshot
mask: [page.locator(".mx_MessageTimestamp, .mx_AudioPlayer_seek")],
});
});

View file

@ -35,10 +35,7 @@ test.describe("General user settings tab", () => {
});
test("should be rendered properly", async ({ uut }) => {
await expect(uut).toMatchScreenshot("general.png", {
// Exclude userId from snapshots
mask: [uut.locator(".mx_ProfileSettings_profile_controls > p")],
});
await expect(uut).toMatchScreenshot("general.png");
// Assert that the top heading is rendered
await expect(uut.getByRole("heading", { name: "General" })).toBeVisible();