• This repository has been archived on 21/Sep/2022
  • Stars
    star
    1,497
  • Rank 31,357 (Top 0.7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

💀💀💀[DEPRECATED] Use hermione

Gemini

npm Build Status Coverage Status Join the chat at https://gitter.im/gemini-testing/gemini Stories on waffle.io

Gemini is a utility for regression testing the visual appearance of web pages.

Gemini allows you to:

  • Work with different browsers:

    • Google Chrome (tested in latest version)
    • Mozilla Firefox (tested in latest version)
    • IE8+
    • Opera 12+
  • Test separate sections of a web page

  • Include the box-shadow and outline properties when calculating element position and size

  • Ignore some special case differences between images (rendering artifacts, text caret, etc.)

  • Gather CSS test coverage statistics

Gemini was created at Yandex and is especially useful to UI library developers.

Quick start

Installing

npm install -g gemini
npm install -g selenium-standalone
selenium-standalone install

Configuring

Put the .gemini.js file in the root of your project:

module.exports = {
    rootUrl: 'http://yandex.ru',
    gridUrl: 'http://127.0.0.1:4444/wd/hub',

    browsers: {
        chrome: {
            desiredCapabilities: {
                browserName: 'chrome'
            }
        }
    }
};

Writing tests

Write a test and put it in the gemini folder in the root of your project:

gemini.suite('yandex-search', (suite) => {
    suite.setUrl('/')
        .setCaptureElements('.home-logo')
        .capture('plain');
});

Saving reference images

You have written a new test and should save a reference image for it:

gemini update

Running tests

Start selenium-standalone in a separate tab before running the tests:

selenium-standalone start

Run gemini tests:

gemini test

Dependencies

Required software:

  1. WebDriver server implementation. There are several options:

    • Selenium Server — for testing in different browsers. Launch with the selenium-standalone start command (if you will get error like "No Java runtime present, requesting install." you should install Java Development Kit (JDK) for your OS.).

    • ChromeDriver — for testing in Google Chrome. Launch with the chromedriver --port=4444 --url-base=wd/hub command.

    • PhantomJS — launch with the phantomjs --webdriver=4444 command.

    • Cloud WebDriver services, such as SauceLabs or BrowserStack

  2. Compiler with support for C++11 ([email protected] or higher). This is a png-img requirement. Compiling on Windows machines requires the node-gyp prerequisites.

Installing

To install the utility, use the npm install command:

npm install -g gemini

Global installation is used for launching commands.

Configuring

Gemini is configured using a config file at the root of the project. Gemini can use one of the following files:

  • .gemini.conf.js
  • .gemini.conf.json
  • .gemini.conf.yml
  • .gemini.js
  • .gemini.json
  • .gemini.yml

Let's say we want to run our tests only in the locally installed PhantomJS.

In this case, the minimal configuration file will only need to have the root URL of your web app and the WebDriver capabilities of PhantomJS: For example,

rootUrl: http://yandex.com
browsers:
  PhantomJS:
    desiredCapabilities:
      browserName: phantomjs

Also, you need to run PhantomJS manually in WebDriver mode:

phantomjs --webdriver=4444

If you are using a remote WebDriver server, you can specify its URL with the gridUrl option:

rootUrl: http://yandex.com
gridUrl: http://selenium.example.com:4444/wd/hub

browsers:
  chrome:
    desiredCapabilities:
      browserName: chrome
      version: "45.0"

  firefox:
    desiredCapabilities:
      browserName: firefox
      version: "39.0"

You can also set up each browser to have its own node:

rootUrl: http://yandex.com

browsers:
  chrome:
    gridUrl: http://chrome-node.example.com:4444/wd/hub
    desiredCapabilities:
      browserName: chrome
      version: "45.0"

  firefox:
    gridUrl: http://firefox-node.example.com:4444/wd/hub
    desiredCapabilities:
      browserName: firefox
      version: "39.0"

Other configuration options

See the details of the config file structure and available options.

Writing tests

Each of the blocks that are being tested may be in one of the determined states. States are tested with the help of chains of step-by-step actions declared in a block's test suites.

For example, let's write a test for a search block at yandex.com:

gemini.suite('yandex-search', function(suite) {
    suite.setUrl('/')
        .setCaptureElements('.search2__input')
        .capture('plain')
        .capture('with text', function(actions, find) {
            actions.sendKeys(find('.search2__input .input__control'), 'hello gemini');
        });
});

We are creating a new test suite yandex-search, assuming that we will capture the .search2__input element from the root URL http://yandex.com. We know that the block has two states:

  • plain — right after the page is loaded
  • with text — with the hello gemini text inserted into .search2__input .input__control

States are executed one after another in the order in which they are defined, without the browser reloading in between.

See the details of test creation methods.

Using CLI

To complete the test creation procedure, you need to take reference shots using the following command:

gemini update [paths to test suites]

To launch a test (to compare the current state of a block with a reference shot), use the command:

gemini test [paths to test suites]

See the details of interaction with CLI and available options.

GUI

You can use the Gemini graphical user interface instead of the command line. It is located in the gemini-gui package and must be installed additionally:

npm install -g gemini-gui

GUI advantages:

  • Handy preview of reference shots

  • Clear real-time demonstration of the differences between a reference shot and the current state of a block

  • Easy to update reference shots

Plugins

Gemini can be extended with plugins. You can choose from the existing plugins or write your own. To use a plugin, install and enable it in your .gemini.yml:

system:
  plugins:
    some-awesome-plugin:
      plugin-option: value

HTML report

To see the difference between the current state of a block and a reference picture more clearly, use the HTML reporter - plugin for gemini. This plugin produces HTML report, which displays reference image, current image and differences between them, for each state in each browser. When all tests are completed, you will see a link to HTML report.

Programmatic API

To use Gemini in your scripts or build tools, you can use the experimental programmatic API.

Events

To learn more about all events in Gemini, see the events documentation.

More Repositories

1

testplane

Testplane (ex-hermione) browser test runner based on mocha and wdio
JavaScript
713
star
2

looks-same

Node.js library for comparing images
JavaScript
665
star
3

gemini-gui

GUI for gemini
JavaScript
69
star
4

html-reporter

Html reporter for Testplane (ex-hermione)
JavaScript
45
star
5

png-img

Lite libpng wrapper for node.js
JavaScript
29
star
6

ssh-tun

Establishes ssh tunnel for forwarding remote port to local one.
JavaScript
8
star
7

testplane-storybook

Storybook addon that makes it easy to write Testplane tests and speed up their execution time
TypeScript
6
star
8

testplane-passive-browsers

💀💀💀[DEPRECATED]💀💀💀 use option "passive" from [email protected] instead
JavaScript
4
star
9

testplane-retry-progressive

Testplane plugin to retry tests with error patterns
JavaScript
4
star
10

gemini-teamcity

Plugin for Gemini which enables reporting test results to TeamCity.
JavaScript
4
star
11

testplane-headless-chrome

Plugin for Testplane to run integration tests on downloaded headless Chromium.
JavaScript
4
star
12

testplane-safari-commands

Testplane plugin to add/wrap browser commands for iOS Safari
JavaScript
3
star
13

gemini-tunnel

DEPRECATED use https://github.com/gemini-testing/ssh-tunneler
JavaScript
3
star
14

hermione-allure-reporter

💀💀💀[DEPRECATED]💀💀💀 use this plugin instead –
JavaScript
3
star
15

stat-reporter

Testplane plugin which helps to collect test statistic by browsers
JavaScript
3
star
16

hermione-wdio-migrator

Testplane plugin to easily migrate from wdio@4 to wdio@7 without any changes
JavaScript
3
star
17

testplane-retry-command

Testplane plugin to retry commands at low level
JavaScript
3
star
18

create-testplane

A tool for fast and simple Testplane configuration
TypeScript
3
star
19

configparser

Parser for configurations
JavaScript
2
star
20

testplane-test-filter

Testplane plugin to filter tests specified in JSON-file.
JavaScript
2
star
21

gemini-core

[DEPRECATED] Utility which contains common modules for gemini and hermione.
JavaScript
2
star
22

json-reporter

Common json reporter for testplane and hermione
JavaScript
2
star
23

testplane-url-decorator

Tesplane plugin for url decorator
JavaScript
2
star
24

playwright-utils

Custom playwright utilities
TypeScript
2
star
25

plugins-loader

Plugins loader for gemini and hermione
JavaScript
1
star
26

vscode-testplane

Testplane Integration with VS Code
TypeScript
1
star
27

testplane-image-minifier

Testplane plugin for minification reference images
JavaScript
1
star
28

hermione-profiler

hermione profiler
JavaScript
1
star
29

testplane-oauth

Testplane plugin for authorization with OAuth
TypeScript
1
star
30

gemini-faildump

Plugin to collect information about test fails.
JavaScript
1
star
31

hermione-faildump

Testplane plugin to collect information about test fails
JavaScript
1
star
32

hermione-sauce-connect

JavaScript
1
star
33

hermione-tunnel

DEPRECATED use https://github.com/gemini-testing/ssh-tunneler
JavaScript
1
star
34

gemini-testing.github.io

https://gemini-testing.github.io
CSS
1
star
35

gemini-optipng

Plugin for Gemini which optimize reference images.
JavaScript
1
star
36

qemitter

EventEmitter, allowing to return promise from handlers
JavaScript
1
star
37

ssh-tunneler

Plugin for gemini and hermione to set up ssh tunnel while running tests
JavaScript
1
star
38

hermione-sequential-tests-run

Testplane plugin to run selected tests in sequence
JavaScript
1
star
39

testplane-retry-limiter

Testplane plugin to disable retries at runtime
JavaScript
1
star
40

hermione-teamcity-reporter

Testplane plugin to report results for TeamCity CI
JavaScript
1
star
41

hermione-hide-scrollbars

Plugin for hermione to hide scrollbars in browsers
JavaScript
1
star
42

console-notifier

Plugin for gemini and hermione to log some information to a console after tests finished
JavaScript
1
star