test(desktop): fix day-divider strict-mode failure across midnight UTC

The general-channel welcome seeds are backdated by up to 120s, so a smoke
run that straddles midnight UTC renders two day dividers (Yesterday +
Today). Three specs asserted toBeVisible() on the bare
message-timeline-day-divider locator, which Playwright strict mode
rejects the moment two dividers exist — this is what failed Desktop
Smoke E2E shard 3 on the 23:53 UTC run of PR #6003 (test started before
midnight, assertion ran after).

Assert .first() visibility instead at all three sites (messaging.spec.ts
day-divider test, channels.spec.ts general-channel content test, and the
DM unread-clear test). The tests' intent is "a divider appears", which
the first divider proves on both sides of midnight. Pre-existing on
main; surfaced here because the PR run happened to cross the boundary.

Co-authored-by: Thomas Petersen <thomasp@squareup.com>
Signed-off-by: Thomas Petersen <thomasp@squareup.com>
This commit is contained in:
Wintermute
2026-08-16 20:28:52 -04:00
co-authored by Thomas Petersen
parent 99bbbadb45
commit bbbb3564b6
2 changed files with 17 additions and 3 deletions
+10 -2
View File
@@ -1869,7 +1869,11 @@ test("channel with messages shows content", async ({ page }) => {
await expect(page.getByTestId("welcome-composer-guide-banner")).toHaveCount(
0,
);
await expect(page.getByTestId("message-timeline-day-divider")).toBeVisible();
// `.first()`: backdated seeds can straddle midnight UTC and render two
// dividers (Yesterday + Today); a bare locator fails Playwright strict mode.
await expect(
page.getByTestId("message-timeline-day-divider").first(),
).toBeVisible();
await expect(page.getByTestId("message-timeline")).toContainText(
"Welcome to general",
);
@@ -2441,7 +2445,11 @@ test("sidebar clears unread indicator after opening a DM", async ({ page }) => {
await expect(page.getByTestId("message-dm-intro")).toContainText(
"This is the beginning of your direct message with",
);
await expect(page.getByTestId("message-timeline-day-divider")).toBeVisible();
// `.first()`: backdated seeds can straddle midnight UTC and render two
// dividers (Yesterday + Today); a bare locator fails Playwright strict mode.
await expect(
page.getByTestId("message-timeline-day-divider").first(),
).toBeVisible();
await expect(page.getByTestId("message-timeline")).toContainText(
"Unread update for the DM",
);
+7 -1
View File
@@ -1996,7 +1996,13 @@ test("day divider appears in timeline", async ({ page }) => {
await expect(page.getByTestId("message-timeline")).toContainText(
"Welcome to general",
);
await expect(page.getByTestId("message-timeline-day-divider")).toBeVisible();
// `.first()`: the seeds are backdated by up to 120s, so a run that straddles
// midnight UTC legitimately renders two dividers (Yesterday + Today) and a
// bare locator fails Playwright strict mode. The intent is "a divider
// appears", which the first divider proves on both sides of midnight.
await expect(
page.getByTestId("message-timeline-day-divider").first(),
).toBeVisible();
});
test("send message to DM channel p-tags the recipient", async ({ page }) => {