Skip to content

Commit

Permalink
Enable previously disabled Playwright tests (#28976)
Browse files Browse the repository at this point in the history
* Enable previously disabled Playwright tests

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

* Iterate

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

* Iterate

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

* Add screenshots

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

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
  • Loading branch information
t3chguy authored Jan 13, 2025
1 parent bff2d68 commit 0f8a2e9
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 32 deletions.
7 changes: 1 addition & 6 deletions playwright/e2e/read-receipts/read-receipts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,7 @@ test.describe("Read receipts", { tag: "@mergequeue" }, () => {
await page.goto(`/#/room/${selectedRoomId}`);
});

// Disabled due to flakiness: https://github.com/element-hq/element-web/issues/26895
test.skip("With sync accumulator, considers main thread and unthreaded receipts #24629", async ({
page,
app,
bot,
}) => {
test("With sync accumulator, considers main thread and unthreaded receipts #24629", async ({ page, app, bot }) => {
// Details are in https://github.com/vector-im/element-web/issues/24629
// This proves we've fixed one of the "stuck unreads" issues.

Expand Down
42 changes: 20 additions & 22 deletions playwright/e2e/threads/threads.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ test.describe("Threads", () => {
});
});

// Flaky: https://github.com/vector-im/element-web/issues/26452
test.skip("should be usable for a conversation", { tag: "@screenshot" }, async ({ page, app, bot }) => {
test("should be usable for a conversation", { tag: "@screenshot" }, async ({ page, app, bot }) => {
const roomId = await app.client.createRoom({});
await app.client.inviteUser(roomId, bot.credentials.userId);
await bot.joinRoom(roomId);
Expand Down Expand Up @@ -76,7 +75,7 @@ test.describe("Threads", () => {
mask: mask,
});
await app.settings.setValue("layout", null, SettingLevel.DEVICE, Layout.Bubble);
await expect(page.locator(".mx_ThreadView .mx_EventTile[data-layout='bubble']")).toBeVisible();
await expect(page.locator(".mx_ThreadView .mx_EventTile[data-layout='bubble']")).toHaveCount(2);

await expect(page.locator(".mx_ThreadView")).toMatchScreenshot("Initial_ThreadView_on_bubble_layout.png", {
mask: mask,
Expand Down Expand Up @@ -136,8 +135,8 @@ test.describe("Threads", () => {
await page.getByRole("gridcell", { name: "👋" }).click();

locator = page.locator(".mx_ThreadView");
// Make sure the CSS style for spacing is applied to mx_ReactionsRow on group/modern layout
await expect(locator.locator(".mx_EventTile[data-layout=group] .mx_ReactionsRow")).toHaveCSS(
// Make sure the CSS style for spacing is applied to mx_EventTile_footer on group/modern layout
await expect(locator.locator(".mx_EventTile[data-layout=group] .mx_EventTile_footer")).toHaveCSS(
"margin-inline-start",
ThreadViewGroupSpacingStart,
);
Expand All @@ -164,7 +163,7 @@ test.describe("Threads", () => {
locator = page.locator(
".mx_ThreadView .mx_GenericEventListSummary[data-layout=bubble] .mx_EventTile_info.mx_EventTile_last",
);
expect(locator.locator(".mx_EventTile_line .mx_EventTile_content"))
await expect(locator.locator(".mx_EventTile_line .mx_EventTile_content"))
// 76px: ThreadViewGroupSpacingStart + 14px + 6px
// 14px: avatar width
// See: _EventTile.pcss
Expand Down Expand Up @@ -202,20 +201,22 @@ test.describe("Threads", () => {
await locator.click();

// Wait until the response is redacted
await expect(
page.locator(".mx_ThreadView").locator(".mx_EventTile_last .mx_EventTile_receiptSent"),
).toBeVisible();
// XXX: one would expect this redaction to be shown in the thread the message was in, but due to redactions
// stripping the thread_id, it is instead shown in the main timeline
await expect(page.locator(".mx_MainSplit_timeline").locator(".mx_EventTile_last")).toContainText(
"Message deleted",
);

// Take snapshots in group layout and bubble layout (IRC layout is not available on ThreadView)
await expect(page.locator(".mx_ThreadView .mx_EventTile[data-layout='group']")).toBeVisible();
await expect(page.locator(".mx_ThreadView .mx_EventTile[data-layout='group']")).toHaveCount(2);
await expect(page.locator(".mx_ThreadView")).toMatchScreenshot(
"ThreadView_with_redacted_messages_on_group_layout.png",
{
mask: mask,
},
);
await app.settings.setValue("layout", null, SettingLevel.DEVICE, Layout.Bubble);
await expect(page.locator(".mx_ThreadView .mx_EventTile[data-layout='bubble']")).toBeVisible();
await expect(page.locator(".mx_ThreadView .mx_EventTile[data-layout='bubble']")).toHaveCount(2);
await expect(page.locator(".mx_ThreadView")).toMatchScreenshot(
"ThreadView_with_redacted_messages_on_bubble_layout.png",
{
Expand All @@ -233,8 +234,8 @@ test.describe("Threads", () => {

// User closes right panel after clicking back to thread list
locator = page.locator(".mx_ThreadPanel");
locator.getByRole("button", { name: "Threads" }).click();
locator.getByRole("button", { name: "Close" }).click();
await locator.getByRole("button", { name: "Threads" }).click();
await locator.getByRole("button", { name: "Close" }).click();

// Bot responds to thread
await bot.sendMessage(roomId, "How are things?", threadId);
Expand All @@ -243,9 +244,8 @@ test.describe("Threads", () => {
await expect(locator.locator(".mx_ThreadSummary_sender").getByText("BotBob")).toBeAttached();
await expect(locator.locator(".mx_ThreadSummary_content").getByText("How are things?")).toBeAttached();

locator = page.getByRole("button", { name: "Threads" });
await expect(locator).toHaveAttribute("data-indicator", "default"); // User asserts thread list unread indicator
// await expect(locator).toHaveClass(/mx_LegacyRoomHeader_button--unread/);
locator = page.getByRole("banner").getByRole("button", { name: "Threads" });
await expect(locator).toHaveAttribute("data-indicator", "success"); // User asserts thread list unread indicator
await locator.click(); // User opens thread list

// User asserts thread with correct root & latest events & unread dot
Expand Down Expand Up @@ -273,20 +273,18 @@ test.describe("Threads", () => {
await expect(locator.getByText("Great!")).toBeAttached();
await locator.locator(".mx_EventTile_line").hover();
await locator.locator(".mx_EventTile_line").getByRole("button", { name: "Edit" }).click();
await locator.getByRole("textbox").fill(" How about yourself?{enter}");
await locator.getByRole("textbox").pressSequentially(" How about yourself?"); // fill would overwrite the original text
await locator.getByRole("textbox").press("Enter");

locator = page.locator(".mx_RoomView_body .mx_ThreadSummary");
await expect(locator.locator(".mx_ThreadSummary_sender").getByText("Tom")).toBeAttached();
await expect(
locator.locator(".mx_ThreadSummary_content").getByText("Great! How about yourself?"),
).toBeAttached();
await expect(locator.locator(".mx_ThreadSummary_content")).toHaveText("Great! How about yourself?");

// User closes right panel
await page.locator(".mx_ThreadPanel").getByRole("button", { name: "Close" }).click();

// Bot responds to thread and saves the id of their message to @eventId
const { event_id: eventId } = await bot.sendMessage(roomId, threadId, "I'm very good thanks");
const { event_id: eventId } = await bot.sendMessage(roomId, "I'm very good thanks", threadId);

// User asserts
locator = page.locator(".mx_RoomView_body .mx_ThreadSummary");
Expand Down Expand Up @@ -344,7 +342,7 @@ test.describe("Threads", () => {

await expect(page.locator(".mx_ThreadView_timelinePanelWrapper")).toHaveCount(1);

(await app.openMessageComposerOptions(true)).getByRole("menuitem", { name: "Voice Message" }).click();
await (await app.openMessageComposerOptions(true)).getByRole("menuitem", { name: "Voice Message" }).click();
await page.waitForTimeout(3000);
await app.getComposer(true).getByRole("button", { name: "Send voice message" }).click();
await expect(page.locator(".mx_ThreadView .mx_MVoiceMessageBody")).toHaveCount(1);
Expand Down
4 changes: 0 additions & 4 deletions playwright/e2e/timeline/timeline.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,6 @@ test.describe("Timeline", () => {
"should set inline start padding to a hidden event line",
{ tag: "@screenshot" },
async ({ page, app, room }) => {
test.skip(
true,
"Disabled due to screenshot test being flaky - https://github.com/element-hq/element-web/issues/26890",
);
await sendEvent(app.client, room.roomId);
await page.goto(`/#/room/${room.roomId}`);
await app.settings.setValue("showHiddenEventsInTimeline", null, SettingLevel.DEVICE, true);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0f8a2e9

Please sign in to comment.