Skip to content

Commit

Permalink
Merge pull request #1693 from IBMa/issue-1600
Browse files Browse the repository at this point in the history
chore(cypress): Update README and add support for Cypress 13
  • Loading branch information
ErickRenteria authored Sep 27, 2023
2 parents 5afdd61 + d2a6001 commit 581881c
Show file tree
Hide file tree
Showing 11 changed files with 201 additions and 4,325 deletions.
25 changes: 16 additions & 9 deletions cypress-accessibility-checker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The plugin works by injecting the automated accessibility-checker testing into [
## Requirements

* [Node Version 18](https://nodejs.org/en/download/)
* Cypress 12
* Cypress 13

## Installation

Expand All @@ -27,25 +27,32 @@ There are two setup steps you must complete in order for the Cypress tests to be

### 1. Add plugin

In the `cypress/plugins/index.js` file located in your project, require the plugin and then register it with Cypress.
In the Cypress config for your project, require the plugin and then register it with Cypress.

```js
const aCheckerTasks = require('cypress-accessibility-checker/plugin');
module.exports = (on, config) => {
on('task', {
accessibilityChecker: aCheckerTasks
});
};
const { defineConfig } = require('cypress')

module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
on('task', {
accessibilityChecker: require('cypress-accessibility-checker/plugin')
});
}
}
})
```

### 2. Import commands

In the `cypress/support/index.js` file located in your project, add the following import statement. This will import the accessibility checker commands and register them with Cypress.
In the `cypress/support/e2e.js` file located in your project, add the following import statement. This will import the accessibility checker commands and register them with Cypress.

```js
import 'cypress-accessibility-checker';
```

If you do not want to include `cypress-accessibility-checker` globally, you may instead add this import statement to every test file in which it is used.

## Usage

The commands maps directly to the description of the APIs located [in the accessibility-checker/src/README](https://github.com/IBMa/equal-access/blob/master/accessibility-checker/src/README.md). The names of the APIs within Cypress are just slightly different so they are globally unique in the Cypress namespace.
Expand Down
8 changes: 4 additions & 4 deletions cypress-accessibility-checker/boilerplates/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ const { defineConfig } = require('cypress')

module.exports = defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
on('task', {
accessibilityChecker: require('cypress-accessibility-checker/plugin')
});
},
baseUrl: 'http://localhost:8080/sample-html',
supportFile: false
},
}
})

This file was deleted.

Loading

0 comments on commit 581881c

Please sign in to comment.