Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(e2e): address review — replace assertions that could not fail\n\nReview fixes for #5881. Most of these are the same defect in different\nclothes: an assertion that is already true before the behaviour under test\nhappens, so the test reports success either way.\n\n`tinysweeper` found two, both in the leave-guard tests. `toContain('/flows')`\nis satisfied by `/flows/<id>` itself, so the poll returned true on its first\nevaluation, before the click navigated. In the Discard test that left the real\ncheck racing an in-flight navigation; in the clean-leave test it was the ONLY\npositive assertion, so that test could not fail at all. Both now poll the\nnarrow condition — the absence of this flow's own path. The identical mistake\nin flows-canvas-routes' back-button test was NOT flagged by anyone; fixed too,\nwhere it was non-load-bearing only by luck of a later list-only assertion.\n\n`coderabbitai` found three more of the same shape:\n - the unknown-?tab= test asserted that nav rows were visible, which is true\n on every tab — it could not tell a working fallback from one landing on\n the wrong tab. Now asserts the SELECTED row via aria-current, the same\n predicate the new alias spec uses.\n - the /skills?tab= bug test asserted the Channels nav row was visible, which\n likewise proved nothing about the harm it documents. Now asserts Welcome\n is selected.\n - both /flows/draft tests passed on the unknown-flow screen, which also has\n a back button and no title. There is a dedicated `flow-canvas-draft-missing`\n testid; they now assert it, and the second also excludes `flow-canvas-error`\n rather than only `flow-canvas-not-found`.\n - AboutPanel asserted /^https?:\/\// while being named "rather than a\n hardcoded one" — a shape a hardcoded URL satisfies. Now asserts\n LATEST_APP_DOWNLOAD_URL.\n - AgentsPanel resolved `undefined as never` for an API returning\n Promise<boolean>; the cast was the tell. Now resolves true.\n\n`coderabbitai` also caught two tests asserting states that were never reached:\nthe failed-install test's "enabled and reading Install" is also the button's\nINITIAL state, so it passed whether or not the click did anything, and the\ntext-retention test slept 800ms rather than observing a request in flight.\nBoth now HOLD the RPC, assert the pending state, then release.\n\n`chatgpt-codex-connector` caught the recovery-phrase fallback: the execCommand\nstub returned success without inspecting the textarea, so both fallback tests\npassed if it were empty or held the wrong phrase — and a false "Copied" here\ncan cost a user their only copy. The stub now captures the copied value and\nboth tests assert it equals the phrase.\n\n`YellowSnnowmann` flagged prettier drift in four spec files; formatted, and\nall nine files are clean.\n\nNOT DONE, deliberately: preserving `?tab=` through the /skills redirect. That\nis a production change and this PR is test-only (0 production files). The bug\nis recorded with a verified fix; the test pins current behaviour and is\nlabelled BUG with flip instructions. Replied on the thread.\n\nNOT VERIFIED BY EXECUTION: local builds and test runs are prohibited under the\ncurrent standing rule, so none of this was run. Every change is reasoned from\nthe source, with the file:line each claim rests on written beside it. The\nrevert-proofs that normally back my specs could not be redone for these edits.\nCI is the check.\n

