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
Bug 1880118: Cypress a11y enhancements #6698
Bug 1880118: Cypress a11y enhancements #6698
Conversation
@dtaylor113: This pull request references Bugzilla bug 1880118, which is valid. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@dtaylor113: This pull request references Bugzilla bug 1880118, which is valid. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@@ -33,6 +34,12 @@ module.exports = (on, config) => { | |||
console.table(data); | |||
return null; | |||
}, | |||
readFileMaybe(filename) { |
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.
readFileMaybe(filename) { | |
readFileIfExists(filename) { |
description, | ||
nodes: nodes.length, | ||
})); | ||
window.Cypress.numberA11yViolations += violations.length; |
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.
Should we be modifying the Cypress
object? I'd think we'd want to avoid mutating that since it's not our API and store this somewhere else.
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.
Ok, how about window.a11y.numberViolations
?
frontend/public/declarations.d.ts
Outdated
numberA11yViolations: number; | ||
numberA11yChecks: number; |
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.
If we're only accessing these in the Cypress tests, it would be better to avoid adding the types here since this window
definition applies to console itself.
window.Cypress.numberA11yViolations = Number(a11yResult.numberA11yViolations); | ||
window.Cypress.numberA11yChecks = Number(a11yResult.numberA11yChecks); |
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.
If you move this inside the try
block, you can use const
on allyResult
.
} catch (e) { | ||
cy.task( | ||
'logError', | ||
`couldn't parse cypress-a11y-results.json. ${JSON.stringify(e, null, ' ')}`, |
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.
I don't think we need the full stack trace here, only the error message?
`couldn't parse cypress-a11y-results.json. ${JSON.stringify(e, null, ' ')}`, | |
`couldn't parse cypress-a11y-results.json. ${e}`, |
@@ -132,8 +135,10 @@ describe('Kubernetes resource CRUD operations', () => { | |||
// filter should have 3 chip groups: resource, label, and name | |||
listPage.filter.numberOfActiveFiltersShouldBe(3); | |||
listPage.rows.shouldExist(name); | |||
cy.testA11y(`Search page for ${kind}: ${name}`); | |||
|
|||
// Search page same for all resources, so only a11y test once |
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.
This isn't true since the lists are different for each resource. I'd go ahead and test each one unless there is a good reason not to.
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.
ok, thought it was the same for every resource.
@@ -25,11 +25,13 @@ describe('Namespace', () => { | |||
listPage.rows.shouldNotExist(newName); | |||
listPage.filter.byName(testName); | |||
listPage.rows.shouldExist(testName); // created via cy.createProject(testName) above | |||
cy.testA11y(`Namespace List page`); |
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.
Unnecessary backticks. (I thought we had an eslint rule for this.)
cy.testA11y(`Namespace List page`); | |
cy.testA11y('Namespace List page'); |
|
||
cy.log('creates the Namespace'); | ||
listPage.clickCreateYAMLbutton(); | ||
modal.shouldBeOpened(); | ||
cy.byTestID('input-name').type(newName); | ||
cy.testA11y(`Create Namespace modal`); |
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.
cy.testA11y(`Create Namespace modal`); | |
cy.testA11y('Create Namespace modal'); |
@@ -41,6 +43,7 @@ describe('Namespace', () => { | |||
listPage.rows.clickKebabAction(newName, 'Delete Namespace'); | |||
modal.shouldBeOpened(); | |||
cy.byTestID('project-name-input').type(newName); | |||
cy.testA11y(`Delete Namespace modal`); |
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.
cy.testA11y(`Delete Namespace modal`); | |
cy.testA11y('Delete Namespace modal'); |
@@ -45,6 +45,7 @@ describe('Monitoring: Alerts', () => { | |||
cy.byLegacyTestID('resource-title').should('have.text', 'Alerting'); | |||
listPage.projectDropdownShouldNotExist(); | |||
listPage.rows.shouldBeLoaded(); | |||
cy.testA11y(`Monitor Alerting list page`); |
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.
Unnecessary backticks throughout this file.
0c6d0f4
to
7da7af2
Compare
@dtaylor113: This pull request references Bugzilla bug 1880118, which is valid. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Hi @spadgett, I believe I have addressed all of your comments. PTAL -thanks |
@@ -1,59 +1,37 @@ | |||
/* eslint-disable import/no-duplicates */ |
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.
Why is this needed?
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.
It is not :-) removed.
// YAML Editor same for all resources, so only a11y test once | ||
if (kind === 'Pod') { | ||
cy.testA11y(`YAML Editor for ${kind}: ${name}`); | ||
} |
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.
I thought the YAML Editor html elements would be the same for every resource, only the inner YAML text changes, so no need to rerun a11y checks for every resource, just one would do, right?
I wouldn't assume that will always be true, and there's no virtually no overhead to checking a11y for each resource. And it makes the code simpler as well. I don't see a reason to restrict it to just pods.
Fixed. Ok, just didn't want to inflate a11y total number of checks run, that's an extra 27 checks which might be the same page/elements. |
262b4ed
to
4d3cafb
Compare
@dtaylor113: This pull request references Bugzilla bug 1880118, which is valid. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
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.
/lgtm
Thanks @dtaylor113 👍
]; | ||
otherRoutes.forEach((route) => { | ||
it(`successfully displays view for route: ${route}`, () => { | ||
cy.visit(`${route}`); |
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.
nit:
cy.visit(`${route}`); | |
cy.visit(route); |
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.
Hi @spadgett, fixed, pls re-add 'lgtm' label -thanks
4d3cafb
to
c5d2831
Compare
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.
/lgtm
c5d2831
to
6f0677e
Compare
Hi @spadgett, had to resolve merge conflict, pls re-add 'lgtm' label -thanks |
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dtaylor113, spadgett The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@dtaylor113: Some pull requests linked via external trackers have merged: The following pull requests linked via external trackers have not merged:
These pull request must merge or be unlinked from the Bugzilla bug in order for it to move to the next state. Bugzilla bug 1880118 has not been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This PR includes 3 a11y enhancements to our Cypress tests:
1. Adds a11y checks to Namespaces and Monitoring tests
2. Ports Protractors
other-routes
tests to Cypress and does a11y check on the routes:3. Outputs a11y summary:
JIRA Story: https://issues.redhat.com/browse/CONSOLE-2359