Skip to content

test: convert integration tests to use real browser#5

Open
amondnet wants to merge 1 commit intomainfrom
test/add-real-browser-integration
Open

test: convert integration tests to use real browser#5
amondnet wants to merge 1 commit intomainfrom
test/add-real-browser-integration

Conversation

@amondnet
Copy link
Contributor

@amondnet amondnet commented Nov 8, 2025

Summary

  • Convert mock-based integration tests to use real headless Chrome browser
  • Add Chrome system dependencies installation in CI for Ubuntu runners
  • Add integration test execution step to CI workflow

Changes

Test Changes (test/integration/browser/index.test.ts)

  • Removed Puppeteer mocking (mock.module)
  • Implemented real browser integration tests
  • Tests now launch actual headless Chrome via Puppeteer
  • Verify real browser capabilities: launch, navigation, page management, lifecycle

CI Changes (.github/workflows/ci.yml)

  • Added Chrome dependencies installation step for Ubuntu (14 system libraries)
  • Added "Run integration tests" step after unit tests
  • macOS runners don't need additional dependencies (already available)

Test Coverage

Integration tests now verify:

  • Real browser launch and connection
  • Browser instance singleton pattern
  • Viewport configuration
  • Page creation and navigation to real URLs
  • Browser lifecycle (close/reopen with new instance)
  • Multiple page management

Local Development

To run integration tests locally on Ubuntu/Debian:

sudo apt-get update
sudo apt-get install -y libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 \
  libcups2 libdrm2 libdbus-1-3 libxkbcommon0 libxcomposite1 libxdamage1 \
  libxfixes3 libxrandr2 libgbm1 libpango-1.0-0 libcairo2 libasound2

bun run test:integration

macOS users can run tests directly without additional setup.

Test Plan

  • Unit tests pass
  • Integration tests converted to real browser
  • CI workflow updated with Chrome dependencies
  • CI integration tests pass on Ubuntu
  • CI integration tests pass on macOS

- Replace mocked Puppeteer with real headless Chrome
- Add Chrome dependencies installation in CI (Ubuntu only)
- Add integration test step to CI workflow
- Test real browser launch, page navigation, and lifecycle
- Ensures actual Chrome/Puppeteer integration is verified

Closes integration test coverage gap by testing with real browser
instead of mocks, catching real-world browser interaction issues.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 8, 2025

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.

1 participant