Skip to content

Commit 7611635

Browse files
authored
Merge pull request #3213 from 4Science/task/main/CST-15592
Implement e2e accessibility tests for pages in DSpace User Interface
2 parents b9c712c + 9e985cf commit 7611635

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+626
-11
lines changed

cypress.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export default defineConfig({
1818

1919
// Admin account used for administrative tests
2020
DSPACE_TEST_ADMIN_USER: '[email protected]',
21+
DSPACE_TEST_ADMIN_USER_UUID: '335647b6-8a52-4ecb-a8c1-7ebabb199bda',
2122
DSPACE_TEST_ADMIN_PASSWORD: 'dspace',
2223
// Community/collection/publication used for view/edit tests
2324
DSPACE_TEST_COMMUNITY: '0958c910-2037-42a9-81c7-dca80e3892b4',
@@ -33,6 +34,8 @@ export default defineConfig({
3334
// Account used to test basic submission process
3435
DSPACE_TEST_SUBMIT_USER: '[email protected]',
3536
DSPACE_TEST_SUBMIT_USER_PASSWORD: 'dspace',
37+
// Administrator users group
38+
DSPACE_ADMINISTRATOR_GROUP: 'e59f5659-bff9-451e-b28f-439e7bd467e4'
3639
},
3740
e2e: {
3841
// Setup our plugins for e2e tests
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { testA11y } from 'cypress/support/utils';
2+
3+
describe('Admin Add New Modals', () => {
4+
beforeEach(() => {
5+
// Must login as an Admin for sidebar to appear
6+
cy.visit('/login');
7+
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
8+
});
9+
10+
it('Add new Community modal should pass accessibility tests', () => {
11+
// Pin the sidebar open
12+
cy.get('#sidebar-collapse-toggle').click();
13+
14+
// Click on entry of menu
15+
cy.get('#admin-menu-section-new-title').click();
16+
17+
cy.get('a[data-test="menu.section.new_community"]').click();
18+
19+
// Analyze <ds-create-community-parent-selector> for accessibility
20+
testA11y('ds-create-community-parent-selector');
21+
});
22+
23+
it('Add new Collection modal should pass accessibility tests', () => {
24+
// Pin the sidebar open
25+
cy.get('#sidebar-collapse-toggle').click();
26+
27+
// Click on entry of menu
28+
cy.get('#admin-menu-section-new-title').click();
29+
30+
cy.get('a[data-test="menu.section.new_collection"]').click();
31+
32+
// Analyze <ds-create-collection-parent-selector> for accessibility
33+
testA11y('ds-create-collection-parent-selector');
34+
});
35+
36+
it('Add new Item modal should pass accessibility tests', () => {
37+
// Pin the sidebar open
38+
cy.get('#sidebar-collapse-toggle').click();
39+
40+
// Click on entry of menu
41+
cy.get('#admin-menu-section-new-title').click();
42+
43+
cy.get('a[data-test="menu.section.new_item"]').click();
44+
45+
// Analyze <ds-create-item-parent-selector> for accessibility
46+
testA11y('ds-create-item-parent-selector');
47+
});
48+
});
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { testA11y } from 'cypress/support/utils';
2+
3+
describe('Admin Curation Tasks', () => {
4+
beforeEach(() => {
5+
// Must login as an Admin to see the page
6+
cy.visit('/admin/curation-tasks');
7+
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
8+
});
9+
10+
it('should pass accessibility tests', () => {
11+
// Page must first be visible
12+
cy.get('ds-admin-curation-task').should('be.visible');
13+
// Analyze <ds-admin-curation-task> for accessibility issues
14+
testA11y('ds-admin-curation-task');
15+
});
16+
});
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { testA11y } from 'cypress/support/utils';
2+
3+
describe('Admin Edit Modals', () => {
4+
beforeEach(() => {
5+
// Must login as an Admin for sidebar to appear
6+
cy.visit('/login');
7+
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
8+
});
9+
10+
it('Edit Community modal should pass accessibility tests', () => {
11+
// Pin the sidebar open
12+
cy.get('#sidebar-collapse-toggle').click();
13+
14+
// Click on entry of menu
15+
cy.get('#admin-menu-section-edit-title').click();
16+
17+
cy.get('a[data-test="menu.section.edit_community"]').click();
18+
19+
// Analyze <ds-edit-community-selector> for accessibility
20+
testA11y('ds-edit-community-selector');
21+
});
22+
23+
it('Edit Collection modal should pass accessibility tests', () => {
24+
// Pin the sidebar open
25+
cy.get('#sidebar-collapse-toggle').click();
26+
27+
// Click on entry of menu
28+
cy.get('#admin-menu-section-edit-title').click();
29+
30+
cy.get('a[data-test="menu.section.edit_collection"]').click();
31+
32+
// Analyze <ds-edit-collection-selector> for accessibility
33+
testA11y('ds-edit-collection-selector');
34+
});
35+
36+
it('Edit Item modal should pass accessibility tests', () => {
37+
// Pin the sidebar open
38+
cy.get('#sidebar-collapse-toggle').click();
39+
40+
// Click on entry of menu
41+
cy.get('#admin-menu-section-edit-title').click();
42+
43+
cy.get('a[data-test="menu.section.edit_item"]').click();
44+
45+
// Analyze <ds-edit-item-selector> for accessibility
46+
testA11y('ds-edit-item-selector');
47+
});
48+
});
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { testA11y } from 'cypress/support/utils';
2+
3+
describe('Admin Export Modals', () => {
4+
beforeEach(() => {
5+
// Must login as an Admin for sidebar to appear
6+
cy.visit('/login');
7+
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
8+
});
9+
10+
it('Export metadata modal should pass accessibility tests', () => {
11+
// Pin the sidebar open
12+
cy.get('#sidebar-collapse-toggle').click();
13+
14+
// Click on entry of menu
15+
cy.get('#admin-menu-section-export-title').click();
16+
17+
cy.get('a[data-test="menu.section.export_metadata"]').click();
18+
19+
// Analyze <ds-export-metadata-selector> for accessibility
20+
testA11y('ds-export-metadata-selector');
21+
});
22+
23+
it('Export batch modal should pass accessibility tests', () => {
24+
// Pin the sidebar open
25+
cy.get('#sidebar-collapse-toggle').click();
26+
27+
// Click on entry of menu
28+
cy.get('#admin-menu-section-export-title').click();
29+
30+
cy.get('a[data-test="menu.section.export_batch"]').click();
31+
32+
// Analyze <ds-export-batch-selector> for accessibility
33+
testA11y('ds-export-batch-selector');
34+
});
35+
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { testA11y } from 'cypress/support/utils';
2+
3+
describe('Admin Notifications Publication Claim Page', () => {
4+
beforeEach(() => {
5+
// Must login as an Admin to see the page
6+
cy.visit('/admin/notifications/publication-claim');
7+
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
8+
});
9+
10+
it('should pass accessibility tests', () => {
11+
12+
//Page must first be visible
13+
cy.get('ds-admin-notifications-publication-claim-page').should('be.visible');
14+
// Analyze <ds-admin-notifications-publication-claim-page> for accessibility issues
15+
testA11y('ds-admin-notifications-publication-claim-page');
16+
});
17+
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { testA11y } from 'cypress/support/utils';
2+
3+
describe('Admin Search Page', () => {
4+
beforeEach(() => {
5+
// Must login as an Admin to see the page
6+
cy.visit('/admin/search');
7+
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
8+
});
9+
10+
it('should pass accessibility tests', () => {
11+
//Page must first be visible
12+
cy.get('ds-admin-search-page').should('be.visible');
13+
// At least one search result should be displayed
14+
cy.get('[data-test="list-object"]').should('be.visible');
15+
// Click each filter toggle to open *every* filter
16+
// (As we want to scan filter section for accessibility issues as well)
17+
cy.get('[data-test="filter-toggle"]').click({ multiple: true });
18+
// Analyze <ds-admin-search-page> for accessibility issues
19+
testA11y('ds-admin-search-page');
20+
});
21+
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { testA11y } from 'cypress/support/utils';
2+
3+
describe('Admin Workflow Page', () => {
4+
beforeEach(() => {
5+
// Must login as an Admin to see the page
6+
cy.visit('/admin/workflow');
7+
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
8+
});
9+
10+
it('should pass accessibility tests', () => {
11+
// Page must first be visible
12+
cy.get('ds-admin-workflow-page').should('be.visible');
13+
// At least one search result should be displayed
14+
cy.get('[data-test="list-object"]').should('be.visible');
15+
// Click each filter toggle to open *every* filter
16+
// (As we want to scan filter section for accessibility issues as well)
17+
cy.get('[data-test="filter-toggle"]').click({ multiple: true });
18+
// Analyze <ds-admin-workflow-page> for accessibility issues
19+
testA11y('ds-admin-workflow-page');
20+
});
21+
});
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { testA11y } from 'cypress/support/utils';
2+
3+
describe('Batch Import Page', () => {
4+
beforeEach(() => {
5+
// Must login as an Admin to see processes
6+
cy.visit('/admin/batch-import');
7+
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
8+
});
9+
10+
it('should pass accessibility tests', () => {
11+
// Batch import form must first be visible
12+
cy.get('ds-batch-import-page').should('be.visible');
13+
// Analyze <ds-batch-import-page> for accessibility issues
14+
testA11y('ds-batch-import-page');
15+
});
16+
});
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { testA11y } from 'cypress/support/utils';
2+
3+
describe('Bitstreams Formats', () => {
4+
beforeEach(() => {
5+
// Must login as an Admin to see the page
6+
cy.visit('/admin/registries/bitstream-formats');
7+
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
8+
});
9+
10+
it('should pass accessibility tests', () => {
11+
// Page must first be visible
12+
cy.get('ds-bitstream-formats').should('be.visible');
13+
// Analyze <ds-bitstream-formats> for accessibility issues
14+
testA11y('ds-bitstream-formats');
15+
});
16+
});

0 commit comments

Comments
 (0)