diff --git a/cypress-accessibility-checker/README.md b/cypress-accessibility-checker/README.md
index 41104b7fd..89c4ea205 100644
--- a/cypress-accessibility-checker/README.md
+++ b/cypress-accessibility-checker/README.md
@@ -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
@@ -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.
diff --git a/cypress-accessibility-checker/boilerplates/cypress.config.js b/cypress-accessibility-checker/boilerplates/cypress.config.js
index 5808d2736..e7ec3537c 100644
--- a/cypress-accessibility-checker/boilerplates/cypress.config.js
+++ b/cypress-accessibility-checker/boilerplates/cypress.config.js
@@ -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
- },
+ }
})
diff --git a/cypress-accessibility-checker/boilerplates/cypress/plugins/index.js b/cypress-accessibility-checker/boilerplates/cypress/plugins/index.js
deleted file mode 100644
index 847dfb0bd..000000000
--- a/cypress-accessibility-checker/boilerplates/cypress/plugins/index.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/******************************************************************************
- Copyright:: 2020- IBM, Inc
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- *****************************************************************************/
-
-///
-// ***********************************************************
-// This example plugins/index.js can be used to load plugins
-//
-// You can change the location of this file or turn off loading
-// the plugins file with the 'pluginsFile' configuration option.
-//
-// You can read more here:
-// https://on.cypress.io/plugins-guide
-// ***********************************************************
-
-// This function is called when a project is opened or re-opened (e.g. due to
-// the project's config changing)
-
-const accessibilityCheckerTasks = require('cypress-accessibility-checker/plugin');
-module.exports = (on /*, config*/) => {
- on('task', {
- accessibilityChecker: accessibilityCheckerTasks
- });
-};
diff --git a/cypress-accessibility-checker/test/cypress.config.js b/cypress-accessibility-checker/test/cypress.config.js
index bc3a7df76..71089dc2d 100644
--- a/cypress-accessibility-checker/test/cypress.config.js
+++ b/cypress-accessibility-checker/test/cypress.config.js
@@ -5,7 +5,9 @@ module.exports = defineConfig({
// 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('../plugin')
+ });
},
baseUrl: 'http://localhost:8080/test/sample-html',
},
diff --git a/cypress-accessibility-checker/test/cypress/plugins/index.js b/cypress-accessibility-checker/test/cypress/plugins/index.js
deleted file mode 100644
index b9b9b2262..000000000
--- a/cypress-accessibility-checker/test/cypress/plugins/index.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/******************************************************************************
- Copyright:: 2020- IBM, Inc
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- *****************************************************************************/
-
-///
-// ***********************************************************
-// This example plugins/index.js can be used to load plugins
-//
-// You can change the location of this file or turn off loading
-// the plugins file with the 'pluginsFile' configuration option.
-//
-// You can read more here:
-// https://on.cypress.io/plugins-guide
-// ***********************************************************
-
-// This function is called when a project is opened or re-opened (e.g. due to
-// the project's config changing)
-
-const accessibilityCheckerTasks = require('../../../plugin');
-module.exports = (on /*, config*/) => {
- console.log("LOADING PLUGINS");
- on('task', {
- accessibilityChecker: accessibilityCheckerTasks
- });
-};