Code Monkey home page Code Monkey logo

cypress-attest's Introduction

Cypress-attest

Cypress-attest is an integration of Worldspace Attest for the Cypress testing tool.

This project would not be possible without the crew that made cypress-axe. Huge thanks to them for guiding the way. Cypress-attest is a clone/fork, but replaces the axe-core tool with Worldspace Attest.

Requirements

  • Worldspace Attest (attest-node & attest-reporter)
  • Cypress

Installation

npm install -D https://github.com/joshuamcclure/cypress-attest

yarn add -D https://github.com/joshuamcclure/cypress-attest

Include the tasks

Update Cypress/plugins/index.js file to include the cypress-attest tasks by adding:

const {logResults} = require('cypress-attest/tasks');

module.exports = (on, config) => {
    on('task', {logResults})
}

Include the commands

Update Cypress/support/index.js file to include the cypress-attest commands by adding:

import 'cypress-attest'

Usage

cy.injectAttest

Inject the Attest package into the page under test.

before( function () {
    cy.injectAttest();
});

cy.checkA11y

Run the Attest tool and build a report with the results

it('Does a thing', function () {
    cy.checkA11y();
});

This function accepts arguments for the reporter, scope/context, and run options.

cy.checkA11y(
    {
        reportName: 'Login Page', //name of the report
        scopeName: 'Form', //name of the scope
        directory: 'cyAccessibilityReports', //folder to save reports to, default: cy-a11y-results
    },
    'form#login-form' //the selector for the scope you want to test.    
)

You can also skip the reporting output entirely by providing false in place of the reporting options object.

cy.checkA11y(
    false,
    'form#login-form' //the selector for the scope you want to test.
)

Report Output

The report output is stored on the root of your project directory. The default directory name is cy-a11y-results, but this can be changed using the reporter options outlined above.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.