browser-UI-test is a JavaScript framework designed for headless browser-based UI testing, primarily focused on visual regression. It allows developers to define UI test scenarios using simple `.goml` script files, which are then executed in a headless browser environment, typically leveraging Puppeteer. After script execution, the framework takes a screenshot of the page and compares it against an expected baseline image, failing the test if differences are detected. The package is currently at version 0.23.3, and its development seems active, with Docker images being pushed on merges to the main branch. This tool differentiates itself by its `.goml` script-based, declarative approach to UI interactions and its integrated screenshot comparison functionality, aiming for ease of use for quick UI checks rather than complex end-to-end testing suites like Playwright or Cypress.
npm install browser-ui-testVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create a basic `.goml` script for UI interactions and then programmatically execute it using the `runTest` function in a Node.js environment. It includes setup for screenshot comparison and error handling.
Consider using the `--show-text` option only when necessary, or ensure your CI/CD environment has consistent font rendering settings if testing visible text. Otherwise, rely on the default behavior that hides text for comparisons.
Always use absolute paths for Docker volume mounts, e.g., `-v "$PWD:/data"` and prefixing internal paths with `/data` (or your chosen mount point) for `--test-folder`, `--failure-folder`, etc.
Refer to the official documentation's 'Command list' for `.goml` script syntax and available commands. Start with simple scripts and gradually introduce more complex interactions.
Try installing Puppeteer specifically with `npm install puppeteer --unsafe-perm=true` if you encounter persistent installation failures, especially in CI environments or systems with strict permissions. Ensure you have necessary build tools installed for Chromium.