Gemini UI Screenshot Testing

7.5.2 · abandoned · verified Sun Apr 19

Gemini is a utility for regression testing the visual appearance of web pages, primarily interacting via a command-line interface and configuration files. It captures screenshots across various browsers to detect visual deviations from reference images, making it particularly useful for UI library developers. The package helps identify subtle rendering artifacts, text caret differences, and provides CSS test coverage statistics. The current stable version is 7.5.2, released in July 2019. The project appears to have a sporadic release cadence, with major version updates becoming infrequent, and the last code activity observed in March 2021. Its differentiators include granular control over capture elements and built-in image comparison tolerance for minor, expected visual variations.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates setting up Gemini with a configuration file, defining a test suite, capturing a specific UI element, and the basic CLI commands to run it.

/* .gemini.js (config file in project root) */
module.exports = {
  rootUrl: 'http://localhost:3000/', // Your application's base URL
  gridUrl: 'http://127.0.0.1:4444/wd/hub', // WebDriver URL (e.g., Selenium Standalone, ChromeDriver)
  browsers: {
    chrome: {
      desiredCapabilities: { browserName: 'chrome' }
    },
    firefox: {
      desiredCapabilities: { browserName: 'firefox' }
    }
  },
  // Define where test files are located
  sets: {
    desktop: {
      files: 'gemini/**/*.gemini.js',
      browsers: ['chrome', 'firefox']
    }
  },
  // Directory to save screenshots and diffs
  screenshotsDir: 'gemini/screens'
};

/* gemini/my-component.gemini.js (test file) */
gemini.suite('MyComponent', (suite) => {
  suite.setUrl('/my-component') // Navigate to a specific path relative to rootUrl
    .setCaptureElements('.my-component-selector') // Define element(s) to capture
    .capture('initial-state', { // Capture a state for comparison
      tolerance: 2.5 // Allow some pixel difference
    });
});

// To run:
// 1. Install gemini and selenium-standalone globally: npm install -g gemini selenium-standalone
// 2. Install browser drivers: selenium-standalone install
// 3. Start Selenium Server: selenium-standalone start
// 4. Update reference images (first run): gemini update
// 5. Run tests: gemini test

view raw JSON →