Files
radicle-explorer/tests/e2e/explore.spec.ts
T
Daniel Norman 00f079d0d9 Make the node breadcrumb a seed picker
- replace the node breadcrumb link with a SeedPicker in the repo, user
  and node views, so the node serving a page can be switched where it
  is named
- remove current node picker from settings panel
- reach the node view through the picker's "Open node view" action
- cover the new breadcrumb picker in the e2e tests
- list the active seed in the seed picker
- the seed serving the page is also rendered in the list with a bookmark
  action instead of a remove one.
2026-09-25 10:23:40 +02:00

80 lines
2.7 KiB
TypeScript

import { expect, test } from "@tests/support/fixtures.js";
const unreachableSeed = {
hostname: "this.node.does.not.exist.xyz",
port: 8081,
scheme: "http",
};
test("explore repos page lists all repos and hides sort without a search backend", async ({
page,
}) => {
await page.goto("/explore/repos");
// Breadcrumb and subtitle. Without a search backend the listing is forced
// to "All repos" (rid order).
await expect(page.getByRole("link", { name: "Explore" })).toBeVisible();
await expect(page.getByText("All repos")).toBeVisible();
// The repo grid renders the seeded repos.
await expect(
page.locator(".repo-card", { hasText: "source-browsing" }).first(),
).toBeVisible();
// The sort control is only offered when the seed exposes a search backend.
await expect(page.getByRole("button", { name: "Sort" })).toHaveCount(0);
// The breadcrumb navigates back to the explore landing page.
await page.getByRole("link", { name: "Explore" }).click();
await expect(page).toHaveURL("/explore");
});
test("explore falls back to a healthy seed when the primary is unreachable", async ({
page,
}) => {
// Make an unreachable seed the primary, then fail its requests instantly.
await page.addInitScript(seed => {
window.localStorage.setItem("selectedSeed", JSON.stringify(seed));
}, unreachableSeed);
await page.route(
url => url.hostname === unreachableSeed.hostname,
route => route.abort(),
);
await page.goto("/explore", { waitUntil: "networkidle" });
// Failover lands on the reachable preferred seed and the page renders its
// repos, even though the configured primary seed is unreachable.
await expect(page.getByText("source-browsing").first()).toBeVisible();
});
test("seed picker lives in the settings dropdown on explore", async ({
page,
}) => {
await page.goto("/explore", { waitUntil: "networkidle" });
// The explore header no longer shows a seed picker directly.
await expect(page.getByRole("button", { name: "Seed selector" })).toHaveCount(
0,
);
// It's reached through the settings dropdown as the "Search seed" setting.
await page.getByRole("button", { name: "Settings" }).click();
await expect(page.getByText("Search seed")).toBeVisible();
await expect(
page.getByRole("button", { name: "Search seed selector" }),
).toContainText("localhost");
});
test("explore shows an error when no seed can be reached", async ({ page }) => {
// Fail every request to the seed's httpd port so no candidate responds.
await page.route(
url => url.port === String(unreachableSeed.port),
route => route.abort(),
);
await page.goto("/explore", { waitUntil: "networkidle" });
await expect(page.getByText("Unable to reach any seed")).toBeVisible();
});