mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
Add basic accessibility scan for most public pages. Disable any a11y tests with known issues
This commit is contained in:
23
cypress/integration/breadcrumbs.spec.ts
Normal file
23
cypress/integration/breadcrumbs.spec.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { Options } from "cypress-axe";
|
||||||
|
import { TEST_ENTITY_PUBLICATION } from "cypress/support";
|
||||||
|
|
||||||
|
describe('Breadcrumbs', () => {
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
// Visit an Item, as those have more breadcrumbs
|
||||||
|
cy.visit('/entities/publication/' + TEST_ENTITY_PUBLICATION);
|
||||||
|
cy.injectAxe();
|
||||||
|
|
||||||
|
// Wait for breadcrumbs to be visible
|
||||||
|
cy.get('ds-breadcrumbs').should('be.visible');
|
||||||
|
|
||||||
|
// Analyze <ds-breadcrumbs> for accessibility
|
||||||
|
// Disable color-contrast checks until #1149 is fixed
|
||||||
|
cy.checkA11y('ds-breadcrumbs',
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
'color-contrast': { enabled: false }
|
||||||
|
}
|
||||||
|
} as Options
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
23
cypress/integration/collection-page.spec.ts
Normal file
23
cypress/integration/collection-page.spec.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { Options } from "cypress-axe";
|
||||||
|
import { TEST_COLLECTION } from "cypress/support";
|
||||||
|
|
||||||
|
describe('Collection Page', () => {
|
||||||
|
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.visit('/collections/' + TEST_COLLECTION);
|
||||||
|
cy.injectAxe();
|
||||||
|
|
||||||
|
// <ds-collection-page> tag must be loaded
|
||||||
|
cy.get('ds-collection-page').should('exist');
|
||||||
|
|
||||||
|
// Analyze <ds-collection-page> for accessibility issues
|
||||||
|
// Disable color-contrast checks until it is fixed (see #1202 and #1178)
|
||||||
|
cy.checkA11y('ds-collection-page',
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
'color-contrast': { enabled: false }
|
||||||
|
}
|
||||||
|
} as Options
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
32
cypress/integration/collection-statistics.spec.ts
Normal file
32
cypress/integration/collection-statistics.spec.ts
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import { TEST_COLLECTION } from "cypress/support";
|
||||||
|
|
||||||
|
describe('Collection Statistics Page', () => {
|
||||||
|
const COLLECTIONSTATISTICSPAGE = '/statistics/collections/' + TEST_COLLECTION;
|
||||||
|
|
||||||
|
it('should load if you click on "Statistics" from a Collection page', () => {
|
||||||
|
cy.visit('/collections/' + TEST_COLLECTION);
|
||||||
|
cy.get('ds-navbar ds-link-menu-item a[title="Statistics"]').click();
|
||||||
|
cy.location('pathname').should('eq', COLLECTIONSTATISTICSPAGE);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should contain a "Total visits" section', () => {
|
||||||
|
cy.visit(COLLECTIONSTATISTICSPAGE);
|
||||||
|
cy.get('.' + TEST_COLLECTION + '_TotalVisits').should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should contain a "Total visits per month" section', () => {
|
||||||
|
cy.visit(COLLECTIONSTATISTICSPAGE);
|
||||||
|
cy.get('.' + TEST_COLLECTION + '_TotalVisitsPerMonth').should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.visit(COLLECTIONSTATISTICSPAGE);
|
||||||
|
cy.injectAxe();
|
||||||
|
|
||||||
|
// <ds-collection-statistics-page> tag must be loaded
|
||||||
|
cy.get('ds-collection-statistics-page').should('exist');
|
||||||
|
|
||||||
|
// Analyze <ds-collection-statistics-page> for accessibility issues
|
||||||
|
cy.checkA11y('ds-collection-statistics-page');
|
||||||
|
});
|
||||||
|
});
|
25
cypress/integration/community-list.spec.ts
Normal file
25
cypress/integration/community-list.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import { Options } from "cypress-axe";
|
||||||
|
|
||||||
|
describe('Community List Page', () => {
|
||||||
|
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.visit('/community-list');
|
||||||
|
cy.injectAxe();
|
||||||
|
|
||||||
|
// <ds-community-list-page> tag must be loaded
|
||||||
|
cy.get('ds-community-list-page').should('exist');
|
||||||
|
|
||||||
|
// Open first Community (to show Collections)...that way we scan sub-elements as well
|
||||||
|
cy.get('ds-community-list :nth-child(1) > .btn-group > .btn').click();
|
||||||
|
|
||||||
|
// Analyze <ds-community-list-page> for accessibility issues
|
||||||
|
// Disable heading-order checks until it is fixed
|
||||||
|
cy.checkA11y('ds-community-list-page',
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
'heading-order': { enabled: false }
|
||||||
|
}
|
||||||
|
} as Options
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
23
cypress/integration/community-page.spec.ts
Normal file
23
cypress/integration/community-page.spec.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { Options } from "cypress-axe";
|
||||||
|
import { TEST_COMMUNITY } from "cypress/support";
|
||||||
|
|
||||||
|
describe('Community Page', () => {
|
||||||
|
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.visit('/communities/' + TEST_COMMUNITY);
|
||||||
|
cy.injectAxe();
|
||||||
|
|
||||||
|
// <ds-community-page> tag must be loaded
|
||||||
|
cy.get('ds-community-page').should('exist');
|
||||||
|
|
||||||
|
// Analyze <ds-community-page> for accessibility issues
|
||||||
|
// Disable color-contrast checks until it is fixed (see #1202 and #1178)
|
||||||
|
cy.checkA11y('ds-community-page',
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
'color-contrast': { enabled: false }
|
||||||
|
}
|
||||||
|
} as Options
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
32
cypress/integration/community-statistics.spec.ts
Normal file
32
cypress/integration/community-statistics.spec.ts
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import { TEST_COMMUNITY } from "cypress/support";
|
||||||
|
|
||||||
|
describe('Community Statistics Page', () => {
|
||||||
|
const COMMUNITYSTATISTICSPAGE = '/statistics/communities/' + TEST_COMMUNITY;
|
||||||
|
|
||||||
|
it('should load if you click on "Statistics" from a Community page', () => {
|
||||||
|
cy.visit('/communities/' + TEST_COMMUNITY);
|
||||||
|
cy.get('ds-navbar ds-link-menu-item a[title="Statistics"]').click();
|
||||||
|
cy.location('pathname').should('eq', COMMUNITYSTATISTICSPAGE);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should contain a "Total visits" section', () => {
|
||||||
|
cy.visit(COMMUNITYSTATISTICSPAGE);
|
||||||
|
cy.get('.' + TEST_COMMUNITY + '_TotalVisits').should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should contain a "Total visits per month" section', () => {
|
||||||
|
cy.visit(COMMUNITYSTATISTICSPAGE);
|
||||||
|
cy.get('.' + TEST_COMMUNITY + '_TotalVisitsPerMonth').should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.visit(COMMUNITYSTATISTICSPAGE);
|
||||||
|
cy.injectAxe();
|
||||||
|
|
||||||
|
// <ds-community-statistics-page> tag must be loaded
|
||||||
|
cy.get('ds-community-statistics-page').should('exist');
|
||||||
|
|
||||||
|
// Analyze <ds-community-statistics-page> for accessibility issues
|
||||||
|
cy.checkA11y('ds-community-statistics-page');
|
||||||
|
});
|
||||||
|
});
|
12
cypress/integration/footer.spec.ts
Normal file
12
cypress/integration/footer.spec.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
describe('Footer', () => {
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.visit('/');
|
||||||
|
cy.injectAxe();
|
||||||
|
|
||||||
|
// Footer must first be visible
|
||||||
|
cy.get('ds-footer').should('be.visible');
|
||||||
|
|
||||||
|
// Analyze <ds-footer> for accessibility
|
||||||
|
cy.checkA11y('ds-footer');
|
||||||
|
});
|
||||||
|
});
|
18
cypress/integration/header.spec.ts
Normal file
18
cypress/integration/header.spec.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
describe('Header', () => {
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.visit('/');
|
||||||
|
cy.injectAxe();
|
||||||
|
|
||||||
|
// Header must first be visible
|
||||||
|
cy.get('ds-header').should('be.visible');
|
||||||
|
|
||||||
|
// Analyze <ds-header> for accessibility
|
||||||
|
cy.checkA11y({
|
||||||
|
include: ['ds-header'],
|
||||||
|
exclude: [
|
||||||
|
['#search-navbar-container'], // search in navbar has duplicative ID. Will be fixed in #1174
|
||||||
|
['.dropdownLogin'] // "Log in" link has color contrast issues. Will be fixed in #1149
|
||||||
|
],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
18
cypress/integration/homepage-statistics.spec.ts
Normal file
18
cypress/integration/homepage-statistics.spec.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
describe('Site Statistics Page', () => {
|
||||||
|
it('should load if you click on "Statistics" from homepage', () => {
|
||||||
|
cy.visit('/');
|
||||||
|
cy.get('ds-navbar ds-link-menu-item a[title="Statistics"]').click();
|
||||||
|
cy.location('pathname').should('eq', '/statistics');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.visit('/statistics');
|
||||||
|
cy.injectAxe();
|
||||||
|
|
||||||
|
// <ds-site-statistics-page> tag must be loaded
|
||||||
|
cy.get('ds-site-statistics-page').should('exist');
|
||||||
|
|
||||||
|
// Analyze <ds-site-statistics-page> for accessibility issues
|
||||||
|
cy.checkA11y('ds-site-statistics-page');
|
||||||
|
});
|
||||||
|
});
|
@@ -20,18 +20,13 @@ describe('Homepage', () => {
|
|||||||
cy.url().should('include', 'query=' + encodeURI(queryString));
|
cy.url().should('include', 'query=' + encodeURI(queryString));
|
||||||
});
|
});
|
||||||
|
|
||||||
// it('should pass accessibility tests', () => {
|
it('should pass accessibility tests', () => {
|
||||||
// // first must inject Axe into current page
|
cy.injectAxe();
|
||||||
// cy.injectAxe();
|
|
||||||
|
|
||||||
// // Analyze entire page for accessibility issues
|
// Wait for homepage tag to appear
|
||||||
// // NOTE: this test checks accessibility of header/footer as well
|
cy.get('ds-home-page').should('be.visible');
|
||||||
// cy.checkA11y({
|
|
||||||
// exclude: [
|
// Analyze <ds-home-page> for accessibility issues
|
||||||
// ['#klaro'], // Klaro plugin (privacy policy popup) has color contrast issues
|
cy.checkA11y('ds-home-page');
|
||||||
// ['#search-navbar-container'], // search in navbar has duplicative ID. Will be fixed in #1174
|
});
|
||||||
// ['.dropdownLogin'] // "Log in" link in header has color contrast issues
|
|
||||||
// ],
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
});
|
});
|
||||||
|
@@ -1,15 +1,31 @@
|
|||||||
describe('Item Page', () => {
|
import { Options } from "cypress-axe";
|
||||||
const ITEMPAGE = '/items/e98b0f27-5c19-49a0-960d-eb6ad5287067';
|
import { TEST_ENTITY_PUBLICATION } from "cypress/support";
|
||||||
const ENTITYPAGE = '/entities/publication/e98b0f27-5c19-49a0-960d-eb6ad5287067';
|
|
||||||
|
|
||||||
it('should contain element ds-item-page when navigating to an item page', () => {
|
describe('Item Page', () => {
|
||||||
cy.visit(ENTITYPAGE);
|
const ITEMPAGE = '/items/' + TEST_ENTITY_PUBLICATION;
|
||||||
cy.get('ds-item-page').should('exist');
|
const ENTITYPAGE = '/entities/publication/' + TEST_ENTITY_PUBLICATION;
|
||||||
});
|
|
||||||
|
|
||||||
// Test that entities will redirect to /entities/[type]/[uuid] when accessed via /items/[uuid]
|
// Test that entities will redirect to /entities/[type]/[uuid] when accessed via /items/[uuid]
|
||||||
it('should redirect to the entity page when navigating to an item page', () => {
|
it('should redirect to the entity page when navigating to an item page', () => {
|
||||||
cy.visit(ITEMPAGE);
|
cy.visit(ITEMPAGE);
|
||||||
cy.location('pathname').should('eq', ENTITYPAGE);
|
cy.location('pathname').should('eq', ENTITYPAGE);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.visit(ENTITYPAGE);
|
||||||
|
cy.injectAxe();
|
||||||
|
|
||||||
|
// <ds-item-page> tag must be loaded
|
||||||
|
cy.get('ds-item-page').should('exist');
|
||||||
|
|
||||||
|
// Analyze <ds-item-page> for accessibility issues
|
||||||
|
// Disable heading-order checks until it is fixed
|
||||||
|
cy.checkA11y('ds-item-page',
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
'heading-order': { enabled: false }
|
||||||
|
}
|
||||||
|
} as Options
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,6 +1,13 @@
|
|||||||
|
import { TEST_ENTITY_PUBLICATION } from "cypress/support";
|
||||||
|
|
||||||
describe('Item Statistics Page', () => {
|
describe('Item Statistics Page', () => {
|
||||||
const ITEMUUID = 'e98b0f27-5c19-49a0-960d-eb6ad5287067';
|
const ITEMSTATISTICSPAGE = '/statistics/items/' + TEST_ENTITY_PUBLICATION;
|
||||||
const ITEMSTATISTICSPAGE = '/statistics/items/' + ITEMUUID;
|
|
||||||
|
it('should load if you click on "Statistics" from an Item/Entity page', () => {
|
||||||
|
cy.visit('/entities/publication/' + TEST_ENTITY_PUBLICATION);
|
||||||
|
cy.get('ds-navbar ds-link-menu-item a[title="Statistics"]').click();
|
||||||
|
cy.location('pathname').should('eq', ITEMSTATISTICSPAGE);
|
||||||
|
});
|
||||||
|
|
||||||
it('should contain element ds-item-statistics-page when navigating to an item statistics page', () => {
|
it('should contain element ds-item-statistics-page when navigating to an item statistics page', () => {
|
||||||
cy.visit(ITEMSTATISTICSPAGE);
|
cy.visit(ITEMSTATISTICSPAGE);
|
||||||
@@ -8,18 +15,24 @@ describe('Item Statistics Page', () => {
|
|||||||
cy.get('ds-item-page').should('not.exist');
|
cy.get('ds-item-page').should('not.exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should contain the item statistics page url when navigating to an item statistics page', () => {
|
|
||||||
cy.visit(ITEMSTATISTICSPAGE);
|
|
||||||
cy.location('pathname').should('eq', ITEMSTATISTICSPAGE);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should contain a "Total visits" section', () => {
|
it('should contain a "Total visits" section', () => {
|
||||||
cy.visit(ITEMSTATISTICSPAGE);
|
cy.visit(ITEMSTATISTICSPAGE);
|
||||||
cy.get('.' + ITEMUUID + '_TotalVisits').should('exist');
|
cy.get('.' + TEST_ENTITY_PUBLICATION + '_TotalVisits').should('exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should contain a "Total visits per month" section', () => {
|
it('should contain a "Total visits per month" section', () => {
|
||||||
cy.visit(ITEMSTATISTICSPAGE);
|
cy.visit(ITEMSTATISTICSPAGE);
|
||||||
cy.get('.' + ITEMUUID + '_TotalVisitsPerMonth').should('exist');
|
cy.get('.' + TEST_ENTITY_PUBLICATION + '_TotalVisitsPerMonth').should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.visit(ITEMSTATISTICSPAGE);
|
||||||
|
cy.injectAxe();
|
||||||
|
|
||||||
|
// <ds-item-statistics-page> tag must be loaded
|
||||||
|
cy.get('ds-item-statistics-page').should('exist');
|
||||||
|
|
||||||
|
// Analyze <ds-item-statistics-page> for accessibility issues
|
||||||
|
cy.checkA11y('ds-item-statistics-page');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -19,3 +19,8 @@
|
|||||||
// Import Cypress Axe tools for all tests
|
// Import Cypress Axe tools for all tests
|
||||||
// https://github.com/component-driven/cypress-axe
|
// https://github.com/component-driven/cypress-axe
|
||||||
import 'cypress-axe';
|
import 'cypress-axe';
|
||||||
|
|
||||||
|
// Global constants used in tests
|
||||||
|
export const TEST_COLLECTION = '282164f5-d325-4740-8dd1-fa4d6d3e7200';
|
||||||
|
export const TEST_COMMUNITY = '0958c910-2037-42a9-81c7-dca80e3892b4';
|
||||||
|
export const TEST_ENTITY_PUBLICATION = 'e98b0f27-5c19-49a0-960d-eb6ad5287067';
|
Reference in New Issue
Block a user