Skip to content

Commit

Permalink
Iterate
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy committed Jan 13, 2025
1 parent 2a82204 commit aab1754
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions playwright/e2e/threads/threads.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,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 @@ -135,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 Down Expand Up @@ -201,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 @@ -232,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 @@ -242,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 @@ -272,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
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 aab1754

Please sign in to comment.