Skip to content

Commit 53d521a

Browse files
committed
Add new e2e accessibility tests & update some existing ones
1 parent 55c191e commit 53d521a

3 files changed

Lines changed: 24 additions & 18 deletions

File tree

cypress/e2e/login-modal.cy.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ describe('Login Modal', () => {
109109
cy.get('ds-themed-navbar [data-test="register"]').click();
110110
cy.location('pathname').should('eq', '/register');
111111
cy.get('ds-register-email').should('exist');
112+
113+
// Test accessibility of this page
114+
testA11y('ds-register-email');
112115
});
113116

114117
it('should allow forgot password', () => {
@@ -123,16 +126,26 @@ describe('Login Modal', () => {
123126
cy.get('ds-themed-navbar [data-test="forgot"]').click();
124127
cy.location('pathname').should('eq', '/forgot');
125128
cy.get('ds-forgot-email').should('exist');
129+
130+
// Test accessibility of this page
131+
testA11y('ds-forgot-email');
126132
});
127133

128-
it('should pass accessibility tests', () => {
134+
it('should pass accessibility tests in menus', () => {
129135
cy.visit('/');
130136

137+
// Open login menu & verify accessibility
131138
page.openLoginMenu();
132-
133139
cy.get('ds-log-in').should('exist');
134-
135-
// Analyze <ds-log-in> for accessibility issues
136140
testA11y('ds-log-in');
141+
142+
// Now login
143+
page.submitLoginAndPasswordByPressingButton(TEST_ADMIN_USER, TEST_ADMIN_PASSWORD);
144+
cy.get('ds-log-in').should('not.exist');
145+
146+
// Open user menu, verify user menu accesibility
147+
page.openUserMenu();
148+
cy.get('ds-user-menu').should('be.visible');
149+
testA11y('ds-user-menu');
137150
});
138151
});

cypress/e2e/my-dspace.cy.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Options } from 'cypress-axe';
21
import { TEST_SUBMIT_USER, TEST_SUBMIT_USER_PASSWORD, TEST_SUBMIT_COLLECTION_NAME } from 'cypress/support/e2e';
32
import { testA11y } from 'cypress/support/utils';
43

@@ -35,16 +34,8 @@ describe('My DSpace page', () => {
3534

3635
cy.get('ds-object-detail').should('be.visible');
3736

38-
// Analyze <ds-search-page> for accessibility issues
39-
testA11y('ds-my-dspace-page',
40-
{
41-
rules: {
42-
// Search filters fail these two "moderate" impact rules
43-
'heading-order': { enabled: false },
44-
'landmark-unique': { enabled: false }
45-
}
46-
} as Options
47-
);
37+
// Analyze <ds-my-dspace-page> for accessibility issues
38+
testA11y('ds-my-dspace-page');
4839
});
4940

5041
// NOTE: Deleting existing submissions is exercised by submission.spec.ts
@@ -136,6 +127,9 @@ describe('My DSpace page', () => {
136127

137128
// The external import searchbox should be visible
138129
cy.get('ds-submission-import-external-searchbar').should('be.visible');
130+
131+
// Test for accessibility issues
132+
testA11y('ds-submission-import-external');
139133
});
140134

141135
});

cypress/e2e/search-page.cy.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ describe('Search Page', () => {
4646
testA11y('ds-search-page',
4747
{
4848
rules: {
49-
// Search filters fail these two "moderate" impact rules
50-
'heading-order': { enabled: false },
51-
'landmark-unique': { enabled: false }
49+
// Card titles fail this test currently
50+
'heading-order': { enabled: false }
5251
}
5352
} as Options
5453
);

0 commit comments

Comments
 (0)