mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
Add accessibility tests for search/browse
This commit is contained in:
13
cypress/integration/browse-by-author.spec.ts
Normal file
13
cypress/integration/browse-by-author.spec.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { testA11y } from 'cypress/support/utils';
|
||||||
|
|
||||||
|
describe('Browse By Author', () => {
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.visit('/browse/author');
|
||||||
|
|
||||||
|
// Wait for <ds-browse-by-metadata-page> to be visible
|
||||||
|
cy.get('ds-browse-by-metadata-page').should('be.visible');
|
||||||
|
|
||||||
|
// Analyze <ds-browse-by-metadata-page> for accessibility
|
||||||
|
testA11y('ds-browse-by-metadata-page');
|
||||||
|
});
|
||||||
|
});
|
13
cypress/integration/browse-by-dateissued.spec.ts
Normal file
13
cypress/integration/browse-by-dateissued.spec.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { testA11y } from 'cypress/support/utils';
|
||||||
|
|
||||||
|
describe('Browse By Date Issued', () => {
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.visit('/browse/dateissued');
|
||||||
|
|
||||||
|
// Wait for <ds-browse-by-date-page> to be visible
|
||||||
|
cy.get('ds-browse-by-date-page').should('be.visible');
|
||||||
|
|
||||||
|
// Analyze <ds-browse-by-date-page> for accessibility
|
||||||
|
testA11y('ds-browse-by-date-page');
|
||||||
|
});
|
||||||
|
});
|
13
cypress/integration/browse-by-subject.spec.ts
Normal file
13
cypress/integration/browse-by-subject.spec.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { testA11y } from 'cypress/support/utils';
|
||||||
|
|
||||||
|
describe('Browse By Subject', () => {
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.visit('/browse/subject');
|
||||||
|
|
||||||
|
// Wait for <ds-browse-by-metadata-page> to be visible
|
||||||
|
cy.get('ds-browse-by-metadata-page').should('be.visible');
|
||||||
|
|
||||||
|
// Analyze <ds-browse-by-metadata-page> for accessibility
|
||||||
|
testA11y('ds-browse-by-metadata-page');
|
||||||
|
});
|
||||||
|
});
|
13
cypress/integration/browse-by-title.spec.ts
Normal file
13
cypress/integration/browse-by-title.spec.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { testA11y } from 'cypress/support/utils';
|
||||||
|
|
||||||
|
describe('Browse By Title', () => {
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.visit('/browse/title');
|
||||||
|
|
||||||
|
// Wait for <ds-browse-by-title-page> to be visible
|
||||||
|
cy.get('ds-browse-by-title-page').should('be.visible');
|
||||||
|
|
||||||
|
// Analyze <ds-browse-by-title-page> for accessibility
|
||||||
|
testA11y('ds-browse-by-title-page');
|
||||||
|
});
|
||||||
|
});
|
@@ -1,3 +1,6 @@
|
|||||||
|
import { Options } from 'cypress-axe';
|
||||||
|
import { testA11y } from 'cypress/support/utils';
|
||||||
|
|
||||||
describe('Search Page', () => {
|
describe('Search Page', () => {
|
||||||
// unique ID of the search form (for selecting specific elements below)
|
// unique ID of the search form (for selecting specific elements below)
|
||||||
const SEARCHFORM_ID = '#search-form';
|
const SEARCHFORM_ID = '#search-form';
|
||||||
@@ -16,4 +19,54 @@ describe('Search Page', () => {
|
|||||||
cy.get(SEARCHFORM_ID + ' button.search-button').click();
|
cy.get(SEARCHFORM_ID + ' button.search-button').click();
|
||||||
cy.url().should('include', 'query=' + encodeURI(queryString));
|
cy.url().should('include', 'query=' + encodeURI(queryString));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should pass accessibility tests', () => {
|
||||||
|
cy.visit('/search');
|
||||||
|
|
||||||
|
// <ds-search-page> tag must be loaded
|
||||||
|
cy.get('ds-search-page').should('exist');
|
||||||
|
|
||||||
|
// Click each filter toggle to open *every* filter
|
||||||
|
// (As we want to scan filter section for accessibility issues as well)
|
||||||
|
cy.get('.filter-toggle').click({ multiple: true });
|
||||||
|
|
||||||
|
// Analyze <ds-search-page> for accessibility issues
|
||||||
|
testA11y(
|
||||||
|
{
|
||||||
|
include: ['ds-search-page'],
|
||||||
|
exclude: [
|
||||||
|
['nouislider'] // Date filter slider is missing ARIA labels. Will be fixed by #1175
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
// Search filters fail these two "moderate" impact rules
|
||||||
|
'heading-order': { enabled: false },
|
||||||
|
'landmark-unique': { enabled: false }
|
||||||
|
}
|
||||||
|
} as Options
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should pass accessibility tests in Grid view', () => {
|
||||||
|
cy.visit('/search');
|
||||||
|
|
||||||
|
// Click to display grid view
|
||||||
|
// TODO: These buttons should likely have an easier way to uniquely select
|
||||||
|
cy.get('#search-sidebar-content > ds-view-mode-switch > .btn-group > [href="/search?spc.sf=score&spc.sd=DESC&view=grid"] > .fas').click();
|
||||||
|
|
||||||
|
// <ds-search-page> tag must be loaded
|
||||||
|
cy.get('ds-search-page').should('exist');
|
||||||
|
|
||||||
|
// Analyze <ds-search-page> for accessibility issues
|
||||||
|
testA11y('ds-search-page',
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
// Search filters fail these two "moderate" impact rules
|
||||||
|
'heading-order': { enabled: false },
|
||||||
|
'landmark-unique': { enabled: false }
|
||||||
|
}
|
||||||
|
} as Options
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user