Skip to content

Conversation

@konard
Copy link
Collaborator

@konard konard commented Oct 25, 2025

Summary

This PR adds comprehensive integration tests to verify that both Puppeteer and Playwright browser engines can successfully download and process a real-world StackOverflow page, including:

  • Converting the page HTML to markdown format
  • Capturing screenshots of the page as PNG images

Changes

New Tests (tests/integration/browser-engines.test.js)

Added test suite "StackOverflow Page Download" with tests for both engines:

Puppeteer Engine:

  • ✅ Can download StackOverflow page and convert to markdown
  • ✅ Can take a screenshot of StackOverflow page

Playwright Engine:

  • ✅ Can download StackOverflow page and convert to markdown
  • ✅ Can take a screenshot of StackOverflow page

The tests verify:

  1. Page content is successfully retrieved (HTML > 1000 chars)
  2. Markdown conversion produces valid output (> 100 chars)
  3. Markdown contains expected content ("How do I undo the most recent local commits in Git")
  4. Screenshots are valid PNG files with correct signature bytes
  5. Both engines work with the specific URL: https://stackoverflow.com/questions/927358/how-do-i-undo-the-most-recent-local-commits-in-git

Configuration Updates

  • jest.config.mjs: Added **/tests/integration/**/*.test.js to testMatch pattern to enable integration tests

Bug Fixes

  • src/browser.js: Fixed Playwright adapter's setUserAgent method. Playwright doesn't have a page.setUserAgent() method, so implemented it using route interception to modify request headers

Performance Tuning

  • Increased navigation timeout to 60000ms (60s) for StackOverflow tests to handle slower page loads
  • Increased test timeout to 90000ms (90s) to ensure tests have enough time to complete

Test Results

All 11 tests pass successfully:

Test Suites: 1 passed, 1 total
Tests:       11 passed, 11 total
Time:        116.733 s

Fixes

Fixes #11


🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: undefined
@konard konard self-assigned this Oct 25, 2025
…down and image support

This commit implements comprehensive integration tests to verify that both Puppeteer and Playwright engines can:
- Download the StackOverflow page at https://stackoverflow.com/questions/927358/how-do-i-undo-the-most-recent-local-commits-in-git
- Convert the page HTML to markdown format
- Capture screenshots of the page as PNG images

Changes:
- Add StackOverflow download tests for both Puppeteer and Playwright engines in tests/integration/browser-engines.test.js
- Update jest.config.mjs to include integration tests in testMatch pattern
- Fix Playwright adapter's setUserAgent implementation to use route interception (Playwright doesn't have page.setUserAgent())
- Increase timeout for StackOverflow tests to 60000ms for navigation and 90000ms for test completion to handle slower page loads

All tests pass successfully, confirming that both browser engines work correctly for downloading and processing complex real-world pages.

Fixes #11

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Add test that we can actually download StackOverflow page (markdown + image) in all our supported engines Add integration tests for StackOverflow page download with markdown and image support Oct 25, 2025
@konard konard marked this pull request as ready for review October 25, 2025 08:22
@konard
Copy link
Collaborator Author

konard commented Oct 25, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

📎 Log file uploaded as GitHub Gist (277KB)
🔗 View complete solution draft log


Now working session is ended, feel free to review and add any feedback on the solution draft.

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.

Add test that we can actually download StackOverflow page (markdown + image) in all our supported engines

1 participant