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
28 changes: 22 additions & 6 deletions tests/browser/relay-recovery.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ test("relay reads recover automatically after the network returns", async ({
// refused by the broker (503), so saves stay behind the edge page from the
// outage on.
let slept = false;
// The open channel's own catch-up read was refused.
let headRefused = false;
app.report.relayFailures = [];
await page.route("**/api/relay/**", async (route) => {
const url = route.request().url();
Expand All @@ -24,6 +26,22 @@ test("relay reads recover automatically after the network returns", async ({
offline || (slept && pathname.endsWith("/read-state-publish"));
if (!refused || pathname.endsWith("/session")) return route.fallback();
app.report.relayFailures.push(url);
// The same shape the session treats as a channel's timeline head.
if (
pathname.endsWith("/primary/query") &&
route
.request()
.postDataJSON()
.some(
(filter) =>
filter["#h"]?.includes("alpha") &&
filter.top_level === true &&
filter.until === undefined &&
filter.depth_limit === undefined &&
filter.kinds?.includes(9),
)
)
headRefused = true;
await route.fulfill({
status: 403,
contentType: "text/html",
Expand Down Expand Up @@ -56,12 +74,10 @@ test("relay reads recover automatically after the network returns", async ({
exact: true,
});
// Wait for the channel's catch-up read to meet the outage. An earlier
// failure, such as presence, can recover once the broker's own relay
// socket returns, and jumping the clock on it would leave the notice to
// clear while the network is still down.
await expect
.poll(() => app.report.relayFailures.some((url) => url.endsWith("/query")))
.toBe(true);
// failure, such as presence or another community's read, can recover once
// the broker's own relay socket returns, and jumping the clock on it would
// leave the notice to clear while the network is still down.
await expect.poll(() => headRefused).toBe(true);
// A short outage, like waking from sleep, says nothing.
await expect(notice).toHaveCount(0);
await page.clock.fastForward(30_000);
Expand Down
7 changes: 4 additions & 3 deletions tests/browser/solo-legacy-invitation.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,13 @@ test("Outbox Retry reconciles a recorded then removed Solo invitation without re
const summary = panel.locator("summary").filter({ hasText: /^Outbox ·/ });
const outbox = summary.locator("..");
for (const mode of ["dark", "light"]) {
await page.goto(app.origin);
await page.evaluate(
// Seed before boot: a reload during boot can fail the document request
// in WebKit. Later scripts run after earlier ones, so the last mode wins.
await page.addInitScript(
(mode) => localStorage.setItem("buzz-appearance.v1", mode),
mode,
);
await page.reload();
await page.goto(app.origin);
await expect(page.locator("html")).toHaveAttribute("data-color-mode", mode);
await openPage(page, "Messages");
await page
Expand Down
Loading