Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bracco

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bracco

Simple runner based on backstopJs for Visual Regression Test

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

BRACCO

Bracco is a simple runner of BackstopJS for visual regression testing.

You can easly split, manage and run your scenarios

Methods

init(conf[Object])

Initialize the runner.

Arguments: the conf object used in your scenario

conf[Object]

{
    testhost: "https://www.amazon.it/",
    refhost: "https://www.amazon.co.uk/",
    delay: 1000,
    misMatchThreshold: 10    
}

reference(options[Object], test[Boolean])

Reference task of backstopJS.

options[Object]

    {
        scenario: string,
        tags: [array]
    }

The second argument test is a bool flag if you want run test task after the reference task is finished.

test(options[Object])

Test task of backstopJS.

options[Object]

    {
        scenario: string,
        tags: [array]
    }

Files structure

Create in the root of your project a folder named scenarios and create subfolder for each group of scenario.

Example:

casper_sripts
│   onBefore.js
│   onReady.js
│
└───footer
│   │   onBefore.js
│   │   onReady.js
│
scenarios
│
└───header
│   │   headerAll.js
│   │   headerMenu.js
│   │   headerSearch.js
│   │   ...
│   
└───footer
    │   footerAll.js
    │   footerSocial.js
    │   ...

Basic Usage

index.js

const bracco = require('bracco');

bracco.init({
    testhost: "https://www.amazon.it/",
    refhost: "https://www.amazon.co.uk/"
});

bracco.reference({
    scenario: 'footer'
});

bracco.test({
    scenario: 'footer'
});

scenarios/footer/footerAll.js

module.exports = 
    (conf) => {
        return [{
            "label": "FooterAll",
            "tags": ["common"],
            "referenceUrl": conf.refhost,
            "url": conf.testhost,
            "removeSelectors": [
                '#main'
            ],
            "selectors": [
                "#siteFooter"
            ],
            "onBeforeScript": "footer/onBefore.js",
            "onReadyScript": "footer/onReady.js"
        }]
    };

casper_scripts/footer/onReady.js

module.exports = function (casper, scenario, vp) {
  
    casper.waitForSelector('footer', function() {
      this.scrollToBottom();
    });

  console.log('onReady.js has run for: ', vp.name);
};

FAQs

Package last updated on 16 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc