forked from DSpace/dspace-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request DSpace#2711 from tdonohue/add_accessibility_tests
Add more automated accessibility scanning to e2e tests & fix a few minor accessibility bugs
- Loading branch information
Showing
36 changed files
with
728 additions
and
236 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,9 @@ export default defineConfig({ | |
openMode: 0, | ||
}, | ||
env: { | ||
// Global constants used in DSpace e2e tests (see also ./cypress/support/e2e.ts) | ||
// May be overridden in our cypress.json config file using specified environment variables. | ||
// Global DSpace environment variables used in all our Cypress e2e tests | ||
// May be modified in this config, or overridden in a variety of ways. | ||
// See Cypress environment variable docs: https://docs.cypress.io/guides/guides/environment-variables | ||
// Default values listed here are all valid for the Demo Entities Data set available at | ||
// https://github.com/DSpace-Labs/AIP-Files/releases/tag/demo-entities-data | ||
// (This is the data set used in our CI environment) | ||
|
@@ -21,12 +22,14 @@ export default defineConfig({ | |
// Community/collection/publication used for view/edit tests | ||
DSPACE_TEST_COMMUNITY: '0958c910-2037-42a9-81c7-dca80e3892b4', | ||
DSPACE_TEST_COLLECTION: '282164f5-d325-4740-8dd1-fa4d6d3e7200', | ||
DSPACE_TEST_ENTITY_PUBLICATION: 'e98b0f27-5c19-49a0-960d-eb6ad5287067', | ||
DSPACE_TEST_ENTITY_PUBLICATION: '6160810f-1e53-40db-81ef-f6621a727398', | ||
// Search term (should return results) used in search tests | ||
DSPACE_TEST_SEARCH_TERM: 'test', | ||
// Collection used for submission tests | ||
// Main Collection used for submission tests. Should be able to accept normal Item objects | ||
DSPACE_TEST_SUBMIT_COLLECTION_NAME: 'Sample Collection', | ||
DSPACE_TEST_SUBMIT_COLLECTION_UUID: '9d8334e9-25d3-4a67-9cea-3dffdef80144', | ||
// Collection used for Person entity submission tests. MUST be configured with EntityType=Person. | ||
DSPACE_TEST_SUBMIT_PERSON_COLLECTION_NAME: 'People', | ||
// Account used to test basic submission process | ||
DSPACE_TEST_SUBMIT_USER: '[email protected]', | ||
DSPACE_TEST_SUBMIT_USER_PASSWORD: 'dspace', | ||
|
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,28 @@ | ||
import { Options } from 'cypress-axe'; | ||
import { testA11y } from 'cypress/support/utils'; | ||
|
||
describe('Admin Sidebar', () => { | ||
beforeEach(() => { | ||
// Must login as an Admin for sidebar to appear | ||
cy.visit('/login'); | ||
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); | ||
}); | ||
|
||
it('should be pinnable and pass accessibility tests', () => { | ||
// Pin the sidebar open | ||
cy.get('#sidebar-collapse-toggle').click(); | ||
|
||
// Click on every expandable section to open all menus | ||
cy.get('ds-expandable-admin-sidebar-section').click({multiple: true}); | ||
|
||
// Analyze <ds-admin-sidebar> for accessibility | ||
testA11y('ds-admin-sidebar', | ||
{ | ||
rules: { | ||
// Currently all expandable sections have nested interactive elements | ||
// See https://github.com/DSpace/dspace-angular/issues/2178 | ||
'nested-interactive': { enabled: false }, | ||
} | ||
} as Options); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,128 @@ | ||
import { testA11y } from 'cypress/support/utils'; | ||
|
||
const COLLECTION_EDIT_PAGE = '/collections/'.concat(Cypress.env('DSPACE_TEST_COLLECTION')).concat('/edit'); | ||
|
||
beforeEach(() => { | ||
// All tests start with visiting the Edit Collection Page | ||
cy.visit(COLLECTION_EDIT_PAGE); | ||
|
||
// This page is restricted, so we will be shown the login form. Fill it out & submit. | ||
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); | ||
}); | ||
|
||
describe('Edit Collection > Edit Metadata tab', () => { | ||
it('should pass accessibility tests', () => { | ||
// <ds-edit-collection> tag must be loaded | ||
cy.get('ds-edit-collection').should('be.visible'); | ||
|
||
// Analyze <ds-edit-collection> for accessibility issues | ||
testA11y('ds-edit-collection'); | ||
}); | ||
}); | ||
|
||
describe('Edit Collection > Assign Roles tab', () => { | ||
|
||
it('should pass accessibility tests', () => { | ||
cy.get('a[data-test="roles"]').click(); | ||
|
||
// <ds-collection-roles> tag must be loaded | ||
cy.get('ds-collection-roles').should('be.visible'); | ||
|
||
// Analyze for accessibility issues | ||
testA11y('ds-collection-roles'); | ||
}); | ||
}); | ||
|
||
describe('Edit Collection > Content Source tab', () => { | ||
|
||
it('should pass accessibility tests', () => { | ||
cy.get('a[data-test="source"]').click(); | ||
|
||
// <ds-collection-source> tag must be loaded | ||
cy.get('ds-collection-source').should('be.visible'); | ||
|
||
// Check the external source checkbox (to display all fields on the page) | ||
cy.get('#externalSourceCheck').check(); | ||
|
||
// Wait for the source controls to appear | ||
cy.get('ds-collection-source-controls').should('be.visible'); | ||
|
||
// Analyze entire page for accessibility issues | ||
testA11y('ds-collection-source'); | ||
}); | ||
}); | ||
|
||
describe('Edit Collection > Curate tab', () => { | ||
|
||
it('should pass accessibility tests', () => { | ||
cy.get('a[data-test="curate"]').click(); | ||
|
||
// <ds-collection-curate> tag must be loaded | ||
cy.get('ds-collection-curate').should('be.visible'); | ||
|
||
// Analyze for accessibility issues | ||
testA11y('ds-collection-curate'); | ||
}); | ||
}); | ||
|
||
describe('Edit Collection > Access Control tab', () => { | ||
|
||
it('should pass accessibility tests', () => { | ||
cy.get('a[data-test="access-control"]').click(); | ||
|
||
// <ds-collection-access-control> tag must be loaded | ||
cy.get('ds-collection-access-control').should('be.visible'); | ||
|
||
// Analyze for accessibility issues | ||
testA11y('ds-collection-access-control'); | ||
}); | ||
}); | ||
|
||
describe('Edit Collection > Authorizations tab', () => { | ||
|
||
it('should pass accessibility tests', () => { | ||
cy.get('a[data-test="authorizations"]').click(); | ||
|
||
// <ds-collection-authorizations> tag must be loaded | ||
cy.get('ds-collection-authorizations').should('be.visible'); | ||
|
||
// Analyze for accessibility issues | ||
testA11y('ds-collection-authorizations'); | ||
}); | ||
}); | ||
|
||
describe('Edit Collection > Item Mapper tab', () => { | ||
|
||
it('should pass accessibility tests', () => { | ||
cy.get('a[data-test="mapper"]').click(); | ||
|
||
// <ds-collection-item-mapper> tag must be loaded | ||
cy.get('ds-collection-item-mapper').should('be.visible'); | ||
|
||
// Analyze entire page for accessibility issues | ||
testA11y('ds-collection-item-mapper'); | ||
|
||
// Click on the "Map new Items" tab | ||
cy.get('li[data-test="mapTab"] a').click(); | ||
|
||
// Make sure search form is now visible | ||
cy.get('ds-search-form').should('be.visible'); | ||
|
||
// Analyze entire page (again) for accessibility issues | ||
testA11y('ds-collection-item-mapper'); | ||
}); | ||
}); | ||
|
||
|
||
describe('Edit Collection > Delete page', () => { | ||
|
||
it('should pass accessibility tests', () => { | ||
cy.get('a[data-test="delete-button"]').click(); | ||
|
||
// <ds-delete-collection> tag must be loaded | ||
cy.get('ds-delete-collection').should('be.visible'); | ||
|
||
// Analyze for accessibility issues | ||
testA11y('ds-delete-collection'); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { testA11y } from 'cypress/support/utils'; | ||
|
||
const COMMUNITY_EDIT_PAGE = '/communities/'.concat(Cypress.env('DSPACE_TEST_COMMUNITY')).concat('/edit'); | ||
|
||
beforeEach(() => { | ||
// All tests start with visiting the Edit Community Page | ||
cy.visit(COMMUNITY_EDIT_PAGE); | ||
|
||
// This page is restricted, so we will be shown the login form. Fill it out & submit. | ||
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); | ||
}); | ||
|
||
describe('Edit Community > Edit Metadata tab', () => { | ||
it('should pass accessibility tests', () => { | ||
// <ds-edit-community> tag must be loaded | ||
cy.get('ds-edit-community').should('be.visible'); | ||
|
||
// Analyze <ds-edit-community> for accessibility issues | ||
testA11y('ds-edit-community'); | ||
}); | ||
}); | ||
|
||
describe('Edit Community > Assign Roles tab', () => { | ||
|
||
it('should pass accessibility tests', () => { | ||
cy.get('a[data-test="roles"]').click(); | ||
|
||
// <ds-community-roles> tag must be loaded | ||
cy.get('ds-community-roles').should('be.visible'); | ||
|
||
// Analyze for accessibility issues | ||
testA11y('ds-community-roles'); | ||
}); | ||
}); | ||
|
||
describe('Edit Community > Curate tab', () => { | ||
|
||
it('should pass accessibility tests', () => { | ||
cy.get('a[data-test="curate"]').click(); | ||
|
||
// <ds-community-curate> tag must be loaded | ||
cy.get('ds-community-curate').should('be.visible'); | ||
|
||
// Analyze for accessibility issues | ||
testA11y('ds-community-curate'); | ||
}); | ||
}); | ||
|
||
describe('Edit Community > Access Control tab', () => { | ||
|
||
it('should pass accessibility tests', () => { | ||
cy.get('a[data-test="access-control"]').click(); | ||
|
||
// <ds-community-access-control> tag must be loaded | ||
cy.get('ds-community-access-control').should('be.visible'); | ||
|
||
// Analyze for accessibility issues | ||
testA11y('ds-community-access-control'); | ||
}); | ||
}); | ||
|
||
describe('Edit Community > Authorizations tab', () => { | ||
|
||
it('should pass accessibility tests', () => { | ||
cy.get('a[data-test="authorizations"]').click(); | ||
|
||
// <ds-community-authorizations> tag must be loaded | ||
cy.get('ds-community-authorizations').should('be.visible'); | ||
|
||
// Analyze for accessibility issues | ||
testA11y('ds-community-authorizations'); | ||
}); | ||
}); | ||
|
||
describe('Edit Community > Delete page', () => { | ||
|
||
it('should pass accessibility tests', () => { | ||
cy.get('a[data-test="delete-button"]').click(); | ||
|
||
// <ds-delete-community> tag must be loaded | ||
cy.get('ds-delete-community').should('be.visible'); | ||
|
||
// Analyze for accessibility issues | ||
testA11y('ds-delete-community'); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,15 +1,14 @@ | ||
import { TEST_COMMUNITY } from 'cypress/support/e2e'; | ||
import { testA11y } from 'cypress/support/utils'; | ||
|
||
describe('Community Page', () => { | ||
|
||
it('should pass accessibility tests', () => { | ||
cy.visit('/communities/'.concat(TEST_COMMUNITY)); | ||
cy.visit('/communities/'.concat(Cypress.env('DSPACE_TEST_COMMUNITY'))); | ||
|
||
// <ds-community-page> tag must be loaded | ||
cy.get('ds-community-page').should('be.visible'); | ||
|
||
// Analyze <ds-community-page> for accessibility issues | ||
testA11y('ds-community-page',); | ||
testA11y('ds-community-page'); | ||
}); | ||
}); |
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
Oops, something went wrong.