Skip to content

basset/cypress-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cypress-plugin

Cypress plugin for sending snapshots to basset

Install from npm

npm install @getbasset/cypress-plugin

Using with cypress

  1. Add the following to support/index.js:

    the task submitBassetBuild will submit all the snapshots after the build has been completed.

    require('@getbasset/cypress-plugin/lib/commands');
    
    after(() => {
      cy.task('submitBassetBuild');
    });
  2. Add the require('@getbasset/cypress-plugin')(module); to plugins/index.js, the default file should look like this:

    module.exports = (on, config) => {
      // `on` is used to hook into various events Cypress emits
      // `config` is the resolved Cypress config
    }
    
    require('@getbasset/cypress-plugin')(module);
  3. To take a snapshot within a test use this command:

    each property in options is optional

     const options ={
       widths: '720,1280',
       hideSelectors: '.hide-me',
       selectors: '.css-selector',
       browsers: 'firefox,chrome'
     }
     cy.snapshot('title', options);
     //or
     cy.snapshot('title');
  4. Run cypress with the following environmental variables:

    BASSET_URL = 'url_to_basset' BASSET_TOKEN = 'projectToken' BASSET_ASSETS = '' npx cypress open

    You can also set BASSET_TMP_DIR to the directory you want to store snapshots until the build is completed

About

cypress plugin for using basset

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors