Skip to content

test: migrate click_at handler tests to mocks - #3190

Merged
OrKoN merged 1 commit into
ChromeDevTools:mainfrom
twotnguyen:test/migrate-click-at-tests-to-mocks
Oct 16, 2026
Merged

OrKoN merged 1 commit into
ChromeDevTools:mainfrom
twotnguyen:test/migrate-click-at-tests-to-mocks

Conversation

@twotnguyen

Copy link
Copy Markdown
Contributor

Part of #2639.

The click_at handler tests launched a real browser only to verify that coordinates and click count reach page.mouse.click() and that the expected response line is recorded. This migrates them in place to createHandlerMocks, following AGENTS.md:

  • Exposes CdpMouse from src/third_party/index.ts and stubs page.mouse on createMockPuppeteerPage() in tests/mocks.ts.
  • Migrates click_at › clicks at coordinates to assert calledOnceWithExactly(page.pptrPage.mouse.click, 50, 50, {count: 1}) and appendResponseLine.
  • Migrates click_at › double clicks at coordinates to assert count: 2 on dblClick: true.
  • Adds a check for includeSnapshot: true asserting sinon.assert.calledOnce(response.includeSnapshot).

Testing

  • npm run build && NODE_TEST_REPORTER=spec node scripts/test.js tests/tools/input.test.ts --test-name-pattern="click_at": all 3 migrated tests pass in ~140ms (down from ~1800ms).
  • Passes with PUPPETEER_EXECUTABLE_PATH pointing at a nonexistent binary, so none of the migrated tests starts Chrome.
  • Sanity check that regressions are caught: passing wrong coordinates, wrong count, or omitting includeSnapshot causes the corresponding assertion to fail.
  • eslint and prettier pass with zero errors.

@OrKoN
OrKoN self-requested a review October 16, 2026 08:07

@OrKoN OrKoN left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL at the merge conflicts

@twotnguyen
twotnguyen force-pushed the test/migrate-click-at-tests-to-mocks branch from 2c9ffc1 to 05f1a0f Compare October 16, 2026 09:41
@twotnguyen

Copy link
Copy Markdown
Contributor Author

Rebased onto latest main (c6ad84a) and resolved the merge conflict in tests/mocks.ts. All click_at tests pass cleanly in mocks.

@OrKoN
OrKoN enabled auto-merge October 16, 2026 09:59
@OrKoN
OrKoN added this pull request to the merge queue Oct 16, 2026
Merged via the queue into ChromeDevTools:main with commit 382f441 Oct 16, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants