Improve stability of Playwright screenshot tests (#11983)
This commit is contained in:
parent
74ea0d134e
commit
e180ca841b
23 changed files with 71 additions and 80 deletions
|
@ -33,9 +33,7 @@ test.describe("Appearance user settings tab", () => {
|
|||
// Assert that "Hide advanced" link button is rendered
|
||||
await expect(tab.getByRole("button", { name: "Hide advanced" })).toBeVisible();
|
||||
|
||||
await expect(tab).toHaveScreenshot("appearance-tab.png", {
|
||||
mask: [tab.locator(".mx_DisambiguatedProfile_displayName, .mx_BaseAvatar")],
|
||||
});
|
||||
await expect(tab).toMatchScreenshot("appearance-tab.png");
|
||||
});
|
||||
|
||||
test("should support switching layouts", async ({ page, user, app }) => {
|
||||
|
@ -94,7 +92,7 @@ test.describe("Appearance user settings tab", () => {
|
|||
fontSliderSection.locator("output .mx_Slider_selection_label", { hasText: String(MIN_FONT_SIZE) }),
|
||||
).toBeVisible();
|
||||
|
||||
await expect(fontSliderSection).toHaveScreenshot(`font-slider-${MIN_FONT_SIZE}.png`);
|
||||
await expect(fontSliderSection).toMatchScreenshot(`font-slider-${MIN_FONT_SIZE}.png`);
|
||||
|
||||
// Click the right position of the slider
|
||||
await slider.click({ position: { x: 572, y: 10 } });
|
||||
|
@ -106,7 +104,7 @@ test.describe("Appearance user settings tab", () => {
|
|||
fontSliderSection.locator("output .mx_Slider_selection_label", { hasText: String(MAX_FONT_SIZE) }),
|
||||
).toBeVisible();
|
||||
|
||||
await expect(fontSliderSection).toHaveScreenshot(`font-slider-${MAX_FONT_SIZE}.png`);
|
||||
await expect(fontSliderSection).toMatchScreenshot(`font-slider-${MAX_FONT_SIZE}.png`);
|
||||
});
|
||||
|
||||
test("should disable font size slider when custom font size is used", async ({ page, app, user }) => {
|
||||
|
|
|
@ -34,7 +34,7 @@ test.describe("General room settings tab", () => {
|
|||
// Assert that "Show less" details element is rendered
|
||||
await expect(settings.getByText("Show less")).toBeVisible();
|
||||
|
||||
await expect(settings).toHaveScreenshot();
|
||||
await expect(settings).toMatchScreenshot();
|
||||
|
||||
// Click the "Show less" details element
|
||||
await settings.getByText("Show less").click();
|
||||
|
|
|
@ -35,7 +35,7 @@ test.describe("General user settings tab", () => {
|
|||
});
|
||||
|
||||
test("should be rendered properly", async ({ uut }) => {
|
||||
await expect(uut).toHaveScreenshot("general.png", {
|
||||
await expect(uut).toMatchScreenshot("general.png", {
|
||||
// Exclude userId from snapshots
|
||||
mask: [uut.locator(".mx_ProfileSettings_profile_controls > p")],
|
||||
});
|
||||
|
|
|
@ -26,6 +26,6 @@ test.describe("Preferences user settings tab", () => {
|
|||
|
||||
// Assert that the top heading is rendered
|
||||
await expect(tab.getByRole("heading", { name: "Preferences" })).toBeVisible();
|
||||
await expect(tab).toHaveScreenshot();
|
||||
await expect(tab).toMatchScreenshot();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -44,7 +44,7 @@ test.describe("Security user settings tab", () => {
|
|||
test("should be rendered properly", async ({ app, page }) => {
|
||||
const tab = await app.settings.openUserSettings("Security");
|
||||
await tab.getByRole("button", { name: "Learn more" }).click();
|
||||
await expect(page.locator(".mx_AnalyticsLearnMoreDialog_wrapper .mx_Dialog")).toHaveScreenshot();
|
||||
await expect(page.locator(".mx_AnalyticsLearnMoreDialog_wrapper .mx_Dialog")).toMatchScreenshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue