Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing #1

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a0edf65
Installed testing libraries
erin-doyle Sep 6, 2020
f849801
Added a unit test of the Login Page for accessibility issues
erin-doyle Sep 6, 2020
6ec71aa
Added an end-to-end test of the Login Page using Selenium WebDriver i…
erin-doyle Sep 6, 2020
9464453
Added an end-to-end test of the Login Page using Cypress
erin-doyle Sep 6, 2020
10c9f91
Added a GitHub Action for CI of the testing branch
erin-doyle Sep 6, 2020
69a0e30
Fixed typos in ci.yml
erin-doyle Sep 6, 2020
9ef7da6
Added an npm script for opening the Cypress app
erin-doyle Sep 6, 2020
71462aa
Broke CI action into separate jobs for linting and running unit tests
erin-doyle Sep 6, 2020
275e2fb
Added a Lighthouse CI GitHub Action
erin-doyle Sep 6, 2020
857b70d
Correct Lighthouse GitHub Action
erin-doyle Sep 6, 2020
623bc4c
Switch Lighthouse workflow to use Google Chrome's instructions for LHCI
erin-doyle Sep 6, 2020
97700b9
Modified Lighthouse workflow and config
erin-doyle Sep 6, 2020
727cb8c
Updated startServerReadyPattern in Lighthouse config
erin-doyle Sep 6, 2020
9f95889
Specified the login url in the Lighthouse config
erin-doyle Sep 7, 2020
9a56465
Added the LHCI_GITHUB_APP_TOKEN env variable to the lighthouse.yml
erin-doyle Sep 7, 2020
a8c54e8
More modifications to lighthouse.yml
erin-doyle Sep 7, 2020
a7e9bed
Added upload target flag to lhci autorun command
erin-doyle Sep 7, 2020
ab71489
Added a .travis.yml file
erin-doyle Sep 7, 2020
cacef95
Added a Netlify .toml file with configuration for the a11y plugin
erin-doyle Sep 7, 2020
3ce5e4f
Corrected the checkPath in netlify.toml
erin-doyle Sep 7, 2020
73edb25
Change the checkPaths to the root
erin-doyle Sep 7, 2020
e82db79
Changing the checkPath to '/login'
erin-doyle Sep 7, 2020
f85fa94
Trying index.html as a checkPath again
erin-doyle Sep 7, 2020
adc361e
Changed checkPath to URL
erin-doyle Sep 7, 2020
24e3bc8
Changing homepage and checkPaths to point to netlify hosted app
erin-doyle Sep 7, 2020
4ddbd38
Added a publish directory to netlify.toml
erin-doyle Sep 7, 2020
806a787
Corrected the publish directory
erin-doyle Sep 7, 2020
d415fc9
Remove publish directory from netlify.toml
erin-doyle Sep 7, 2020
87848b8
Add pa11y-ci and updated .travis.yml to run it
erin-doyle Sep 7, 2020
b0989d0
Added a pa11y.yml github workflow
erin-doyle Sep 7, 2020
7232644
Updated the name of the pa11y workflow
erin-doyle Sep 7, 2020
2c35fd0
Update job name in Pa11y workflow
erin-doyle Sep 7, 2020
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
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI

on:
push:
branches: [ testing ]
pull_request:
branches: [ testing ]

jobs:
lint:
runs-on: ubuntu-latest
name: Run eslint
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '14.x'
- run: npm ci
- run: npm run lint

unit-test:
runs-on: ubuntu-latest
name: Run unit tests
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '14.x'
- run: npm ci
- run: npm run test-only
22 changes: 22 additions & 0 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Lighthouse

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

jobs:
lighthouse:
runs-on: ubuntu-latest
name: Audit with Lighthouse
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v1
- run: npm install && npm install -g @lhci/[email protected]
- run: npm run build
- run: lhci autorun --upload.target=temporary-public-storage
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/pa11y.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Pa11y

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

jobs:
pa11y:
runs-on: ubuntu-latest
name: Audit with Lighthouse
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v1
- run: npm ci
- run: npm run build
- run: npm run serve:prod & sleep 5
- run: npm run pa11y
8 changes: 8 additions & 0 deletions .pa11yci
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"urls": [
"http://localhost:5000/login"
],
"runners": [
"axe"
]
}
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: node_js
node_js:
- 14
script:
- npm run build
- npm run serve:prod & sleep 5; npm run pa11y;
1 change: 1 addition & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
8 changes: 8 additions & 0 deletions cypress/integration/Login.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
beforeEach(() => {
cy.visit('http://localhost:3000/login');
cy.injectAxe();
});

it('should not violate accessibility rules', () => {
cy.checkA11y();
});
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
}
25 changes: 25 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
22 changes: 22 additions & 0 deletions cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')

import 'cypress-axe';
17 changes: 17 additions & 0 deletions e2e/Login.e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const AxeBuilder = require('axe-webdriverjs');
const WebDriver = require('selenium-webdriver');

const driver = new WebDriver.Builder()
.forBrowser('chrome')
.build();

driver
.get('localhost:3000/login')
.then(function() {
AxeBuilder(driver).analyze(function(err, results) {
if (err) {
// Handle error somehow
}
console.log(results);
});
});
15 changes: 15 additions & 0 deletions lighthouserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"ci": {
"collect": {
"url": ["http://localhost:5000/login"],
"isSinglePageApplication": true,
"startServerReadyPattern": "Accepting",
"settings": {
"onlyCategories": ["accessibility"]
}
}
},
"upload": {
"target": "temporary-public-storage"
}
}
12 changes: 12 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[[plugins]]
package = "netlify-plugin-a11y"

[plugins.inputs]
checkPaths = [
'/index.html',
]

# # optional config
# ignoreDirectories = ['/admin'] # explicitly ignore these directories

# resultMode = "warn" # is "error" by default
Loading