M3gA-Minda69e4a24b116
diff --git a/app/src/components/settings/panels/AgentsPanel.removal.test.tsx b/app/src/components/settings/panels/AgentsPanel.removal.test.tsx
index 5a6e65f101..f4266258ab 100644
--- a/app/src/components/settings/panels/AgentsPanel.removal.test.tsx
+++ b/app/src/components/settings/panels/AgentsPanel.removal.test.tsx
@@ -86,7 +86,13 @@ const resetButtons = () => screen.getAllByRole('button', { name: /reset/i });
beforeEach(() => {
vi.clearAllMocks();
mockList.mockResolvedValue(defaultList());
- mockRemove.mockResolvedValue(undefined as never);
+ // `agentRegistryApi.remove` returns Promise<boolean> (agentRegistryApi.ts:147-154),
+ // so the success fixture must resolve `true`. Resolving `undefined as never`
+ // modelled a value the API cannot return, and the `as never` cast was the
+ // tell — it silenced the type error that was pointing this out. It also hid
+ // whether the panel handles a `false` (refused) result differently from a
+ // `true` one. Caught in review by `coderabbitai`.
+ mockRemove.mockResolvedValue(true);
mockSetEnabled.mockResolvedValue(agent({ id: 'researcher', enabled: false }));
});
diff --git a/app/src/components/settings/panels/__tests__/AboutPanel.states.test.tsx b/app/src/components/settings/panels/__tests__/AboutPanel.states.test.tsx
index d978a89873..16d7ad199c 100644
--- a/app/src/components/settings/panels/__tests__/AboutPanel.states.test.tsx
+++ b/app/src/components/settings/panels/__tests__/AboutPanel.states.test.tsx
@@ -2,6 +2,7 @@ import { fireEvent, screen, waitFor } from '@testing-library/react';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { renderWithProviders } from '../../../../test/test-utils';
+import { LATEST_APP_DOWNLOAD_URL } from '../../../../utils/config';
import type { AppUpdateInfo } from '../../../../utils/tauriCommands/core';
import AboutPanel from '../AboutPanel';
@@ -271,6 +272,12 @@ describe('AboutPanel — releases link', () => {
renderAbout();
fireEvent.click(await screen.findByRole('button', { name: /releases/i }));
expect(hoisted.mockOpenUrl).toHaveBeenCalledTimes(1);
- expect(String(hoisted.mockOpenUrl.mock.calls[0]?.[0])).toMatch(/^https?:\/\//);
+ // Assert the CONFIGURED constant, not merely "some http(s) URL". The test
+ // is named for opening the configured URL "rather than a hardcoded one",
+ // and a shape check like /^https?:\/\// is satisfied by exactly the
+ // hardcoded URL it claims to rule out — the assertion contradicted the
+ // name. `AboutPanel.tsx:152` passes `LATEST_APP_DOWNLOAD_URL`, so that is
+ // what the assertion should name. Caught in review by `coderabbitai`.
+ expect(hoisted.mockOpenUrl).toHaveBeenCalledWith(LATEST_APP_DOWNLOAD_URL);
});
});
diff --git a/app/src/components/settings/panels/__tests__/RecoveryPhrasePanel.custody.test.tsx b/app/src/components/settings/panels/__tests__/RecoveryPhrasePanel.custody.test.tsx
index 4fc154ffca..b0e00bf2ee 100644
--- a/app/src/components/settings/panels/__tests__/RecoveryPhrasePanel.custody.test.tsx
+++ b/app/src/components/settings/panels/__tests__/RecoveryPhrasePanel.custody.test.tsx
@@ -117,7 +117,30 @@ function installWorkingClipboard() {
* `ok` says, which is the branch the panel keys `setCopied` off.
*/
function installExecCommand(ok: boolean) {
- const execCommand = vi.fn(() => ok);
+ // Capture WHAT the legacy path put on the clipboard, not just that it tried.
+ // Returning a bare `ok` made both fallback tests pass even if the textarea
+ // were empty or held the wrong phrase: the rejected `writeText` proves the
+ // fallback was taken, never that it copied the right thing — and a false
+ // "Copied" here leaves the user without their recovery phrase. Caught in
+ // review by `chatgpt-codex-connector`.
+ //
+ // The panel appends a hidden textarea, assigns the phrase and selects it
+ // before calling copy (`RecoveryPhrasePanel.tsx:198-204`), so at this moment
+ // the value is readable from the selected element.
+ const copiedValues: string[] = [];
+ const execCommand = Object.assign(
+ vi.fn((command?: string) => {
+ if (command === 'copy') {
+ const active = document.activeElement;
+ const areas = Array.from(document.body.querySelectorAll('textarea'));
+ const source =
+ active instanceof HTMLTextAreaElement ? active : (areas[areas.length - 1] ?? null);
+ copiedValues.push(source ? source.value : '');
+ }
+ return ok;
+ }),
+ { copiedValues }
+ );
Object.defineProperty(document, 'execCommand', {
value: execCommand,
configurable: true,
@@ -160,6 +183,9 @@ describe('RecoveryPhrasePanel — clipboard fallback when the async API fails',
await waitFor(() => expect(screen.getByText(/Copied/i)).toBeInTheDocument());
expect(writeText).toHaveBeenCalledWith(PHRASE_12);
expect(execCommand).toHaveBeenCalledWith('copy');
+ // The phrase actually reached the clipboard surface — "Copied" is only
+ // truthful if the copied text is the phrase itself.
+ expect(execCommand.copiedValues).toEqual([PHRASE_12]);
});
it('does NOT report Copied when the fallback itself fails', async () => {
@@ -173,6 +199,9 @@ describe('RecoveryPhrasePanel — clipboard fallback when the async API fails',
await waitFor(() => expect(execCommand).toHaveBeenCalledWith('copy'));
expect(screen.queryByText(/^Copied$/i)).not.toBeInTheDocument();
+ // The attempt still carried the right phrase — this test is about the
+ // panel honouring a FAILED copy, not about it copying the wrong thing.
+ expect(execCommand.copiedValues).toEqual([PHRASE_12]);
});
it('leaves no textarea behind in the DOM after the fallback runs', async () => {
diff --git a/app/test/playwright/specs/connections-tab-aliases.spec.ts b/app/test/playwright/specs/connections-tab-aliases.spec.ts
new file mode 100644
index 0000000000..e644dbdd8b
--- /dev/null
+++ b/app/test/playwright/specs/connections-tab-aliases.spec.ts
@@ -0,0 +1,133 @@
+import { expect, test } from '@playwright/test';
+
+import {
+ bootRuntimeReadyGuestPage,
+ dismissWalkthroughIfPresent,
+ signInViaCallbackToken,
+ waitForAppReady,
+} from '../helpers/core-rpc';
+
+/**
+ * The Connections tab **alias table**, and the redirect that silently depends
+ * on it.
+ *
+ * `connections-tab-deeplinks.spec.ts` (mine) asserts what the URL says. This
+ * file asserts something different and untested: which tab a given `?tab=`
+ * value actually RESOLVES to. `Skills.tsx:517-543` accepts twelve canonical
+ * values, then maps four legacy ones — `apps → composio`, `messaging →
+ * channels`, `tools → mcp`, `explorer → skills` — and falls back to `welcome`
+ * for anything it does not recognise.
+ *
+ * The reason this is worth pinning is `AppRoutes.tsx:188`:
+ *
+ * <Route path="/channels" element={<Navigate to="/connections?tab=messaging" replace />} />
+ *
+ * The redirect targets a **legacy alias**, not a canonical value. So `/channels`
+ * — a route the app ships and links to — works only for as long as the
+ * back-compat table keeps an entry that looks, from inside `Skills.tsx`, purely
+ * historical. Delete `messaging` while tidying up "old" aliases and `/channels`
+ * does not error: it silently lands on the Welcome overview, because the
+ * fallback swallows an unrecognised value by design. The tab-deeplinks spec
+ * would not catch it either — the hash still reads `?tab=messaging`, which is
+ * all that one asserts. `alias resolution` and `URL correctness` are genuinely
+ * two contracts, and only the first is load-bearing for `/channels`.
+ *
+ * Assertions use the nav row's `aria-current`, not panel content
+ * (`TwoPaneNav.tsx:97-98` — `data-testid="two-pane-nav-<value>"` and
+ * `aria-current="page"` on the active row). That is deliberate: several panels
+ * fetch on mount, and asserting rendered content would make this file's result
+ * depend on an upstream registry rather than on the resolver. Selection is
+ * decided by a `useMemo` over `location.search` and nothing else.
+ *
+ * NOTE ON SCOPE: `apps → composio` is the one alias NOT covered. Selecting the
+ * Composio tab downloads the `tinyconnectors` module from a GitHub release, and
+ * a failed download is terminal for the core process (W3-ui-bugs.md §3) — it
+ * would take the rest of the file down with it. It is listed here so its
+ * absence reads as a decision rather than an oversight.
+ */
+
+/** The nav row for a canonical tab id. */
+const navRow = (page: import('@playwright/test').Page, tab: string) =>
+ page.getByTestId(`two-pane-nav-${tab}`);
+
+/** Assert `tab` is the selected row, and that exactly one row is selected. */
+async function expectSelectedTab(page: import('@playwright/test').Page, tab: string) {
+ await expect(navRow(page, tab)).toHaveAttribute('aria-current', 'page', { timeout: 15_000 });
+ // One selected row, not "the one I asked about happens to be marked". A
+ // resolver returning several actives, or marking every row, would otherwise
+ // satisfy the assertion above.
+ await expect(page.locator('[data-testid^="two-pane-nav-"][aria-current="page"]')).toHaveCount(1);
+}
+
+async function openConnections(
+ page: import('@playwright/test').Page,
+ userId: string,
+ route: string
+) {
+ await bootRuntimeReadyGuestPage(page);
+ await signInViaCallbackToken(page, userId);
+ await page.evaluate(target => {
+ try {
+ localStorage.setItem('openhuman:walkthrough_completed', 'true');
+ localStorage.removeItem('openhuman:walkthrough_pending');
+ } catch {}
+ window.location.hash = target;
+ }, route);
+ await expect
+ .poll(async () => page.evaluate(() => window.location.hash), { timeout: 15_000 })
+ .toContain('/connections');
+ await waitForAppReady(page);
+ await dismissWalkthroughIfPresent(page);
+}
+
+test.describe('Connections — legacy ?tab= aliases resolve to their canonical tab', () => {
+ test('?tab=messaging selects Channels', async ({ page }) => {
+ await openConnections(page, 'pw-alias-messaging', '/connections?tab=messaging');
+ await expectSelectedTab(page, 'channels');
+ });
+
+ test('?tab=tools selects MCP', async ({ page }) => {
+ await openConnections(page, 'pw-alias-tools', '/connections?tab=tools');
+ await expectSelectedTab(page, 'mcp');
+ });
+
+ test('?tab=explorer selects Skills', async ({ page }) => {
+ await openConnections(page, 'pw-alias-explorer', '/connections?tab=explorer');
+ await expectSelectedTab(page, 'skills');
+ });
+
+ test('a canonical value still wins directly', async ({ page }) => {
+ // The control. If this failed alongside the alias tests, the fault would be
+ // in tab selection generally rather than in the alias table.
+ await openConnections(page, 'pw-alias-canonical', '/connections?tab=llm');
+ await expectSelectedTab(page, 'llm');
+ });
+});
+
+test.describe('Connections — unrecognised ?tab= falls back rather than breaking', () => {
+ test('an unknown tab value lands on Welcome, not a blank pane', async ({ page }) => {
+ // A stale bookmark naming a tab that no longer exists must degrade to the
+ // overview. `Skills.tsx:542` returns 'welcome' for anything unmatched.
+ await openConnections(page, 'pw-alias-unknown', '/connections?tab=zzz-not-a-tab');
+ await expectSelectedTab(page, 'welcome');
+ });
+
+ test('no ?tab= at all lands on Welcome', async ({ page }) => {
+ await openConnections(page, 'pw-alias-none', '/connections');
+ await expectSelectedTab(page, 'welcome');
+ });
+});
+
+test.describe('Connections — /channels depends on the alias table', () => {
+ test('/channels lands on the Channels TAB, not merely a messaging URL', async ({ page }) => {
+ // The two-layer contract in one assertion: `AppRoutes.tsx:188` rewrites
+ // /channels to `?tab=messaging`, and only the alias table turns that into
+ // the Channels tab. Asserting the hash alone (as the deeplinks spec does)
+ // passes even when the second layer is gone.
+ await openConnections(page, 'pw-alias-channels-route', '/channels');
+ await expect
+ .poll(async () => page.evaluate(() => window.location.hash), { timeout: 15_000 })
+ .toContain('tab=messaging');
+ await expectSelectedTab(page, 'channels');
+ });
+});
diff --git a/app/test/playwright/specs/connections-tab-deeplinks.spec.ts b/app/test/playwright/specs/connections-tab-deeplinks.spec.ts
index db32af0d79..98e84986c3 100644
--- a/app/test/playwright/specs/connections-tab-deeplinks.spec.ts
+++ b/app/test/playwright/specs/connections-tab-deeplinks.spec.ts
@@ -70,6 +70,20 @@ async function openRoute(
const currentHash = (page: import('@playwright/test').Page) =>
page.evaluate(() => window.location.hash);
+/**
+ * Assert which nav row is selected.
+ *
+ * `TwoPaneNav.tsx:98` marks the active row with `aria-current="page"`. Asserting
+ * a row is *visible* says nothing — every row is visible on every tab — so any
+ * check of "did we land on the right tab" has to read the selection.
+ */
+async function expectSelectedTab(page: import('@playwright/test').Page, tab: string) {
+ await expect(page.getByTestId(`two-pane-nav-${tab}`)).toHaveAttribute('aria-current', 'page', {
+ timeout: 15_000,
+ });
+ await expect(page.locator('[data-testid^="two-pane-nav-"][aria-current="page"]')).toHaveCount(1);
+}
+
test.describe('Connections — the URL follows the tab', () => {
test('clicking a tab writes ?tab= into the address bar', async ({ page }) => {
await openRoute(page, 'pw-conn-url-click', '/connections');
@@ -143,10 +157,12 @@ test.describe('Connections — deep links land on the named tab', () => {
page,
}) => {
await openRoute(page, 'pw-conn-unknown-tab', '/connections?tab=not-a-real-tab');
- // The nav must still be there — an unrecognised value must not strand the
- // user on an empty page.
- await expect(page.getByTestId('two-pane-nav-composio')).toBeVisible();
- await expect(page.getByTestId('two-pane-nav-channels')).toBeVisible();
+ // Assert WHICH tab the fallback selected, not merely that the nav rendered.
+ // The nav rows are present on every tab, so the earlier form passed if an
+ // unknown value selected MCP, Channels, or anything else non-blank — it
+ // could not distinguish a working fallback from a wrong one. Caught in
+ // review by `coderabbitai`.
+ await expectSelectedTab(page, 'welcome');
});
});
@@ -170,8 +186,11 @@ test.describe('Connections — the /skills back-compat redirect', () => {
const hash = await currentHash(page);
expect(hash).not.toContain('tab=channels');
- // The user asked for messaging and got the overview instead.
- await expect(page.getByTestId('two-pane-nav-channels')).toBeVisible();
+ // The user asked for messaging and got the overview instead. Assert the
+ // SELECTED tab: the previous form asserted that the Channels nav row was
+ // visible, which is true on every tab and therefore proved nothing about
+ // the harm this test exists to document.
+ await expectSelectedTab(page, 'welcome');
});
test('/channels keeps working, because its redirect names the tab explicitly', async ({
diff --git a/app/test/playwright/specs/flow-canvas-node-add.spec.ts b/app/test/playwright/specs/flow-canvas-node-add.spec.ts
index acaa7bf341..793bfccf78 100644
--- a/app/test/playwright/specs/flow-canvas-node-add.spec.ts
+++ b/app/test/playwright/specs/flow-canvas-node-add.spec.ts
@@ -16,7 +16,7 @@ import {
* - **click** an entry → `onAdd(entry)` — "the path the unit tests drive"
* - **drag** an entry onto the canvas → an `application/tinyflows-node`
* payload on `dataTransfer`, resolved by the canvas's `onDrop`
- * (`EditableFlowCanvas.tsx:552-566`)
+ * (`EditableFlowCanvas.tsx:550,784`)
*
* The drag path is therefore the one with no coverage, and it is HTML5
* drag-and-drop with a custom MIME type — **jsdom implements neither**, so a
@@ -25,8 +25,8 @@ import {
*
* The leave guard is included because losing canvas edits is the expensive
* failure on this surface: adding a node makes the editor dirty
- * (`FlowCanvasPage.tsx:1099`), and navigating away must interrupt with a
- * confirm (`:1254`) offering both Stay (`:1265`) and Discard (`:1274`).
+ * (`FlowCanvasPage.tsx:359, badge :1132`), and navigating away must interrupt with a
+ * confirm (`:1339`) offering both Stay (`:1345`) and Discard (`:1347`).
*/
const currentHash = (page: import('@playwright/test').Page) =>
@@ -93,9 +93,9 @@ async function openCanvas(page: import('@playwright/test').Page, userId: string)
await expect(page.getByTestId('flow-canvas-title')).toBeVisible({ timeout: 20_000 });
await expect(page.getByTestId('flow-canvas-title')).toHaveValue(name);
- // The insert palette is NOT visible by default. `FlowCanvasPage.tsx:1199`
+ // The insert palette is NOT visible by default. `FlowCanvasPage.tsx:1253`
// passes `showPalette={sidePanel === 'legend'}` and `sidePanel` starts at
- // 'copilot' (:417), so the palette lives behind the "legend" tab of the
+ // 'copilot' (:454), so the palette lives behind the "legend" tab of the
// side-panel toggle. Worth knowing: the canvas empty state says "Add a node
// from the palette on the left", but the palette is `absolute right-3`
// (NodePalette.tsx:37) and hidden until this click.
@@ -211,8 +211,16 @@ test.describe('Flow canvas — the unsaved-changes guard', () => {
await expect(page.getByTestId('flow-leave-confirm')).toBeVisible({ timeout: 15_000 });
await page.getByTestId('flow-leave-discard').click();
- await expect.poll(() => currentHash(page), { timeout: 15_000 }).toContain('/flows');
- expect(await currentHash(page)).not.toContain(`/flows/${flowId}`);
+ // Poll the NARROW condition — the absence of this flow's own path. Polling
+ // `toContain('/flows')` first, as an earlier draft did, is vacuous here:
+ // `/flows/<id>` already contains `/flows`, so that poll returns true on its
+ // first evaluation, before the click has navigated anywhere. It then left
+ // the real assertion (`not.toContain('/flows/<id>')`) running unguarded
+ // against an in-flight navigation — a check that was simultaneously
+ // meaningless and racy. Caught in review by `tinysweeper`.
+ await expect
+ .poll(() => currentHash(page), { timeout: 15_000 })
+ .not.toContain(`/flows/${flowId}`);
// And the discard was real: the stored graph still has its single node.
const payload = await callCoreRpc<unknown>('openhuman.flows_get', { id: flowId });
@@ -223,12 +231,18 @@ test.describe('Flow canvas — the unsaved-changes guard', () => {
test('a clean canvas leaves immediately, with no confirm', async ({ page }) => {
// The guard must not nag when there is nothing to lose.
- await openCanvas(page, 'pw-canvas-leave-clean');
+ const { flowId } = await openCanvas(page, 'pw-canvas-leave-clean');
await expect(page.getByTestId('flow-editor-dirty')).toHaveCount(0);
await page.getByTestId('flow-canvas-back').click();
await expect(page.getByTestId('flow-leave-confirm')).toHaveCount(0, { timeout: 10_000 });
- await expect.poll(() => currentHash(page), { timeout: 15_000 }).toContain('/flows');
+ // Same trap as the Discard test, and here it was the ONLY positive
+ // assertion: `toContain('/flows')` is already true on `/flows/<id>`, so
+ // this test reported success whether or not the back button navigated at
+ // all — it could not fail. Assert that we left THIS flow's route.
+ await expect
+ .poll(() => currentHash(page), { timeout: 15_000 })
+ .not.toContain(`/flows/${flowId}`);
});
});
diff --git a/app/test/playwright/specs/flows-canvas-routes.spec.ts b/app/test/playwright/specs/flows-canvas-routes.spec.ts
index 352e6146ea..a4c90c4a39 100644
--- a/app/test/playwright/specs/flows-canvas-routes.spec.ts
+++ b/app/test/playwright/specs/flows-canvas-routes.spec.ts
@@ -19,7 +19,7 @@ import {
*
* A note on `/flows/draft`, because the brief expected it to open a canvas and
* it deliberately does not: the draft graph rides in `location.state`
- * (`FlowCanvasPage.tsx:1536-1546`), so a direct URL hit or a hard reload has no
+ * (`FlowCanvasPage.tsx:1546-1558`), so a direct URL hit or a hard reload has no
* draft and the route renders an empty state on purpose — "rather than a broken
* canvas". That is the behaviour pinned below. Reaching the draft canvas needs
* the chat WorkflowProposalCard's "Open in canvas" action, which is a chat-side
@@ -103,7 +103,7 @@ test.describe('Flows — an existing flow opens its canvas', () => {
// The canvas header carries the flow name; `flow-canvas-not-found` is the
// negative case and must NOT be what renders.
await expect(page.getByTestId('flow-canvas-title')).toBeVisible({ timeout: 20_000 });
- // `flow-canvas-title` is an <input> (the rename field, FlowCanvasPage:1145-1150),
+ // `flow-canvas-title` is an <input> (the rename field, FlowCanvasPage:1178),
// so the name is its VALUE. `toContainText` reads text content and would
// always see "" here — a green-looking assertion that checks nothing.
await expect(page.getByTestId('flow-canvas-title')).toHaveValue(name);
@@ -132,7 +132,14 @@ test.describe('Flows — an existing flow opens its canvas', () => {
await expect(page.getByTestId('flow-canvas-title')).toBeVisible({ timeout: 20_000 });
await page.getByTestId('flow-canvas-back').click();
- await expect.poll(() => currentHash(page), { timeout: 15_000 }).toContain('/flows');
+ // Not `toContain('/flows')` — `/flows/<id>` already satisfies that, so the
+ // poll would pass before the click navigated. Nobody flagged this one; it
+ // is the same defect `tinysweeper` found twice in the node-add spec, and
+ // the only reason it was not load-bearing here is the list-only assertion
+ // below. Fixed anyway, so the poll means what it appears to mean.
+ await expect
+ .poll(() => currentHash(page), { timeout: 15_000 })
+ .not.toContain(`/flows/${flowId}`);
await expect(newWorkflowButton(page)).toBeVisible({ timeout: 20_000 });
});
});
@@ -141,14 +148,19 @@ test.describe('Flows — the unsaved draft route', () => {
test('/flows/draft hit directly shows an empty state, not a broken canvas', async ({ page }) => {
// Pinning documented behaviour: the draft graph lives in `location.state`,
// so a direct hit or a reload legitimately has nothing to render
- // (FlowCanvasPage.tsx:1541-1545).
+ // (FlowCanvasPage.tsx:1550-1558).
await bootAuthenticatedPage(page, 'pw-flows-draft', '/home');
await dismissWalkthroughIfPresent(page);
await goto(page, '/flows/draft');
- // No canvas, and no crash: the back affordance is what proves we landed on
- // the deliberate empty state rather than a blank screen.
- await expect(page.getByTestId('flow-canvas-back')).toBeVisible({ timeout: 20_000 });
+ // Assert the draft empty state BY NAME. An earlier draft asserted only
+ // "back button visible, no title", which the unknown-flow screen also
+ // satisfies — it has a back affordance and no title either — so the test
+ // passed on the wrong screen. `flow-canvas-draft-missing`
+ // (FlowCanvasPage.tsx:1595) is unique to this state. Caught in review by
+ // `coderabbitai`.
+ await expect(page.getByTestId('flow-canvas-draft-missing')).toBeVisible({ timeout: 20_000 });
+ await expect(page.getByTestId('flow-canvas-back')).toBeVisible();
await expect(page.getByTestId('flow-canvas-title')).toHaveCount(0);
});
@@ -161,8 +173,13 @@ test.describe('Flows — the unsaved draft route', () => {
await dismissWalkthroughIfPresent(page);
await goto(page, '/flows/draft');
- await expect(page.getByTestId('flow-canvas-back')).toBeVisible({ timeout: 20_000 });
+ // Positively the draft state, not merely "not the not-found state": the
+ // previous form excluded `flow-canvas-not-found` but still accepted
+ // `flow-canvas-error`, so a `flows_get('draft')` that failed loudly would
+ // have passed this test.
+ await expect(page.getByTestId('flow-canvas-draft-missing')).toBeVisible({ timeout: 20_000 });
await expect(page.getByTestId('flow-canvas-not-found')).toHaveCount(0);
+ await expect(page.getByTestId('flow-canvas-error')).toHaveCount(0);
});
});
diff --git a/app/test/playwright/specs/skills-search-install.spec.ts b/app/test/playwright/specs/skills-search-install.spec.ts
index 13ba459b8c..2d965aa698 100644
--- a/app/test/playwright/specs/skills-search-install.spec.ts
+++ b/app/test/playwright/specs/skills-search-install.spec.ts
@@ -127,10 +127,42 @@ test.describe('Skills explorer — typing narrows what is on screen', () => {
test('the typed text is preserved in the box while results load', async ({ page }) => {
// A search box that clears itself mid-request loses what the user typed.
+ //
+ // The search RPC is HELD so the assertion lands while the request is
+ // genuinely outstanding. The earlier form typed, slept 800ms and asserted —
+ // which proves the value survives a fixed delay, not that it survives a
+ // request in flight. By 800ms the search may already have completed, in
+ // which case the test says nothing about the "while results load" case its
+ // own name claims. Caught in review by `coderabbitai`.
+ let releaseSearch!: () => void;
+ const searchHeld = new Promise<void>(resolve => {
+ releaseSearch = resolve;
+ });
+ let searchStarted = false;
+
await openSkillsTab(page, 'pw-skills-preserve');
+
+ await page.route('**/rpc', async (route, request) => {
+ let method = '';
+ try {
+ method = JSON.parse(request.postData() || '{}').method ?? '';
+ } catch {
+ /* pass through */
+ }
+ if (method === 'openhuman.skill_registry_search') {
+ searchStarted = true;
+ await searchHeld;
+ }
+ await route.continue();
+ });
+
await searchBox(page).fill('docker');
- await page.waitForTimeout(800);
+
+ // Wait for the request to actually be in flight, then assert.
+ await expect.poll(() => searchStarted, { timeout: 15_000 }).toBe(true);
await expect(searchBox(page)).toHaveValue('docker');
+
+ releaseSearch();
});
});
@@ -185,6 +217,19 @@ test.describe('Skills explorer — the install button', () => {
test('a failed install re-enables the button rather than stranding it', async ({ page }) => {
// If the button stayed disabled on failure the user could not retry, and
// nothing on screen would say why.
+ //
+ // The install response is HELD rather than answered immediately. Without
+ // that, "enabled and reading Install" is also the button's INITIAL state,
+ // so the test passed whether or not the click ever did anything — it could
+ // not distinguish recovery from a no-op. Holding lets us prove the round
+ // trip: enabled -> (held) disabled/Installing -> released -> enabled again.
+ // Caught in review by `coderabbitai`.
+ let releaseInstall!: () => void;
+ const installHeld = new Promise<void>(resolve => {
+ releaseInstall = resolve;
+ });
+ let installBody: { id?: unknown } = {};
+
await page.route('**/rpc', async (route, request) => {
let body: { method?: string; id?: unknown } = {};
try {
@@ -193,12 +238,14 @@ test.describe('Skills explorer — the install button', () => {
/* pass through */
}
if (body.method === 'openhuman.skill_registry_install') {
+ installBody = body;
+ await installHeld;
await route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({
jsonrpc: '2.0',
- id: body.id,
+ id: installBody.id,
error: { code: -32000, message: 'install refused by the registry' },
}),
});
@@ -209,8 +256,15 @@ test.describe('Skills explorer — the install button', () => {
await openSkillsTab(page, 'pw-skills-install-fail');
const button = await firstInstallButton(page);
+ await expect(button).toBeEnabled();
await button.click();
+ // The pending state must actually be reached before the failure.
+ await expect(button).toBeDisabled({ timeout: 15_000 });
+ await expect(button).toHaveText(/installing/i);
+
+ releaseInstall();
+
await expect(button).toBeEnabled({ timeout: 20_000 });
await expect(button).toHaveText(/install/i);
});