commit da0e96e4f88f837eaa5404b16402985d368f1702
parent b963c6e8a15bb1e872f83cf6b674a8d9f1607fdf
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 30 Sep 2026 00:56:39 -0400
editor(e2e): site-scope — a new channel starts checked on the stored site, or a ?site= link's, and a cleared box stays cleared
Read with no retry after domcontentloaded: /channels/new with alpha stored has
Alpha checked and Beta not; /channels/new?site=beta has Beta checked and not
Alpha as well. With Alpha cleared by hand, a pick of beta in another tab
refreshes the page and checks neither.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat:
1 file changed, 48 insertions(+), 0 deletions(-)
diff --git a/editor/e2e/site-scope.spec.ts b/editor/e2e/site-scope.spec.ts
@@ -412,3 +412,51 @@ test("a site picked in another tab reaches this one", async ({ context }) => {
// Tab B hears of that write too.
await expect(b.getByLabel("Active site")).toHaveValue("alpha");
});
+
+// A new channel starts checked on the active site: the stored one, or a
+// `?site=` link's instead (not both). It is the form's initial state, so it is
+// in the first paint, read here with no retry, and a refresh later (a pick in
+// another tab) does not re-check a box the user cleared.
+test("a new channel starts checked on the stored site, or on a ?site= link's", async ({
+ context,
+}) => {
+ test.setTimeout(60_000);
+ await twoSites();
+ await writeSettings({ autoRefreshIntervalSeconds: 0 });
+ const a = await context.newPage();
+ await a.goto("/channels");
+ await a.getByLabel("Active site").selectOption("alpha");
+ await expect(a.getByRole("link", { name: "slow-b" })).toHaveCount(0);
+
+ const alpha = a.getByLabel("Include on Alpha");
+ const beta = a.getByLabel("Include on Beta");
+ await a.goto("/channels/new", { waitUntil: "commit" });
+ await a.waitForLoadState("domcontentloaded");
+ expect(await alpha.isChecked(), "stored site, first paint").toBe(true);
+ expect(await beta.isChecked()).toBe(false);
+
+ await a.goto("/channels/new?site=beta", { waitUntil: "commit" });
+ await a.waitForLoadState("domcontentloaded");
+ expect(await beta.isChecked(), "the link's site, first paint").toBe(true);
+ expect(await alpha.isChecked(), "not the stored one as well").toBe(false);
+
+ // Cleared by hand, it stays cleared when another tab's pick refreshes this one.
+ await a.goto("/channels/new");
+ await expect
+ .poll(() =>
+ alpha.evaluate((el) =>
+ Object.keys(el).some((k) => k.startsWith("__reactProps")),
+ ),
+ )
+ .toBe(true);
+ await alpha.click();
+ await expect(a.getByLabel("Group for Alpha")).toHaveCount(0);
+ const b = await context.newPage();
+ await b.goto("/channels");
+ await b.getByLabel("Active site").selectOption("beta");
+ await expect(b.getByRole("link", { name: "slow-a" })).toHaveCount(0);
+ await expect(a.getByLabel("Active site")).toHaveValue("beta");
+ await a.waitForTimeout(SETTLE_MS);
+ expect(await alpha.isChecked()).toBe(false);
+ expect(await beta.isChecked()).toBe(false);
+});