Skip to content

Commit

Permalink
Migrating cypress to v10 (#130)
Browse files Browse the repository at this point in the history
* Migrating cypress to v10

This is a breaking change for v10

* Update README with correct file name

* Updating v10 and v9 specific instructions.

* Updating installation instructions for cypress-axe

* Dropping nodejs v10 and adding v16 to workflow.
  • Loading branch information
srikanthkyatham authored Jun 16, 2022
1 parent 8d47177 commit 9e770d9
Show file tree
Hide file tree
Showing 8 changed files with 5,054 additions and 229 deletions.
23 changes: 11 additions & 12 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,24 @@ name: Node.js CI

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
node-version: [12.x, 14.x, 16.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,36 @@ Test accessibility with [axe-core](https://github.com/dequelabs/axe-core) in [Cy

1. **Install `cypress-axe` from npm:**

- For Cypress v10 install latest cypress-axe

```sh
npm install --save-dev cypress-axe
```

2. **Install peer dependencies:**
- For Cypress v9 install 0.x.x

```sh
npm install --save-dev [email protected]
```

1. **Install peer dependencies:**

- For Cypress v10 and above

```sh
npm install --save-dev cypress axe-core
```

3. **Include the commands.** Update `cypress/support/index.js` file to include the cypress-axe commands by adding:
- For Cypress v9 and below install the specific cypress version you are using For example if you are using cypress v9.6.0

```sh
npm install --save-dev [email protected] axe-core
```

1. **Include the commands.**

- For Cypress v10 and above update `cypress/support/e2e.js` file to include the cypress-axe commands by adding:
- For Cypress v9 and below update `cypress/support/index.js` file to include the cypress-axe commands by adding:

```js
import 'cypress-axe'
Expand Down Expand Up @@ -156,10 +175,8 @@ it('Has no a11y violations after button click', () => {

it('Only logs a11y violations while allowing the test to pass', () => {
// Do not fail the test when there are accessibility failures
cy.checkA11y(null, null, null, true);
cy.checkA11y(null, null, null, true)
})


```

#### Using the violationCallback argument
Expand Down
9 changes: 9 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint @typescript-eslint/no-var-requires: "off" */
const { defineConfig } = require('cypress');

module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:8080',
video: false,
},
});
4 changes: 0 additions & 4 deletions cypress.json

This file was deleted.

File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 9e770d9

Please sign in to comment.