diff --git a/playwright/e2e/timeline/timeline.spec.ts b/playwright/e2e/timeline/timeline.spec.ts index d6f791e50b..e5bfa0c71b 100644 --- a/playwright/e2e/timeline/timeline.spec.ts +++ b/playwright/e2e/timeline/timeline.spec.ts @@ -1341,4 +1341,44 @@ test.describe("Timeline", () => { ); }); }); + + test.describe("spoilers", { tag: "@screenshot" }, () => { + test("clicking a spoiler containing the pill de-spoilers on 1st click, then follows link on 2nd", async ({ + page, + user, + app, + room, + }) => { + // View room + await page.goto(`/#/room/${room.roomId}`); + + // Send a spoilered pill + await app.client.sendMessage(room.roomId, { + msgtype: "m.text", + body: user.userId, + format: "org.matrix.custom.html", + formatted_body: `https://matrix.to/#/${user.userId}`, + }); + + const screenshotOptions = { + css: ` + .mx_MessageTimestamp { + display: none !important; + } + `, + }; + + const eventTile = page.locator(".mx_RoomView_body .mx_EventTile_last"); + await expect(eventTile).toMatchScreenshot("spoiler.png", screenshotOptions); + + const rightPanelButton = page.getByText("Share profile"); + const pill = page.locator(".mx_UserPill"); + await pill.click({ force: true }); // force to click the spoiler wrapper instead + await expect(eventTile).toMatchScreenshot("spoiler-uncovered.png", screenshotOptions); + await expect(rightPanelButton).not.toBeVisible(); // assert the right panel is not yet open + + await pill.click(); + await expect(rightPanelButton).toBeVisible(); // assert the right panel is open + }); + }); }); diff --git a/playwright/pages/ElementAppPage.ts b/playwright/pages/ElementAppPage.ts index 15b475a5d1..afc814b3e1 100644 --- a/playwright/pages/ElementAppPage.ts +++ b/playwright/pages/ElementAppPage.ts @@ -114,7 +114,7 @@ export class ElementAppPage { * @param isRightPanel whether to select the right panel composer, otherwise the main timeline composer */ public getComposerField(isRightPanel?: boolean): Locator { - return this.getComposer(isRightPanel).locator("[contenteditable]"); + return this.getComposer(isRightPanel).locator("div[contenteditable]"); } /** diff --git a/playwright/snapshots/timeline/timeline.spec.ts/spoiler-linux.png b/playwright/snapshots/timeline/timeline.spec.ts/spoiler-linux.png new file mode 100644 index 0000000000..529d254dc4 Binary files /dev/null and b/playwright/snapshots/timeline/timeline.spec.ts/spoiler-linux.png differ diff --git a/playwright/snapshots/timeline/timeline.spec.ts/spoiler-uncovered-linux.png b/playwright/snapshots/timeline/timeline.spec.ts/spoiler-uncovered-linux.png new file mode 100644 index 0000000000..41d5bc8bee Binary files /dev/null and b/playwright/snapshots/timeline/timeline.spec.ts/spoiler-uncovered-linux.png differ diff --git a/res/css/views/rooms/_EventTile.pcss b/res/css/views/rooms/_EventTile.pcss index 54f91bd5f4..b4172fc003 100644 --- a/res/css/views/rooms/_EventTile.pcss +++ b/res/css/views/rooms/_EventTile.pcss @@ -816,11 +816,13 @@ $left-gutter: 64px; .mx_EventTile_spoiler_content { filter: blur(5px) saturate(0.1) sepia(1); transition-duration: 0.5s; + pointer-events: none; } &.visible > .mx_EventTile_spoiler_content { filter: none; user-select: auto; + pointer-events: auto; } }