Skip to content

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

test(e2e): browser coverage for skills search debounce and install states\n\nskills-registry.spec.ts has a test called "search filters entries by query",\nbut it sits in that file's RPC-smoke describe: it calls\nopenhuman.skill_registry_search directly and never touches the UI. Nothing\ntyped into the search box, and nothing exercised the install button.\n\nThe part only a browser can check is the debounce. SkillsExplorerTab.tsx:22\nsets SEARCH_DEBOUNCE_MS = 300 and restarts the timer per keystroke, so a burst\nof typing must produce ONE catalog search carrying the FINAL text, and a pause\nmust produce a second — it has to delay, not swallow. These count real RPCs\nagainst real keystroke timing.\n\nThe install button's middle state is the same shape: Install -> Installing\n(disabled) -> Installed badge, where the middle only exists while the request is\noutstanding. The spec holds the install RPC open with a route handler to observe\nit, then releases. A third test fails the install and asserts the button\nre-enables, since a button stranded disabled leaves the user unable to retry.\n\nOne test was written and REMOVED as vacuous before committing: it asserted\n`queries.length >= previousCount` after clearing the box, which array lengths\nmake structurally always true. The meaningful half is folded into the filter\ntest instead — a no-match query empties the catalog AND clearing restores it.\n\nRevert-proofed with three mutations, each rebuilt before the run:\n - SEARCH_DEBOUNCE_MS = 0 -> the burst test fails with\n 'expected one debounced search, got 6: ["d","do","doc","dock","docke","docker"]',\n a per-keystroke prefix sequence no unchanged build could emit.\n - the in-flight `disabled` removed -> only the Installing test fails.\n - the state reset moved out of `finally` into the success path -> only the\n re-enable test fails.\nNote on the third: an earlier attempt used an early `return` in the `catch`,\nwhich does NOT work because `finally` runs after `return` — the test would have\npassed and been wrongly recorded as unproven. A mutation that changes nothing is\nindistinguishable from a vacuous test; see W3-ui-bugs.md §10.\nSkillsExplorerTab.tsx restored (git diff --quiet verified).\n\n7/7, and 34/34 across all four of my specs, on the assigned ports\n(18403/17703/4403). No production code changed.\n

