test(e2e): assert stand routes on data, not only on client-side state

Every assertion was client-side — the URL, a route-derived breadcrumb and
pageerror, which a production React build does not emit for a failed
query — so all five passed against a backend erroring on every request.
Verified against the live stand: healthy, 5/5 pass; with GraphQL forced to
error, the URL and breadcrumb assertions still pass and only the new one
fails. Each route now proves its query resolved, accepting the empty state
as well since a stand may hold no rows.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Sergey Kozyrenko
2026-07-22 14:06:09 +07:00
co-authored by Claude Opus 4.8
parent 04cc821bd6
commit ecb94b25e7
+10 -6
View File
@@ -4,15 +4,15 @@ import { expect, test } from '@playwright/test';
// stand): the authenticated shell renders and each core route loads without an
// uncaught error. No seeded data and no agent run — safe against a shared stand.
const ROUTES = [
{ path: '/flows', title: 'Flows' },
{ path: '/templates', title: 'Templates' },
{ path: '/knowledges', title: 'Knowledges' },
{ path: '/settings/prompts', title: 'Prompts' },
{ path: '/settings/api-tokens', title: 'API Tokens' },
{ emptyTitle: 'No flows found', path: '/flows', title: 'Flows' },
{ emptyTitle: 'No templates yet', path: '/templates', title: 'Templates' },
{ emptyTitle: 'No knowledge documents yet', path: '/knowledges', title: 'Knowledges' },
{ emptyTitle: 'No prompts available', path: '/settings/prompts', title: 'Prompts' },
{ emptyTitle: 'No API tokens configured', path: '/settings/api-tokens', title: 'API Tokens' },
];
test.describe('stand smoke', { tag: '@stand' }, () => {
for (const { path, title } of ROUTES) {
for (const { emptyTitle, path, title } of ROUTES) {
test(`renders ${path} without a page error`, async ({ page }) => {
const pageErrors: string[] = [];
@@ -28,6 +28,10 @@ test.describe('stand smoke', { tag: '@stand' }, () => {
// span tag matters: NavLink puts aria-current="page" on the active
// settings-sidebar <a> at runtime, the breadcrumb title is a span.
await expect(page.locator('span[aria-current="page"]')).toHaveText(title);
// The only assertion here a backend erroring on every request fails: each page
// returns early into its ErrorState, rendering neither branch. Both branches are
// accepted because a stand may legitimately hold no rows.
await expect(page.locator('[data-slot="table"]').first().or(page.getByText(emptyTitle))).toBeVisible();
expect(pageErrors, `uncaught errors on ${path}`).toEqual([]);
});
}