Skip to content

bug(test): home-coverage E2E search-suggestions step flakes — fetch path needs mocking #1313

@Kpa-clawbot

Description

@Kpa-clawbot

Problem

The step('search input renders suggestions for a 1-char query', ...) block in test-home-coverage-e2e.js flakes intermittently in CI. The test waits for .home-suggest.open to appear, but home.js wraps the /api/nodes/search?q=... fetch in a try/catch — when the fetch fails or times out (cold CI, network blip), the .open class never gets added to .home-suggest and the test waits forever.

This has been "fixed" twice already with timing tweaks; the underlying issue is that the test exercises a real network path with no mock.

Workaround

PR #1310 skips the body of this single step (keeps pickedPubkey/pickedName populated via pickAnyPubkey(page) so later steps still work). All other home-coverage steps remain.

Proper fix

Mock /api/nodes/search at the Playwright level (page.route('**/api/nodes/search**', ...)) so the suggestion dropdown render is exercised against a deterministic response. That gives us coverage of the UI path without depending on the live API.

Bonus: consider whether home.js's try/catch should at least add .home-suggest.open with an empty/error state on fetch failure, so the dropdown isn't silently invisible to users when the API hiccups.

Refs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions