Files
wehub-resource-sync f99010fae1
CI / lint (push) Failing after 1s
CI / frontend (push) Failing after 1s
CI / scripts (push) Failing after 1s
CI / Go Test (ubuntu-latest) (push) Failing after 0s
CI / frontend-node-25 (push) Failing after 1s
CI / docs (push) Failing after 0s
CI / coverage (push) Failing after 0s
CI / e2e (push) Failing after 0s
Docker / build-and-push (push) Failing after 1s
CI / integration (push) Failing after 4m43s
CI / Go Test (windows-latest) (push) Has been cancelled
CI / Desktop Unit Tests (Windows) (push) Has been cancelled
Desktop Artifacts / Desktop Build (Linux (arm64)) (push) Has been cancelled
Desktop Artifacts / Desktop Build (Linux) (push) Has been cancelled
Desktop Artifacts / Desktop Build (Windows) (push) Has been cancelled
Desktop Artifacts (macOS) / Desktop Build (macOS (aarch64)) (push) Has been cancelled
Desktop Artifacts (macOS) / Desktop Build (macOS (x86_64)) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:30:36 +08:00

71 lines
2.5 KiB
TypeScript

import { expect, test } from "@playwright/test";
import { RuntimeErrorMonitor } from "./helpers/runtime-error-monitor";
import { SessionsPage } from "./pages/sessions-page";
const DEPTH_ERROR_RE =
/effect_update_depth_exceeded|Maximum update depth exceeded/i;
// Svelte 5 fires each_key_duplicate warnings when virtual-scroll
// items shift keys during rapid filter/sort transitions. These
// are cosmetic — the DOM recovers immediately. WebKit additionally
// reports the benign "ResizeObserver loop completed with undelivered
// notifications" when kit-ui's TopBar re-lays-out inside its own
// ResizeObserver measurement — the loop is settled on the next frame.
const KNOWN_SVELTE_WARNINGS_RE =
/each_key_duplicate|ResizeObserver loop completed with undelivered notifications/;
// Test-fixture assumptions: project-alpha has sessions with 2
// and 5+ messages, totalling 10 sessions across all projects
// (including the project-duration showcase and project-edits fixture).
const TEST_PROJECT = "project-alpha";
const FILTERED_SESSION_COUNT = 2;
const TOTAL_SESSION_COUNT = 10;
// Session deep in the list to exercise virtualizer scroll.
const TARGET_SESSION_INDEX = 6;
// Double-toggle cycles sort order back to original state.
const SORT_TOGGLE_CLICKS = 2;
// Svelte still emits depth warnings under rapid virtualizer
// churn. Keep them bounded to catch regressions.
const MAX_DEPTH_ERRORS = 4;
test.describe("Runtime stability", () => {
test(
"effect update-depth errors stay bounded during core interactions",
async ({ page }) => {
const monitor = new RuntimeErrorMonitor(page);
const sp = new SessionsPage(page);
await sp.goto();
// Exercise the highest-churn flows: session open,
// sort toggle, and project filtering.
await sp.selectSession(TARGET_SESSION_INDEX);
await sp.toggleSortOrder(SORT_TOGGLE_CLICKS);
await sp.filterByProject(TEST_PROJECT);
await expect(sp.sessionListHeader).toContainText(
`${FILTERED_SESSION_COUNT} sessions`,
);
await sp.clearProjectFilter();
await expect(sp.sessionListHeader).toContainText(
`${TOTAL_SESSION_COUNT} sessions`,
);
const depthErrors = monitor.matching(DEPTH_ERROR_RE);
expect(
depthErrors.length,
`depth errors (${depthErrors.length}) should be <= ${MAX_DEPTH_ERRORS}`,
).toBeLessThanOrEqual(MAX_DEPTH_ERRORS);
const otherErrors = monitor
.excluding(DEPTH_ERROR_RE)
.filter((m) => !KNOWN_SVELTE_WARNINGS_RE.test(m));
expect(otherErrors).toEqual([]);
},
);
});