-
Notifications
You must be signed in to change notification settings - Fork 38
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
Component accessibility testing #1352
Merged
Merged
Changes from all commits
Commits
Show all changes
82 commits
Select commit
Hold shift + click to select a range
f0e0757
playwright ct & axebuilder install
xman343 60a5b51
fixed axebuilder install & started component test
xman343 856cd25
first pass at component spec tsx
xman343 8c74b62
workspace created
xman343 f1809b8
dependencies installed
xman343 fb95042
Merge branch 'dev'
xman343 f918533
fix component testing setup
mayank99 d44b57c
package cleanup
xman343 4cd6ddb
fixed yarn lock
xman343 9364985
test run error: failed to resolve entry
xman343 534be82
fixed package.json
xman343 6c3b1d1
yarn lock fix
xman343 47239aa
updated itwinui-react v in packages.json
xman343 f687ebe
testing a11y folders set-up
xman343 0c10e39
automated test file created
xman343 61ddbe0
Merge branch 'dev' of https://github.com/iTwin/iTwinUI into xander/co…
xman343 ff57ce8
yarn update to fix imports
xman343 b559c0f
renamed to a11y in yarn.lock turbo json
xman343 9bab9c7
still getting Carousel export error
xman343 24bffe2
uninstalled playwright from a11y
xman343 9f283d1
installed cypress into a11y
xman343 6efd792
cypress spec created
xman343 a2868ed
further cy changes
xman343 fa608e9
removed axe-core from a11y package.json
xman343 12d6360
moved itwinui-react dep to devDeps in a11y json
xman343 2da4b98
reverted changes to package.json
xman343 3e60a3f
base component test & attempt at css import
xman343 8af216d
css imports removed
xman343 96146e8
component-index.html css import attempt
xman343 c344363
Merge branch 'dev' of https://github.com/iTwin/iTwinUI into xander/co…
xman343 edb271d
testing node_modules refresh
xman343 76126ca
added imports to package.json
xman343 3eae1e2
updated gitignore
xman343 fe06a05
gitignore update 2
xman343 29aace4
Delete testing/a11y/.next directory
xman343 6465069
unneeded .next deleted
xman343 1151d6a
Merge branch 'xander/component-accessibility-testing' of https://gith…
xman343 c44d8a2
css import component.js edit
xman343 fed5ab0
cleaned up component-index.html and package.json
xman343 80ae22d
deleted vestigial test
xman343 bf8a313
Merge branch 'dev' of https://github.com/iTwin/iTwinUI into xander/co…
xman343 a349911
changed test filenames to reflect import origins
xman343 a95599e
css import fix
xman343 b8e0d70
css font fix
xman343 aa85bc3
cypress axe installation
xman343 82ea824
axe a11y tests added
xman343 65a17bd
redundant spec deleted
xman343 c4bf7b5
Merge branch 'dev' of https://github.com/iTwin/iTwinUI into xander/co…
xman343 b68a38f
examples compiled tsx to js - still exports tsx
xman343 2574071
examples refactoring and js compile fixes
xman343 82b04bb
Merge branch 'dev' of https://github.com/iTwin/iTwinUI into xander/co…
xman343 cb7d0a2
refactoring and package.json tsx restore
xman343 132a6ea
gave js examples own folder for easier export
xman343 a962813
js examples now work in cy tests
xman343 682e137
Merge branch 'dev' of https://github.com/iTwin/iTwinUI into xander/co…
xman343 663b359
non-component a11y violations ignored
xman343 8c8bb09
Created tests for all Alert examples
xman343 1d0b0ff
removed itwinuireact tests
xman343 e3f3af7
anchor & avatar tests
xman343 a2c0e9b
Merge branch 'dev' into xander/component-accessibility-testing
xman343 1938c72
Badge, Breadcrumbs, Button tests
xman343 7473ebe
deleted root cypress files
xman343 fcfb437
removed examples-js
xman343 04f4342
config fixes
xman343 48170c2
fixed index.html and component.js
xman343 a787c6e
updated examples package.json
xman343 a509bf7
more package.json fixes
xman343 14dfd8e
redoing cypress testing
xman343 20db291
all component test set up
xman343 48cd7d4
yarn lock
xman343 b7a2a5c
theme provider added
xman343 4141b82
Merge branch 'dev' into xander/component-accessibility-testing
xman343 ac7243e
cleanup
xman343 57e0762
added a11y test to build
xman343 39fa0fa
updated cypress
xman343 20b6de5
Merge branch 'dev' into xander/component-accessibility-testing
xman343 8ad20a0
changed build
xman343 e66fbca
build attempt 3
xman343 249e163
typo fix
xman343 1b12be3
component true
xman343 3930649
concise table
xman343 61ec359
update breadcrumbs test image
mayank99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-981 Bytes
(91%)
.../storybook/cypress-visual-screenshots/baseline/Breadcrumbs.test.ts-Overflow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,8 @@ | |
"packages/*", | ||
"playgrounds/*", | ||
"internal/*", | ||
"examples" | ||
"examples", | ||
"testing/*" | ||
] | ||
}, | ||
"lint-staged": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules/ | ||
/test-results/ | ||
.next/ | ||
cypress/videos | ||
cypress/screenshots |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Bentley Systems, Incorporated. All rights reserved. | ||
* See LICENSE.md in the project root for license terms and full copyright notice. | ||
*--------------------------------------------------------------------------------------------*/ | ||
import { defineConfig } from 'cypress'; | ||
import react from '@vitejs/plugin-react'; | ||
import { createRequire } from 'node:module'; | ||
|
||
const require = createRequire(import.meta.url); | ||
const axeCorePath = require.resolve('axe-core'); | ||
|
||
export default defineConfig({ | ||
component: { | ||
devServer: { | ||
framework: 'react', | ||
bundler: 'vite', | ||
viteConfig: { | ||
plugins: [react()], | ||
}, | ||
}, | ||
env: { axeCorePath }, | ||
video: false, | ||
screenshotOnRunFailure: false, | ||
setupNodeEvents(on, config) { | ||
on('task', { | ||
log(message) { | ||
console.log(message); | ||
return null; | ||
}, | ||
table(message) { | ||
console.table(message); | ||
return null; | ||
}, | ||
}); | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!-- | ||
Copyright (c) Bentley Systems, Incorporated. All rights reserved. | ||
See LICENSE.md in the project root for license terms and full copyright notice. | ||
--> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta | ||
name="color-scheme" | ||
content="dark" | ||
/> | ||
<meta | ||
name="viewport" | ||
content="width=device-width,initial-scale=1.0" | ||
> | ||
<title>a11y testing</title> | ||
</head> | ||
<body> | ||
<main> | ||
<h1>a11y testing</h1> | ||
<div data-cy-root></div> | ||
</main> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Bentley Systems, Incorporated. All rights reserved. | ||
* See LICENSE.md in the project root for license terms and full copyright notice. | ||
*--------------------------------------------------------------------------------------------*/ | ||
// *********************************************************** | ||
// This example support/component.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 { mount } from 'cypress/react18'; | ||
|
||
declare global { | ||
namespace Cypress { | ||
interface Chainable { | ||
mount: typeof mount; | ||
} | ||
} | ||
} | ||
|
||
Cypress.Commands.add('mount', mount); | ||
|
||
import '@itwin/itwinui-react/styles.css'; | ||
|
||
import 'cypress-axe'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "a11y", | ||
"version": "0.0.0", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"test": "cypress run --component", | ||
"open": "cypress open --component", | ||
"clean": "rimraf .turbo && rimraf node_modules" | ||
}, | ||
"dependencies": { | ||
"@itwin/itwinui-react": "3.0.0-dev.3", | ||
"axe-core": "^4.7.2", | ||
"cypress": "^12.16.0", | ||
"cypress-axe": "^1.4.0", | ||
"examples": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Bentley Systems, Incorporated. All rights reserved. | ||
* See LICENSE.md in the project root for license terms and full copyright notice. | ||
*--------------------------------------------------------------------------------------------*/ | ||
import * as React from 'react'; | ||
mayank99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import * as allExamples from 'examples'; | ||
import { ThemeProvider } from '@itwin/itwinui-react'; | ||
|
||
describe('Should have no WCAG violations', () => { | ||
Object.entries(allExamples).forEach(([name, Component]) => { | ||
it(name, () => { | ||
cy.mount( | ||
<ThemeProvider theme='dark' style={{ height: '100vh' }}> | ||
<Component /> | ||
</ThemeProvider>, | ||
); | ||
cy.injectAxe({ | ||
axeCorePath: Cypress.env('axeCorePath'), | ||
}); | ||
cy.checkA11y(undefined, undefined, (violations) => { | ||
const violationData = violations.map(({ id, help }) => ({ | ||
Component: name, | ||
'Rule ID': id, | ||
Description: help, | ||
})); | ||
cy.task('table', violationData); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi i updated this because visual tests were failing even after retrying 7 times.