Hide tooltips for certain playwright screenshots to avoid flakiness (#12770)
* Hide tooltips for certain playwright screenshots to avoid flakiness Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Typo Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * tsc Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/28217/head
parent
08ee1b8d97
commit
1082d767d4
|
@ -410,6 +410,7 @@ test.describe("Timeline", () => {
|
|||
{
|
||||
// Exclude timestamp from snapshot of mx_MainSplit
|
||||
mask: [page.locator(".mx_MessageTimestamp")],
|
||||
hideTooltips: true,
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -427,6 +428,7 @@ test.describe("Timeline", () => {
|
|||
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot("expanded-gels-and-messages-irc-layout.png", {
|
||||
// Exclude timestamp from snapshot of mx_MainSplit
|
||||
mask: [page.locator(".mx_MessageTimestamp")],
|
||||
hideTooltips: true,
|
||||
});
|
||||
|
||||
// 3. Alignment of expanded GELS and placeholder of deleted message
|
||||
|
@ -447,6 +449,7 @@ test.describe("Timeline", () => {
|
|||
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot("expanded-gels-redaction-placeholder.png", {
|
||||
// Exclude timestamp from snapshot of mx_MainSplit
|
||||
mask: [page.locator(".mx_MessageTimestamp")],
|
||||
hideTooltips: true,
|
||||
});
|
||||
|
||||
// 4. Alignment of expanded GELS, placeholder of deleted message, and emote
|
||||
|
@ -469,6 +472,7 @@ test.describe("Timeline", () => {
|
|||
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot("expanded-gels-emote-irc-layout.png", {
|
||||
// Exclude timestamp from snapshot of mx_MainSplit
|
||||
mask: [page.locator(".mx_MessageTimestamp")],
|
||||
hideTooltips: true,
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -481,6 +485,7 @@ test.describe("Timeline", () => {
|
|||
display: none !important;
|
||||
}
|
||||
`,
|
||||
hideTooltips: true,
|
||||
};
|
||||
|
||||
await sendEvent(app.client, room.roomId);
|
||||
|
|
|
@ -306,12 +306,22 @@ export const expect = baseExpect.extend({
|
|||
options?: {
|
||||
mask?: Array<Locator>;
|
||||
omitBackground?: boolean;
|
||||
hideTooltips?: boolean;
|
||||
timeout?: number;
|
||||
css?: string;
|
||||
},
|
||||
) {
|
||||
const page = "page" in receiver ? receiver.page() : receiver;
|
||||
|
||||
let hideTooltipsCss: string | undefined;
|
||||
if (options?.hideTooltips) {
|
||||
hideTooltipsCss = `
|
||||
.mx_Tooltip_visible {
|
||||
visibility: hidden !important;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
// We add a custom style tag before taking screenshots
|
||||
const style = (await page.addStyleTag({
|
||||
content: `
|
||||
|
@ -339,6 +349,7 @@ export const expect = baseExpect.extend({
|
|||
.mx_MessageTimestamp {
|
||||
font-family: Inconsolata !important;
|
||||
}
|
||||
${hideTooltipsCss ?? ""}
|
||||
${options?.css ?? ""}
|
||||
`,
|
||||
})) as ElementHandle<Element>;
|
||||
|
|
Loading…
Reference in New Issue