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

MCR-3080: bring back a11y tests in ci #2715

Merged
merged 29 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
10fe077
ADd and implement cypress-axe
JasonLin0991 Aug 28, 2024
36ceb71
Add accessibility commands
JasonLin0991 Aug 29, 2024
ca34107
Fix launch darkly intercepts for local deployment.
JasonLin0991 Aug 29, 2024
41333e9
Add two accessibility tests.
JasonLin0991 Aug 29, 2024
1014ee0
Reverting bad merge
JasonLin0991 Aug 29, 2024
eebe3cc
ADd and implement cypress-axe
JasonLin0991 Aug 28, 2024
3f9a1e2
Add accessibility commands
JasonLin0991 Aug 29, 2024
64f664f
Fix launch darkly intercepts for local deployment.
JasonLin0991 Aug 29, 2024
2167a6c
Add two accessibility tests.
JasonLin0991 Aug 29, 2024
0bc8e79
Reverting bad merge
JasonLin0991 Aug 29, 2024
ce879d7
Merge remote-tracking branch 'origin/jl-mcr-3080-bring-back-a11y-test…
JasonLin0991 Aug 29, 2024
7861efd
lock file
JasonLin0991 Aug 29, 2024
cfae62b
Reverting bad merge again
JasonLin0991 Aug 29, 2024
e2e2df3
Merge remote-tracking branch 'origin/jl-mcr-3080-bring-back-a11y-test…
JasonLin0991 Aug 29, 2024
585d269
Fix lock file.
JasonLin0991 Aug 29, 2024
f6ff9a9
Fix lock file.
JasonLin0991 Aug 29, 2024
58fdd78
Remove pa11y.
JasonLin0991 Aug 29, 2024
14c2fe6
Add axe-core and cypress-axe to root package.json
JasonLin0991 Aug 29, 2024
edd8960
Cleanup
JasonLin0991 Aug 29, 2024
833c0ae
Use WCAG 2.2 Level AA
JasonLin0991 Aug 29, 2024
e60db8f
Lock file
JasonLin0991 Aug 29, 2024
144ae5f
Merge branch 'main' into jl-mcr-3080-bring-back-a11y-tests-in-ci
JasonLin0991 Aug 29, 2024
3402246
Add documentation
JasonLin0991 Aug 29, 2024
09dea90
Rename tests
JasonLin0991 Aug 29, 2024
75a1d3a
Merge branch 'main' into jl-mcr-3080-bring-back-a11y-tests-in-ci
JasonLin0991 Aug 30, 2024
6fe5157
Update ADR
JasonLin0991 Aug 30, 2024
ea421f5
Replace depreciated command
JasonLin0991 Aug 30, 2024
eb4b34d
Skipping violations and made tickets to address them.
JasonLin0991 Aug 30, 2024
321d164
Update doc
JasonLin0991 Aug 30, 2024
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
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
"devDependencies": {
"c8": "^10.1.2",
"cypress": "^13.13.2",
"axe-core": "^4.10.0",
"cypress-axe": "^1.5.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mojotalantikite I added these two dependencies here too. Correct me if things changed but, I did this because Cypress in CI runs from root and on local is runs from services/cypress without this here CI could not find the dependencies. A lot has changed since so is there a better, but simple, way to not have to install in both places?

I could do some configuration in each test to point to the location of the install based on deployment, but if installing the deps in both doesn't cost or complicate much would this be ok?

Copy link
Contributor

@haworku haworku Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mojotalantikite @JasonLin0991 imo this is also a good time to consider if cypress should be moved considering the new world we are. Throwing it out there, not trying to suggest moving the entire folder is needed ...just want us to think expansively since we are also doing a lot around modularizing and simplifying our top level architecture right now so maybe we are seeing another opportunity here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is totally fine. I personally think it's clearer to declare the dependencies in each service's package.json that needs them. Back with Yarn 1 everything got hoisted and when we moved to pnpm it started complaining about missing packages, as it was easy to just ignore the dependency if it was already installed elsewhere with Yarn.

Plus with pnpm everything is symlinked around, so it's not actually going to install it in two places, it's just going to throw in a symlink from the global package store to each service's node_modules that declares it.

"danger": "^11.2.6",
"husky": "^9.1.5",
"lint-staged": "^15.2.7",
Expand Down
99 changes: 39 additions & 60 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions services/cypress/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const { defineConfig } = require('cypress')
const { gql } = require('@apollo/client')
const { pa11y, prepareAudit } = require('@cypress-audit/pa11y')
const fs = require('fs')
const path = require('path')
const createBundler = require('@bahmutov/cypress-esbuild-preprocessor')
Expand Down Expand Up @@ -49,20 +48,26 @@ module.exports = defineConfig({
process.env.COGNITO_IDENTITY_POOL_ID
newConfig.env.COGNITO_USER_POOL_WEB_CLIENT_ID =
process.env.COGNITO_USER_POOL_WEB_CLIENT_ID
on('before:browser:launch', (browser, launchOptions) => {
prepareAudit(launchOptions)
})

// Reads graphql schema and converts it to gql for apollo client.
on('task', {
pa11y: pa11y(),
readGraphQLSchema() {
const gqlSchema = fs.readFileSync(
path.resolve(__dirname, './gen/schema.graphql'),
'utf-8'
)
return gql(`${gqlSchema}`)
},
log(message) {
console.log(message)

return null
},
table(message) {
console.table(message)

return null
}
})
return newConfig
},
Expand Down
Loading
Loading