9dfa06ffee
Docker image / Build (linux/amd64) (push) Has been cancelled
Docker image / Build (linux/arm64) (push) Has been cancelled
Docker image / Merge release multi-arch manifest (push) Has been cancelled
Docker image / Merge debug multi-arch manifest (push) Has been cancelled
Docker image / Build public push gateway (linux/amd64) (push) Has been cancelled
Docker image / Build public push gateway (linux/arm64) (push) Has been cancelled
Docker image / Publish public push gateway image (push) Has been cancelled
Sprig image / Build (linux/amd64) (push) Has been cancelled
Sprig image / Build (linux/arm64) (push) Has been cancelled
Sprig image / Merge multi-arch manifest (push) Has been cancelled
Harbor Buzz Orchestra / Python tests and lint (push) Has been cancelled
CI / Detect Changed Paths (push) Has been cancelled
CI / Rust Lint (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Desktop Core (push) Has been cancelled
CI / Desktop Smoke E2E (1) (push) Has been cancelled
CI / Desktop Smoke E2E (2) (push) Has been cancelled
CI / Desktop Smoke E2E (3) (push) Has been cancelled
CI / Desktop Smoke E2E (4) (push) Has been cancelled
CI / Desktop (push) Has been cancelled
CI / Desktop E2E Relay (push) Has been cancelled
CI / Desktop E2E Integration (1/2) (push) Has been cancelled
CI / Desktop E2E Integration (2/2) (push) Has been cancelled
CI / Desktop E2E Integration (push) Has been cancelled
CI / Backend Integration (relay e2e) (push) Has been cancelled
CI / Relay E2E (push) Has been cancelled
CI / Web (push) Has been cancelled
CI / Mobile (push) Has been cancelled
CI / Security (push) Has been cancelled
CI / Dead Token Reference Guard (push) Has been cancelled
CI / Server Cross-Compile (aarch64-unknown-linux-musl) (push) Has been cancelled
CI / Server Cross-Compile (x86_64-unknown-linux-musl) (push) Has been cancelled
CI / Windows Rust (x86_64-pc-windows-msvc) (push) Has been cancelled
CI / Desktop Build (macOS) (push) Has been cancelled
helm chart / lint + unittest + render matrix (push) Has been cancelled
helm chart / install on kind (gated) (push) Has been cancelled
helm chart / publish chart to GHCR (push) Has been cancelled
Mesh Lifecycle / Relay-Driven Mesh Lifecycle Smoke (push) Has been cancelled
Sprig / Build (aarch64-unknown-linux-musl) (push) Has been cancelled
Sprig / Build (x86_64-unknown-linux-musl) (push) Has been cancelled
Sprig / Publish rolling release (push) Has been cancelled
Sprig / Publish tagged release (push) Has been cancelled
Signed-off-by: cls_宁波本机 <908705107@qq.com>
164 lines
5.8 KiB
TypeScript
164 lines
5.8 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
|
|
import { installMockBridge } from "../helpers/bridge";
|
|
|
|
const SHOTS = "test-results/local-archive";
|
|
|
|
// Well-known channel IDs from the mock bridge seed (e2eBridge.ts mockChannels).
|
|
const GENERAL_CHANNEL_ID = "9a1657ac-f7aa-5db0-b632-d8bbeb6dfb50";
|
|
|
|
// Navigate to the Local Archive settings panel.
|
|
async function openLocalArchiveSettings(page: import("@playwright/test").Page) {
|
|
await page.goto("/", { waitUntil: "domcontentloaded" });
|
|
await page.getByTestId("open-settings").click();
|
|
await page.getByTestId("profile-popover-settings").click();
|
|
await expect(page.getByTestId("settings-view")).toBeVisible();
|
|
await page.getByTestId("settings-nav-local-archive").click();
|
|
const card = page.getByTestId("settings-local-archive");
|
|
await expect(card).toBeVisible({ timeout: 10_000 });
|
|
return card;
|
|
}
|
|
|
|
async function settleAnimations(el: import("@playwright/test").Locator) {
|
|
await el.evaluate((node) =>
|
|
Promise.all(node.getAnimations({ subtree: true }).map((a) => a.finished)),
|
|
);
|
|
}
|
|
|
|
test.describe("local archive screenshots", () => {
|
|
test.use({ viewport: { width: 1280, height: 900 } });
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
page.on("pageerror", (err) => {
|
|
console.error(
|
|
"PAGE ERROR:",
|
|
err.message,
|
|
err.stack?.split("\n").slice(0, 5).join("\n"),
|
|
);
|
|
});
|
|
page.on("console", (msg) => {
|
|
if (msg.type() === "error") {
|
|
console.error("CONSOLE ERROR:", msg.text().slice(0, 500));
|
|
}
|
|
});
|
|
});
|
|
|
|
test("01 — subscriptions list with channel entry and observer toggle on", async ({
|
|
page,
|
|
}) => {
|
|
await installMockBridge(page, {
|
|
saveSubscriptions: [
|
|
{
|
|
scope_type: "channel_h",
|
|
scope_value: GENERAL_CHANNEL_ID,
|
|
kinds: "[9,40002,40003]",
|
|
},
|
|
{
|
|
scope_type: "owner_p",
|
|
scope_value: "deadbeef".repeat(8),
|
|
kinds: "[24200]",
|
|
},
|
|
],
|
|
});
|
|
|
|
const card = await openLocalArchiveSettings(page);
|
|
|
|
// Channel subscription row appears in the channel list.
|
|
await expect(
|
|
card.getByTestId(`local-archive-sub-channel_h:${GENERAL_CHANNEL_ID}`),
|
|
).toBeVisible({ timeout: 5_000 });
|
|
// owner_p rows are filtered out of the channel list and surfaced via the
|
|
// dedicated observer section instead — toggle should be visible and checked.
|
|
const observerToggle = card.getByTestId("local-archive-observer-toggle");
|
|
await expect(observerToggle).toBeVisible({ timeout: 5_000 });
|
|
await expect(observerToggle).toBeChecked();
|
|
await settleAnimations(card);
|
|
await card.screenshot({ path: `${SHOTS}/01-subscriptions-list.png` });
|
|
});
|
|
|
|
test("02 — Add form opens directly to channel picker", async ({ page }) => {
|
|
await installMockBridge(page, { saveSubscriptions: [] });
|
|
|
|
const card = await openLocalArchiveSettings(page);
|
|
|
|
// The source-picker step no longer exists — clicking Add opens the channel
|
|
// subscription form directly (channel select is the first visible field).
|
|
await card.getByTestId("local-archive-open-add").click();
|
|
await expect(card.getByTestId("local-archive-channel-select")).toBeVisible({
|
|
timeout: 5_000,
|
|
});
|
|
await settleAnimations(card);
|
|
await card.screenshot({ path: `${SHOTS}/02-add-form-channel-picker.png` });
|
|
});
|
|
|
|
test("03 — Step 2 kind checklist with indeterminate group header", async ({
|
|
page,
|
|
}) => {
|
|
await installMockBridge(page, { saveSubscriptions: [] });
|
|
|
|
const card = await openLocalArchiveSettings(page);
|
|
|
|
// Navigate to the kind checklist — clicking Add opens the form directly.
|
|
await card.getByTestId("local-archive-open-add").click();
|
|
|
|
// Step 2 should be visible now. Select a channel so the form becomes valid.
|
|
await card
|
|
.getByTestId("local-archive-channel-select")
|
|
.selectOption({ value: GENERAL_CHANNEL_ID });
|
|
|
|
// Check a subset of the first group's items to trigger the indeterminate
|
|
// state on the group header checkbox.
|
|
const firstGroupItems = card
|
|
.locator("[data-testid^='local-archive-kind-']")
|
|
.first();
|
|
await firstGroupItems.click();
|
|
|
|
await settleAnimations(card);
|
|
await card.screenshot({
|
|
path: `${SHOTS}/03-step2-kind-checklist-indeterminate.png`,
|
|
});
|
|
});
|
|
|
|
test("04 — custom kinds entry with invalid-token error", async ({ page }) => {
|
|
await installMockBridge(page, { saveSubscriptions: [] });
|
|
|
|
const card = await openLocalArchiveSettings(page);
|
|
|
|
await card.getByTestId("local-archive-open-add").click();
|
|
|
|
// Type invalid tokens into the custom kinds field.
|
|
await card
|
|
.getByTestId("local-archive-custom-kinds")
|
|
.fill("30023 bad-token 1337 notanumber");
|
|
|
|
// Error message should appear.
|
|
await expect(
|
|
card.getByTestId("local-archive-custom-kinds-error"),
|
|
).toBeVisible({ timeout: 5_000 });
|
|
await settleAnimations(card);
|
|
await card.screenshot({
|
|
path: `${SHOTS}/04-custom-kinds-invalid-error.png`,
|
|
});
|
|
});
|
|
|
|
test("05 — observer archive section with toggle", async ({ page }) => {
|
|
await installMockBridge(page, { saveSubscriptions: [] });
|
|
|
|
const card = await openLocalArchiveSettings(page);
|
|
|
|
// Observer archive is now a dedicated first-class section, not an add-flow
|
|
// source. Assert the section, descriptive copy, and toggle are all visible.
|
|
const observerSection = card.getByTestId("local-archive-observer-section");
|
|
await expect(observerSection).toBeVisible({ timeout: 5_000 });
|
|
// The section description mentions observer frames and their ephemeral nature.
|
|
await expect(
|
|
observerSection.getByText(/not stored by the relay/i),
|
|
).toBeVisible();
|
|
await expect(
|
|
card.getByTestId("local-archive-observer-toggle"),
|
|
).toBeVisible();
|
|
await settleAnimations(card);
|
|
await card.screenshot({ path: `${SHOTS}/05-observer-section.png` });
|
|
});
|
|
});
|