M3gA-Minde58446103e46
diff --git a/app/test/playwright/specs/skills-search-install.spec.ts b/app/test/playwright/specs/skills-search-install.spec.ts
new file mode 100644
index 0000000000..7edbaeaffe
--- /dev/null
+++ b/app/test/playwright/specs/skills-search-install.spec.ts
@@ -0,0 +1,215 @@
+import { expect, test } from '@playwright/test';
+
+import {
+ bootRuntimeReadyGuestPage,
+ dismissWalkthroughIfPresent,
+ signInViaCallbackToken,
+ waitForAppReady,
+} from '../helpers/core-rpc';
+
+/**
+ * The Skills explorer's search and install affordances, driven in a real
+ * browser.
+ *
+ * `skills-registry.spec.ts` has a test called "search filters entries by query",
+ * but it lives in that file's `Skill registry RPC smoke` describe — it calls
+ * `openhuman.skill_registry_search` directly and never touches the UI. Nothing
+ * types into the search box, and nothing exercises the install button.
+ *
+ * The part that only a browser can check is the **debounce**:
+ * `SkillsExplorerTab.tsx:22` sets `SEARCH_DEBOUNCE_MS = 300` and `:469-478`
+ * restarts the timer on every keystroke, so a burst of typing must produce ONE
+ * catalog search rather than one per character. Counting real RPCs against real
+ * keystroke timing is not something jsdom reproduces faithfully.
+ *
+ * NOTE ON SCOPE: this uses `?tab=skills`, never the Composio tab. Opening that
+ * one downloads the `tinyconnectors` module from a GitHub release and a failed
+ * download is terminal for the core process — see W3-ui-bugs.md §3.
+ */
+
+const SEARCH = 'skill-search-input';
+
+async function openSkillsTab(page: import('@playwright/test').Page, userId: string) {
+ await bootRuntimeReadyGuestPage(page);
+ await signInViaCallbackToken(page, userId);
+ await page.evaluate(() => {
+ try {
+ localStorage.setItem('openhuman:walkthrough_completed', 'true');
+ localStorage.removeItem('openhuman:walkthrough_pending');
+ } catch {}
+ window.location.hash = '/connections?tab=skills';
+ });
+ await expect
+ .poll(() => page.evaluate(() => window.location.hash), { timeout: 15_000 })
+ .toContain('tab=skills');
+ await waitForAppReady(page);
+ await dismissWalkthroughIfPresent(page);
+ await expect(page.getByTestId(SEARCH)).toBeVisible({ timeout: 20_000 });
+}
+
+/** Count `skill_registry_search` RPCs, letting everything through untouched. */
+async function countSearchRpcs(page: import('@playwright/test').Page) {
+ const queries: string[] = [];
+ await page.route('**/rpc', async (route, request) => {
+ try {
+ const body = JSON.parse(request.postData() || '{}');
+ if (body.method === 'openhuman.skill_registry_search') {
+ queries.push(String(body.params?.query ?? ''));
+ }
+ } catch {
+ /* not JSON — pass it through untouched */
+ }
+ await route.continue();
+ });
+ return queries;
+}
+
+const searchBox = (page: import('@playwright/test').Page) => page.getByTestId(SEARCH);
+
+test.describe('Skills explorer — the search box debounces', () => {
+ test('a burst of typing issues ONE catalog search, not one per keystroke', async ({ page }) => {
+ await openSkillsTab(page, 'pw-skills-debounce');
+ const queries = await countSearchRpcs(page);
+
+ // Type well inside the 300 ms window. Playwright's default `type` delay is
+ // 0, so these land in a few milliseconds of each other.
+ await searchBox(page).type('docker', { delay: 20 });
+
+ // Wait past the debounce and let the request settle.
+ await expect.poll(() => queries.length, { timeout: 10_000 }).toBeGreaterThan(0);
+ await page.waitForTimeout(600);
+
+ expect(
+ queries.length,
+ `expected one debounced search, got ${queries.length}: ${JSON.stringify(queries)}`
+ ).toBe(1);
+ // And the one that fired carries the FINAL text, not a prefix.
+ expect(queries[0]).toBe('docker');
+ });
+
+ test('a pause between words issues a second search', async ({ page }) => {
+ // The mirror of the test above: the debounce must delay, not swallow.
+ await openSkillsTab(page, 'pw-skills-debounce-two');
+ const queries = await countSearchRpcs(page);
+
+ await searchBox(page).type('git', { delay: 20 });
+ await expect.poll(() => queries.length, { timeout: 10_000 }).toBe(1);
+
+ await searchBox(page).type('hub', { delay: 20 });
+ await expect.poll(() => queries.length, { timeout: 10_000 }).toBe(2);
+ expect(queries[1]).toBe('github');
+ });
+
+});
+
+test.describe('Skills explorer — typing narrows what is on screen', () => {
+ test('a query with no matches leaves no catalog rows', async ({ page }) => {
+ await openSkillsTab(page, 'pw-skills-nomatch');
+
+ // Baseline: the catalog has something in it.
+ await expect(page.getByRole('row').first()).toBeVisible({ timeout: 20_000 });
+
+ const rows = page.locator('[data-testid^="registry-install-"]');
+ await expect(rows.first()).toBeVisible({ timeout: 20_000 });
+
+ await searchBox(page).fill('zzzz-no-such-skill-zzzz');
+ // Any install button is a catalog row; none should survive this query.
+ await expect(rows).toHaveCount(0, { timeout: 15_000 });
+
+ // ...and clearing must bring them back. An earlier version of this file
+ // asserted only `searchRpcCount >= previousCount` here, which can never be
+ // false — the restoration is the part with content.
+ await searchBox(page).fill('');
+ await expect(rows.first()).toBeVisible({ timeout: 20_000 });
+ });
+
+ 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.
+ await openSkillsTab(page, 'pw-skills-preserve');
+ await searchBox(page).fill('docker');
+ await page.waitForTimeout(800);
+ await expect(searchBox(page)).toHaveValue('docker');
+ });
+});
+
+test.describe('Skills explorer — the install button', () => {
+ /** Find the first catalog row offering an install. */
+ async function firstInstallButton(page: import('@playwright/test').Page) {
+ const button = page.locator('[data-testid^="registry-install-"]').first();
+ await expect(button).toBeVisible({ timeout: 20_000 });
+ return button;
+ }
+
+ test('offers Install, and the button is enabled before it is pressed', async ({ page }) => {
+ await openSkillsTab(page, 'pw-skills-install-idle');
+ const button = await firstInstallButton(page);
+
+ await expect(button).toBeEnabled();
+ await expect(button).toHaveText(/install/i);
+ });
+
+ test('disables the button and shows Installing while the RPC is in flight', async ({ page }) => {
+ // The transition only exists while the request is outstanding, so the
+ // install RPC is held open deliberately. This is the state a jsdom test
+ // cannot observe without faking timers.
+ let release!: () => void;
+ const held = new Promise<void>(resolve => {
+ release = resolve;
+ });
+
+ await page.route('**/rpc', async (route, request) => {
+ let method = '';
+ try {
+ method = JSON.parse(request.postData() || '{}').method ?? '';
+ } catch {
+ /* pass through */
+ }
+ if (method === 'openhuman.skill_registry_install') {
+ await held;
+ }
+ await route.continue();
+ });
+
+ await openSkillsTab(page, 'pw-skills-install-inflight');
+ const button = await firstInstallButton(page);
+ await button.click();
+
+ await expect(button).toBeDisabled({ timeout: 10_000 });
+ await expect(button).toHaveText(/installing/i);
+
+ release();
+ });
+
+ 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.
+ await page.route('**/rpc', async (route, request) => {
+ let body: { method?: string; id?: unknown } = {};
+ try {
+ body = JSON.parse(request.postData() || '{}');
+ } catch {
+ /* pass through */
+ }
+ if (body.method === 'openhuman.skill_registry_install') {
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify({
+ jsonrpc: '2.0',
+ id: body.id,
+ error: { code: -32000, message: 'install refused by the registry' },
+ }),
+ });
+ return;
+ }
+ await route.continue();
+ });
+
+ await openSkillsTab(page, 'pw-skills-install-fail');
+ const button = await firstInstallButton(page);
+ await button.click();
+
+ await expect(button).toBeEnabled({ timeout: 20_000 });
+ await expect(button).toHaveText(/install/i);
+ });
+});