From 85e486438a1aab91856ecd218cdd497a081b4003 Mon Sep 17 00:00:00 2001 From: FrancescoMolinaro Date: Mon, 22 Jul 2024 15:47:13 +0200 Subject: [PATCH] [CST-15592] add accessibility tests for: Admin Notifications Publication Claim Admin Search Page Bulk Access Create Group Metadata Registry --- ...notifications-publication-claim-page.cy.ts | 17 +++++++++++++ cypress/e2e/admin-search-page.cy.ts | 18 ++++++++++++++ cypress/e2e/batch-import-page.cy.ts | 1 - cypress/e2e/bulk-access.cy.ts | 24 +++++++++++++++++++ cypress/e2e/create-eperson.cy.ts | 3 +-- cypress/e2e/create-group.cy.ts | 16 +++++++++++++ cypress/e2e/edit-eperson.cy.ts | 3 +-- cypress/e2e/edit-group.cy.ts | 3 +-- cypress/e2e/epeople-registry.cy.ts | 3 +-- cypress/e2e/groups-registry.cy.ts | 3 +-- cypress/e2e/metadata-import-page.cy.ts | 3 +-- cypress/e2e/metadata-registry.cy.ts | 16 +++++++++++++ cypress/e2e/new-process.cy.ts | 3 +-- cypress/e2e/processes-overview.cy.ts | 3 +-- .../e2e/quality-assurance-source-page.cy.ts | 3 +-- 15 files changed, 100 insertions(+), 19 deletions(-) create mode 100644 cypress/e2e/admin-notifications-publication-claim-page.cy.ts create mode 100644 cypress/e2e/admin-search-page.cy.ts create mode 100644 cypress/e2e/bulk-access.cy.ts create mode 100644 cypress/e2e/create-group.cy.ts create mode 100644 cypress/e2e/metadata-registry.cy.ts diff --git a/cypress/e2e/admin-notifications-publication-claim-page.cy.ts b/cypress/e2e/admin-notifications-publication-claim-page.cy.ts new file mode 100644 index 0000000000..4d297f5c9d --- /dev/null +++ b/cypress/e2e/admin-notifications-publication-claim-page.cy.ts @@ -0,0 +1,17 @@ +import { testA11y } from 'cypress/support/utils'; + +describe('Admin Notifications Publication Claim', () => { + beforeEach(() => { + // Must login as an Admin to see the page + cy.visit('/admin/notifications/publication-claim'); + cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); + }); + + it('should pass accessibility tests', () => { + + //Page must first be visible + cy.get('ds-admin-notifications-publication-claim-page').should('be.visible'); + // Analyze for accessibility issues + testA11y('ds-admin-notifications-publication-claim-page'); + }); +}); diff --git a/cypress/e2e/admin-search-page.cy.ts b/cypress/e2e/admin-search-page.cy.ts new file mode 100644 index 0000000000..2e1d13aa13 --- /dev/null +++ b/cypress/e2e/admin-search-page.cy.ts @@ -0,0 +1,18 @@ +import { testA11y } from 'cypress/support/utils'; + +describe('Admin Search Page', () => { + beforeEach(() => { + // Must login as an Admin to see the page + cy.visit('/admin/search'); + cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); + }); + + it('should pass accessibility tests', () => { + //Page must first be visible + cy.get('ds-admin-search-page').should('be.visible'); + // At least one search result should be displayed + cy.get('[data-test="list-object"]').should('be.visible'); + // Analyze for accessibility issues + testA11y('ds-admin-search-page'); + }); +}); diff --git a/cypress/e2e/batch-import-page.cy.ts b/cypress/e2e/batch-import-page.cy.ts index 82660e8e43..871b8644ce 100644 --- a/cypress/e2e/batch-import-page.cy.ts +++ b/cypress/e2e/batch-import-page.cy.ts @@ -1,7 +1,6 @@ import { testA11y } from 'cypress/support/utils'; describe('Batch Import Page', () => { - // NOTE: these tests currently assume this query will return results! beforeEach(() => { // Must login as an Admin to see processes cy.visit('/admin/batch-import'); diff --git a/cypress/e2e/bulk-access.cy.ts b/cypress/e2e/bulk-access.cy.ts new file mode 100644 index 0000000000..4d199f53f9 --- /dev/null +++ b/cypress/e2e/bulk-access.cy.ts @@ -0,0 +1,24 @@ +import { testA11y } from 'cypress/support/utils'; +import { Options } from 'cypress-axe'; + +describe('Bulk Access', () => { + beforeEach(() => { + // Must login as an Admin to see the page + cy.visit('/access-control/bulk-access'); + cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); + }); + + it('should pass accessibility tests', () => { + // Page must first be visible + cy.get('ds-bulk-access').should('be.visible'); + // Analyze for accessibility issues + testA11y('ds-bulk-access', { + rules: { + // All panels are accordians & fail "aria-required-children" and "nested-interactive". + // Seem to require updating ng-bootstrap and https://github.com/DSpace/dspace-angular/issues/2216 + 'aria-required-children': { enabled: false }, + 'nested-interactive': { enabled: false }, + }, + } as Options); + }); +}); diff --git a/cypress/e2e/create-eperson.cy.ts b/cypress/e2e/create-eperson.cy.ts index b1c5d27dc4..d23986ba29 100644 --- a/cypress/e2e/create-eperson.cy.ts +++ b/cypress/e2e/create-eperson.cy.ts @@ -1,9 +1,8 @@ import { testA11y } from 'cypress/support/utils'; describe('Create Eperson', () => { - // NOTE: these tests currently assume this query will return results! beforeEach(() => { - // Must login as an Admin to see processes + // Must login as an Admin to see the page cy.visit('/access-control/epeople/create'); cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); }); diff --git a/cypress/e2e/create-group.cy.ts b/cypress/e2e/create-group.cy.ts new file mode 100644 index 0000000000..135c041a8d --- /dev/null +++ b/cypress/e2e/create-group.cy.ts @@ -0,0 +1,16 @@ +import { testA11y } from 'cypress/support/utils'; + +describe('Create Group', () => { + beforeEach(() => { + // Must login as an Admin to see the page + cy.visit('/access-control/groups/create'); + cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); + }); + + it('should pass accessibility tests', () => { + // Form must first be visible + cy.get('ds-group-form').should('be.visible'); + // Analyze for accessibility issues + testA11y('ds-group-form'); + }); +}); diff --git a/cypress/e2e/edit-eperson.cy.ts b/cypress/e2e/edit-eperson.cy.ts index 0fc052472b..166c913b8c 100644 --- a/cypress/e2e/edit-eperson.cy.ts +++ b/cypress/e2e/edit-eperson.cy.ts @@ -1,9 +1,8 @@ import { testA11y } from 'cypress/support/utils'; describe('Edit Eperson', () => { - // NOTE: these tests currently assume this query will return results! beforeEach(() => { - // Must login as an Admin to see processes + // Must login as an Admin to see the page cy.visit('/access-control/epeople/'.concat(Cypress.env('DSPACE_TEST_ADMIN_USER_UUID')).concat('/edit')); cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); }); diff --git a/cypress/e2e/edit-group.cy.ts b/cypress/e2e/edit-group.cy.ts index 63a5af857b..e43ede978a 100644 --- a/cypress/e2e/edit-group.cy.ts +++ b/cypress/e2e/edit-group.cy.ts @@ -1,9 +1,8 @@ import { testA11y } from 'cypress/support/utils'; describe('Edit Group', () => { - // NOTE: these tests currently assume this query will return results! beforeEach(() => { - // Must login as an Admin to see processes + // Must login as an Admin to see the page cy.visit('/access-control/groups/'.concat(Cypress.env('DSPACE_ADMINISTRATOR_GROUP')).concat('/edit')); cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); }); diff --git a/cypress/e2e/epeople-registry.cy.ts b/cypress/e2e/epeople-registry.cy.ts index b278350c10..a6192f13d9 100644 --- a/cypress/e2e/epeople-registry.cy.ts +++ b/cypress/e2e/epeople-registry.cy.ts @@ -1,9 +1,8 @@ import { testA11y } from 'cypress/support/utils'; describe('Epeople registry', () => { - // NOTE: these tests currently assume this query will return results! beforeEach(() => { - // Must login as an Admin to see processes + // Must login as an Admin to see the page cy.visit('/access-control/epeople'); cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); }); diff --git a/cypress/e2e/groups-registry.cy.ts b/cypress/e2e/groups-registry.cy.ts index dc97e17c9f..5c0099c2f1 100644 --- a/cypress/e2e/groups-registry.cy.ts +++ b/cypress/e2e/groups-registry.cy.ts @@ -1,9 +1,8 @@ import { testA11y } from 'cypress/support/utils'; describe('Groups registry', () => { - // NOTE: these tests currently assume this query will return results! beforeEach(() => { - // Must login as an Admin to see processes + // Must login as an Admin to see the page cy.visit('/access-control/groups'); cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); }); diff --git a/cypress/e2e/metadata-import-page.cy.ts b/cypress/e2e/metadata-import-page.cy.ts index 3c1d1a91af..a31c18e4eb 100644 --- a/cypress/e2e/metadata-import-page.cy.ts +++ b/cypress/e2e/metadata-import-page.cy.ts @@ -1,9 +1,8 @@ import { testA11y } from 'cypress/support/utils'; describe('Metadata Import Page', () => { - // NOTE: these tests currently assume this query will return results! beforeEach(() => { - // Must login as an Admin to see processes + // Must login as an Admin to see the page cy.visit('/admin/metadata-import'); cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); }); diff --git a/cypress/e2e/metadata-registry.cy.ts b/cypress/e2e/metadata-registry.cy.ts new file mode 100644 index 0000000000..f0f3db48d3 --- /dev/null +++ b/cypress/e2e/metadata-registry.cy.ts @@ -0,0 +1,16 @@ +import { testA11y } from 'cypress/support/utils'; + +describe('Metadata registry', () => { + beforeEach(() => { + // Must login as an Admin to see the page + cy.visit('/admin/registries/metadata'); + cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); + }); + + it('should pass accessibility tests', () => { + // Page must first be visible + cy.get('ds-metadata-registry').should('be.visible'); + // Analyze for accessibility issues + testA11y('ds-metadata-registry'); + }); +}); diff --git a/cypress/e2e/new-process.cy.ts b/cypress/e2e/new-process.cy.ts index d2a6ab4731..d26da7cc4d 100644 --- a/cypress/e2e/new-process.cy.ts +++ b/cypress/e2e/new-process.cy.ts @@ -1,9 +1,8 @@ import { testA11y } from 'cypress/support/utils'; describe('New Process', () => { - // NOTE: these tests currently assume this query will return results! beforeEach(() => { - // Must login as an Admin to see processes + // Must login as an Admin to see the page cy.visit('/processes/new'); cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); }); diff --git a/cypress/e2e/processes-overview.cy.ts b/cypress/e2e/processes-overview.cy.ts index f0e1ccc3fe..2be3bd4c18 100644 --- a/cypress/e2e/processes-overview.cy.ts +++ b/cypress/e2e/processes-overview.cy.ts @@ -1,9 +1,8 @@ import { testA11y } from 'cypress/support/utils'; describe('Processes Overview', () => { - // NOTE: these tests currently assume this query will return results! beforeEach(() => { - // Must login as an Admin to see processes + // Must login as an Admin to see the page cy.visit('/processes'); cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); }); diff --git a/cypress/e2e/quality-assurance-source-page.cy.ts b/cypress/e2e/quality-assurance-source-page.cy.ts index beb797df41..722917ef16 100644 --- a/cypress/e2e/quality-assurance-source-page.cy.ts +++ b/cypress/e2e/quality-assurance-source-page.cy.ts @@ -1,9 +1,8 @@ import { testA11y } from 'cypress/support/utils'; describe('Quality Assurance Source Page', () => { - // NOTE: these tests currently assume this query will return results! beforeEach(() => { - // Must login as an Admin to see processes + // Must login as an Admin to see the page cy.visit('/notifications/quality-assurance'); cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); });