1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-28 15:22:05 +03:00

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>
This commit is contained in:
Michael Telatynski
2024-07-12 12:23:53 +01:00
committed by GitHub
parent 08ee1b8d97
commit 1082d767d4
2 changed files with 16 additions and 0 deletions

View File

@ -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>;