All Projects → Crunch-io → nightwatch-vrt

Crunch-io / nightwatch-vrt

Licence: MIT license
Visual Regression Testing tools for nightwatch.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to nightwatch-vrt

nightwatch-boilerplate
boilerplate for nightwatch.js with selenium
Stars: ✭ 16 (-72.88%)
Mutual labels:  e2e-tests, nightwatch
Nightwatch
End-to-end testing framework written in Node.js and using the Webdriver API
Stars: ✭ 10,912 (+18394.92%)
Mutual labels:  nightwatch, nightwatchjs
html-dnd
HTML Drag and Drop Simulator for E2E testing
Stars: ✭ 53 (-10.17%)
Mutual labels:  selenium-webdriver, nightwatch
Codeceptjs
Supercharged End 2 End Testing Framework for NodeJS
Stars: ✭ 3,592 (+5988.14%)
Mutual labels:  e2e-tests, selenium-webdriver
E2e Experiment
A demo project with Spring Boot / Angular application and e2e tests
Stars: ✭ 9 (-84.75%)
Mutual labels:  e2e-tests, selenium-webdriver
vrt-react
Take a screenshot 📸 of React component. Push it and compare images in pull request.
Stars: ✭ 19 (-67.8%)
Mutual labels:  screenshot, visual-regression-testing
jest-puppe-shots
A Jest plugin for creating screenshots of React components with a little help of Puppeteer
Stars: ✭ 86 (+45.76%)
Mutual labels:  screenshot, visual-regression
Protractor Pretty Html Reporter
A jasmine reporter that produces an easy to use html report to analyze protractor test results.
Stars: ✭ 9 (-84.75%)
Mutual labels:  screenshot, e2e-tests
QVisual
Tinkoff tool to control quality by visual testing
Stars: ✭ 47 (-20.34%)
Mutual labels:  selenium-webdriver
ToRat client
This is the ToRat client, a part of the ToRat Project.
Stars: ✭ 29 (-50.85%)
Mutual labels:  screenshot
yaf
Yet another system fetch that is minimal and customizable
Stars: ✭ 23 (-61.02%)
Mutual labels:  screenshot
nougat
Screenshot wrapper
Stars: ✭ 20 (-66.1%)
Mutual labels:  screenshot
testcafe-snippets
Code snippets for TestCafe
Stars: ✭ 54 (-8.47%)
Mutual labels:  e2e-tests
ModernSimpleProfileUI
Design a Modern Simple Profile UI with Constraint Layout in Android Studio 3.1 Canary 6
Stars: ✭ 24 (-59.32%)
Mutual labels:  screenshot
LAN-Messenger
Official open-source repository for LAN Messenger
Stars: ✭ 17 (-71.19%)
Mutual labels:  screenshot
dotfiles
My setup
Stars: ✭ 84 (+42.37%)
Mutual labels:  screenshot
puppet-master
Puppeteer as a service hosted on Saasify.
Stars: ✭ 25 (-57.63%)
Mutual labels:  screenshot
android-capture
Capture video and screenshots from Android devices and emulators.
Stars: ✭ 32 (-45.76%)
Mutual labels:  screenshot
Switch-Screenshots
Script to organize Nintendo Switch screenshots by directory instead of date.
Stars: ✭ 50 (-15.25%)
Mutual labels:  screenshot
shale
A Clojure-backed replacement for Selenium hubs.
Stars: ✭ 14 (-76.27%)
Mutual labels:  selenium-webdriver

Build Status NPM Version

Nightwatch VRT

Nightwatch Visual Regression Testing tools for nightwatch.js

Description

Nightwatch VRT extends nightwatch.js with an assertion that captures a screenshot of a DOM element identified by a selector and compares the screenshot against a baseline screenshot. If the baseline screenshot does not exist, it will be created the first time you run the test and the assertion will pass.

Configuration

Include the following sections in the nightwatch configuration file

Custom commands and assertions

Register nightwatch-vrt's assertion and commands:

    custom_commands_path: [
        'node_modules/nightwatch-vrt/commands'
    ],
    custom_assertions_path: [
        'node_modules/nightwatch-vrt/assertions'
    ]

Nightwatch VRT custom settings

Then, for global settings, add the visual_regression_settings entry to nightwatch's globals globals section

default: {
    "globals": {
        "visual_regression_settings": {
            "generate_screenshot_path": defaultScreenshotPathGenerator,
            "latest_screenshots_path": "vrt/latest",
            "latest_suffix": "",
            "baseline_screenshots_path": "vrt/baseline",
            "baseline_suffix": "",
            "diff_screenshots_path": "vrt/diff",
            "diff_suffix": "",
            "threshold": 0,
            "prompt": false,
            "always_save_diff_screenshot": false
        }
    }
}
Property Description Defaults
generate_screenshot_path Passed function that will generate a screenshot path none
latest_screenshots_path Path to the most recently captured screenshots "vrt/latest"
latest_suffix A string appended to the end of the latest captured screenshot* ""
baseline_screenshots_path Path to the baseline expected screenshots "vrt/baseline"
baseline_suffix A string appended to the end of the baseline screenshot* ""
diff_screenshots_path Path to the diff image of the two screenshots "vrt/diff"
diff_suffix A string appended to the end of the diff image* ""
threshold Matching threshold, ranges from 0 to 1. Smaller values make the comparison more sensitive. 0.0
prompt If true, the user will be prompted to override baseline screenshot when the recently captured screenshot differs false
always_save_diff_screenshot If true, recently captured screenshots will always override the baseline false
* Only necessary if screenshots are set to reside in the same directory

Nightwatch VRT screenshot path generator

The screenshot path generator option accepts a function that generates a dynamic path based on the test properties, and returns that string.

Parameter Description
nightwatchClient The nightwatch client test instance
basePath The base path for the screenshot set in visual_regression_settings (e.g. *_screenshots_path)
fileName The file name; either the selector used or the custom name given for the test
returns A string which contains the full path - minus the file extension

For example:

function generateScreenshotFilePath(nightwatchClient, basePath, fileName) {
    const moduleName = nightwatchClient.currentTest.module,
        testName = nightwatchClient.currentTest.name

    return path.join(process.cwd(), basePath, moduleName, testName, fileName)
}

Usage

In order to use nightwatch-vrt, you only need to invoke the screenshotIdenticalToBaseline assertion and pass a css selector for the DOM element to compare. You may also pass a custom filename, visual_regression_settings overrides, and a custom log message.

Parameter Description
selector Identifies the element that will be captured in the screenshot.
fileName Optional file name for this screenshot; defaults to the selector
settings Optional settings to override the defaults and visual_regression_settings
message Optional message for nightwatch to log upon completion
module.exports = {
    'Test crunch.io main content is correct': (browser) => {
        browser
            .url('https://crunch.io')
            .assert.screenshotIdenticalToBaseline('.body.entry-content',  /* Optional */ 'custom-name', {threshold: 0.5}, 'VRT custom-name complete.')
            .end()
    }
}

The first time a test is run, a baseline screenshot will be created and stored on disk. You should always register the baseline screenshot in the code repository. Further executions of this test will compare against this baseline.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].