Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tests/browser/channel-opening.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,27 @@ test("cold opening bypasses held DM labels; warm switching paints within 100ms w
filter.authors?.some((id) => app.participants.includes(id)),
);
app.relay.holdProfiles(app.participants);
app.relay.holdEose("alpha");
app.relay.holdEose("beta");
// A visible pre-establishment head is not a warm, verified cache. A signed
// missed message proves the catch-up reached the UI, not merely the broker.
const establish = async (channel) => {
expect(heads(app, channel)).toHaveLength(1);
const missed = app.append(
"primary",
channel,
"Startup catch-up marker",
false,
);
app.relay.releaseEose(channel);
await expect(
page.locator(`[data-message-id="${missed.id}"]`),
).toBeVisible();
expect(heads(app, channel)).toHaveLength(2);
};
try {
await open(page, app);
await establish("alpha");
await expect.poll(() => labelReads().length).toBe(1);
expect(labelReads()[0].filter.authors).toHaveLength(500);
// The actual label hook has >1,000 missing participants. Keep its profile
Expand Down Expand Up @@ -62,6 +81,7 @@ test("cold opening bypasses held DM labels; warm switching paints within 100ms w
expect(heads(app, "beta").length).toBeGreaterThan(0);
expect(app.report.profileHolds.some((held) => held.pending)).toBe(true);
expect(app.report.profileHolds.some((held) => held.aborted)).toBe(false);
await establish("beta");
const before = submittedHeads.length;
// Browser-clock click → first visible row → paint, excluding Playwright IPC.
for (const name of ["Alpha", "Beta", "Alpha", "Beta"]) {
Expand Down Expand Up @@ -138,6 +158,8 @@ test("cold opening bypasses held DM labels; warm switching paints within 100ms w
expect(app.report.profileHolds.some((held) => held.pending)).toBe(true);
expect(app.report.profileHolds.some((held) => held.aborted)).toBe(false);
} finally {
app.relay.releaseEose("alpha");
app.relay.releaseEose("beta");
app.relay.releaseProfiles();
}
});
20 changes: 19 additions & 1 deletion tests/browser/sidebar-unread.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,25 @@ test("edge pills follow scroll and reveal the nearest unread without selection o
page,
app,
}, info) => {
await open(page, app);
// Visible rows can precede the post-establishment catch-up. Force that late
// ordering, then account for its head read before measuring cue-triggered work.
app.relay.holdEose("alpha");
try {
await open(page, app);
const alphaHeads = () =>
heads(app).filter(
({ community, filter }) =>
community === "primary" &&
filter["#h"][0] === "alpha" &&
filter.top_level === true &&
filter.until === undefined,
);
expect(alphaHeads()).toHaveLength(1);
app.relay.releaseEose("alpha");
await expect.poll(() => alphaHeads().length).toBe(2);
} finally {
app.relay.releaseEose("alpha");
}
await expect(row(page, "dm-090").getByRole("img")).toHaveCount(1);
await expect(cue(page, "below")).toBeVisible();
await expect(cue(page, "above")).toHaveCount(0);
Expand Down
Loading