/** * Regression test: a long message-author display name must truncate instead * of running past the message header into the timeline edge and the hover * action bar. The author button sits inside the UserProfilePopover trigger * wrapper — a flex item whose `min-width: auto` refused to shrink below the * nowrap width of the name, so the button's `truncate` never engaged. * * Run: pnpm build:e2e && pnpm exec playwright test --project=smoke \ * tests/e2e/message-author-overlap.spec.ts * Output: test-results/message-author-overlap/ */ import { expect, test } from "@playwright/test"; import { waitForAnimations } from "../helpers/animations"; import { installMockBridge, TEST_IDENTITIES } from "../helpers/bridge"; const SHOTS = "test-results/message-author-overlap"; // Long single-word name: no break opportunities, so the nowrap min-content // width far exceeds the header row at a 900px viewport. const LONG_AUTHOR_NAME = "Alexandrina-Wolfeschlegelsteinhausenbergerdorff-Keihanaikukauakahihuliheekahaunaele-The-Magnificent-Third"; const MESSAGE_CONTENT = "Author-name truncation regression probe"; test.describe("message author name overflow", () => { test.use({ viewport: { width: 900, height: 700 } }); test("long author name truncates instead of overflowing the header row", async ({ page, }) => { await installMockBridge(page, { mode: "mock", searchProfiles: [ { pubkey: TEST_IDENTITIES.alice.pubkey, displayName: LONG_AUTHOR_NAME, }, ], }); await page.goto("/", { waitUntil: "domcontentloaded" }); await page.getByTestId("channel-general").click(); await expect(page.getByTestId("chat-title")).toHaveText("general"); await page.waitForFunction( () => typeof window.__BUZZ_E2E_EMIT_MOCK_MESSAGE__ === "function", ); await page.evaluate( ({ pubkey, content }) => { window.__BUZZ_E2E_EMIT_MOCK_MESSAGE__?.({ channelName: "general", content, pubkey, }); }, { content: MESSAGE_CONTENT, pubkey: TEST_IDENTITIES.alice.pubkey }, ); const row = page .getByTestId("message-row") .filter({ hasText: MESSAGE_CONTENT }); await expect(row).toBeVisible(); const author = row.getByTestId("message-author"); await expect(author).toHaveText(LONG_AUTHOR_NAME); await waitForAnimations(page); // The ellipsis carrier is the popover-trigger