-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add accessibility testing for admin sidebar
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 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 |
---|---|---|
@@ -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); | ||
}); | ||
}); |