Skip to content

Commit 31bc052

Browse files
committed
Add accessibility testing for admin sidebar
1 parent 80492cd commit 31bc052

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

cypress/e2e/admin-sidebar.cy.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Options } from 'cypress-axe';
2+
import { testA11y } from 'cypress/support/utils';
3+
4+
describe('Admin Sidebar', () => {
5+
beforeEach(() => {
6+
// Must login as an Admin for sidebar to appear
7+
cy.visit('/login');
8+
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
9+
});
10+
11+
it('should be pinnable and pass accessibility tests', () => {
12+
// Pin the sidebar open
13+
cy.get('#sidebar-collapse-toggle').click();
14+
15+
// Click on every expandable section to open all menus
16+
cy.get('ds-expandable-admin-sidebar-section').click({multiple: true});
17+
18+
// Analyze <ds-admin-sidebar> for accessibility
19+
testA11y('ds-admin-sidebar',
20+
{
21+
rules: {
22+
// Currently all expandable sections have nested interactive elements
23+
// See https://github.com/DSpace/dspace-angular/issues/2178
24+
'nested-interactive': { enabled: false },
25+
}
26+
} as Options);
27+
});
28+
});

0 commit comments

Comments
 (0)