Skip to content
This repository has been archived by the owner on Nov 27, 2020. It is now read-only.

WIP: Add integration tests with Cypress and integrate the a11y tracker #150

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
'plugin:import/recommended',
'plugin:security/recommended',
],
plugins: ['jest', 'security'],
plugins: ['jest', 'cypress', 'security'],
env: {
'jest/globals': true,
},
Expand All @@ -22,6 +22,11 @@ module.exports = {
settings: {
"import/resolver": "webpack",
},
},

{
files: ["config/cypress.support.js", "routes/*/integration.js"],
env: { "cypress/globals": true },
}
],
}
11 changes: 0 additions & 11 deletions .github/workflows/a11y.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
npm test
env:
CI: true
A11Y_TRACKER_KEY: ${{ secrets.A11Y_TRACKER_KEY }}
A11Y_TRACKER_URL: http://
- name: npm lint
run: |
npm run lint
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ typings/
.pem

# Compiled CSS and files
public/dist
/public

.DS_Store
credentials
cdk.out
cdk.out

cdk/local-image
credentials
credentials
1 change: 0 additions & 1 deletion a11y.json

This file was deleted.

21 changes: 21 additions & 0 deletions config/cypress.support.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { A11yReporter } from './../../a11y-tracker-client'

const nodeEnv = Cypress.env('NODE_ENV') || 'development'

// default to not reporting
A11yReporter.configure({
trackerURI: undefined,
revision: '<local>',
project: 'node-starter-app',
})

// if we're in CI and on the master branch, do the actual reporting
if (Cypress.env['CI'] && Cypress.env['GITHUB_REF'] === 'refs/heads/master') {
A11yReporter.configure({
tracker: 'https://a11y-tracker.digital.canada.ca',
revision: Cypress.env('GITHUB_GIT_HASH'),
key: Cypress.env('A11Y_TRACKER_KEY')
})
}

A11yReporter.setupCypress()
8 changes: 8 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"baseUrl": "http://localhost:3000",
"integrationFolder": "routes/",
"fixturesFolder": "config/fixtures",
"pluginsFolder": "config/cypress/plugins",
"testFiles": ["*/integration.js"],
"supportFile": "config/cypress.support.js"
}
21 changes: 21 additions & 0 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/// <reference types="cypress" />
// ***********************************************************
// 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)

/**
* @type {Cypress.PluginConfig}
*/
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}
2 changes: 1 addition & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@
"addresses.remove": "[- remove]",
"addresses.add-another": "[+ add another]",
"errors.address.length": "Please fill in an address"
}
}
2 changes: 1 addition & 1 deletion locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@
"wordmark.alt": "Symbol of the Government of Canada",
"Government of Canada": "Government of Canada",
"required": "required"
}
}
Loading