mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
[CST-15592] add interceptor for item edit page
This commit is contained in:
@@ -1,164 +1,145 @@
|
|||||||
import { Options } from 'cypress-axe';
|
|
||||||
import { testA11y } from 'cypress/support/utils';
|
import { testA11y } from 'cypress/support/utils';
|
||||||
|
import { Options } from 'cypress-axe';
|
||||||
|
|
||||||
const ITEM_EDIT_PAGE = '/items/'.concat(Cypress.env('DSPACE_TEST_ENTITY_PUBLICATION')).concat('/edit');
|
const ITEM_EDIT_PAGE = '/items/'.concat(Cypress.env('DSPACE_TEST_ENTITY_PUBLICATION')).concat('/edit');
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
// All tests start with visiting the Edit Item Page
|
// All tests start with visiting the Edit Item Page
|
||||||
cy.visit(ITEM_EDIT_PAGE);
|
cy.visit(ITEM_EDIT_PAGE);
|
||||||
|
|
||||||
// This page is restricted, so we will be shown the login form. Fill it out & submit.
|
// This page is restricted, so we will be shown the login form. Fill it out & submit.
|
||||||
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
|
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
|
||||||
|
|
||||||
|
// We need to wait for the correction types allowed for the item to be loaded to be sure that each tab is fully loaded.
|
||||||
|
// This because the edit item page causes often tests to fails due to timeout.
|
||||||
|
cy.intercept('GET', 'server/api/config/correctiontypes/search/findByItem*').as('correctionTypes');
|
||||||
|
cy.wait('@correctionTypes');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Edit Item > Edit Metadata tab', () => {
|
describe('Edit Item > Edit Metadata tab', () => {
|
||||||
it('should pass accessibility tests', () => {
|
it('should pass accessibility tests', () => {
|
||||||
cy.get('a[data-test="metadata"]').click();
|
cy.get('a[data-test="metadata"]').click();
|
||||||
|
|
||||||
// Our selected tab should be active
|
// <ds-edit-item-page> tag must be loaded
|
||||||
cy.get('a[data-test="metadata"]').should('have.class', 'active');
|
cy.get('ds-edit-item-page').should('be.visible');
|
||||||
|
|
||||||
// <ds-edit-item-page> tag must be loaded
|
// wait for all the ds-dso-edit-metadata-value components to be rendered
|
||||||
cy.get('ds-edit-item-page').should('be.visible');
|
cy.get('ds-dso-edit-metadata-value div[role="row"]').each(($row: HTMLDivElement) => {
|
||||||
|
cy.wrap($row).find('div[role="cell"]').should('be.visible');
|
||||||
// wait for all the ds-dso-edit-metadata-value components to be rendered
|
|
||||||
cy.get('ds-dso-edit-metadata-value div[role="row"]').each(($row: HTMLDivElement) => {
|
|
||||||
cy.wrap($row).find('div[role="cell"]').should('be.visible');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Analyze <ds-edit-item-page> for accessibility issues
|
|
||||||
testA11y('ds-edit-item-page');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Analyze <ds-edit-item-page> for accessibility issues
|
||||||
|
testA11y('ds-edit-item-page');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Edit Item > Status tab', () => {
|
describe('Edit Item > Status tab', () => {
|
||||||
|
|
||||||
it('should pass accessibility tests', () => {
|
it('should pass accessibility tests', () => {
|
||||||
cy.get('a[data-test="status"]').click();
|
cy.get('a[data-test="status"]').click();
|
||||||
|
|
||||||
// Our selected tab should be active
|
// <ds-item-status> tag must be loaded
|
||||||
cy.get('a[data-test="status"]').should('have.class', 'active');
|
cy.get('ds-item-status').should('be.visible');
|
||||||
|
|
||||||
// <ds-item-status> tag must be loaded
|
// Analyze for accessibility issues
|
||||||
cy.get('ds-item-status').should('be.visible');
|
testA11y('ds-item-status');
|
||||||
|
});
|
||||||
// Analyze for accessibility issues
|
|
||||||
testA11y('ds-item-status');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Edit Item > Bitstreams tab', () => {
|
describe('Edit Item > Bitstreams tab', () => {
|
||||||
|
|
||||||
it('should pass accessibility tests', () => {
|
it('should pass accessibility tests', () => {
|
||||||
cy.get('a[data-test="bitstreams"]').click();
|
cy.get('a[data-test="bitstreams"]').click();
|
||||||
|
|
||||||
// Our selected tab should be active
|
// <ds-item-bitstreams> tag must be loaded
|
||||||
cy.get('a[data-test="bitstreams"]').should('have.class', 'active');
|
cy.get('ds-item-bitstreams').should('be.visible');
|
||||||
|
|
||||||
// <ds-item-bitstreams> tag must be loaded
|
// Table of item bitstreams must also be loaded
|
||||||
cy.get('ds-item-bitstreams').should('be.visible');
|
cy.get('div.item-bitstreams').should('be.visible');
|
||||||
|
|
||||||
// Table of item bitstreams must also be loaded
|
// Analyze for accessibility issues
|
||||||
cy.get('div.item-bitstreams').should('be.visible');
|
testA11y('ds-item-bitstreams',
|
||||||
|
|
||||||
// Analyze for accessibility issues
|
|
||||||
testA11y('ds-item-bitstreams',
|
|
||||||
{
|
{
|
||||||
rules: {
|
rules: {
|
||||||
// Currently Bitstreams page loads a pagination component per Bundle
|
// Currently Bitstreams page loads a pagination component per Bundle
|
||||||
// and they all use the same 'id="p-dad"'.
|
// and they all use the same 'id="p-dad"'.
|
||||||
'duplicate-id': { enabled: false },
|
'duplicate-id': { enabled: false },
|
||||||
}
|
},
|
||||||
} as Options
|
} as Options,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Edit Item > Curate tab', () => {
|
describe('Edit Item > Curate tab', () => {
|
||||||
|
|
||||||
it('should pass accessibility tests', () => {
|
it('should pass accessibility tests', () => {
|
||||||
cy.get('a[data-test="curate"]').click();
|
cy.get('a[data-test="curate"]').click();
|
||||||
|
|
||||||
// Our selected tab should be active
|
// <ds-item-curate> tag must be loaded
|
||||||
cy.get('a[data-test="curate"]').should('have.class', 'active');
|
cy.get('ds-item-curate').should('be.visible');
|
||||||
|
|
||||||
// <ds-item-curate> tag must be loaded
|
// Analyze for accessibility issues
|
||||||
cy.get('ds-item-curate').should('be.visible');
|
testA11y('ds-item-curate');
|
||||||
|
});
|
||||||
// Analyze for accessibility issues
|
|
||||||
testA11y('ds-item-curate');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Edit Item > Relationships tab', () => {
|
describe('Edit Item > Relationships tab', () => {
|
||||||
|
|
||||||
it('should pass accessibility tests', () => {
|
it('should pass accessibility tests', () => {
|
||||||
cy.get('a[data-test="relationships"]').click();
|
cy.get('a[data-test="relationships"]').click();
|
||||||
|
|
||||||
// Our selected tab should be active
|
// <ds-item-relationships> tag must be loaded
|
||||||
cy.get('a[data-test="relationships"]').should('have.class', 'active');
|
cy.get('ds-item-relationships').should('be.visible');
|
||||||
|
|
||||||
// <ds-item-relationships> tag must be loaded
|
// Analyze for accessibility issues
|
||||||
cy.get('ds-item-relationships').should('be.visible');
|
testA11y('ds-item-relationships');
|
||||||
|
});
|
||||||
// Analyze for accessibility issues
|
|
||||||
testA11y('ds-item-relationships');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Edit Item > Version History tab', () => {
|
describe('Edit Item > Version History tab', () => {
|
||||||
|
|
||||||
it('should pass accessibility tests', () => {
|
it('should pass accessibility tests', () => {
|
||||||
cy.get('a[data-test="versionhistory"]').click();
|
cy.get('a[data-test="versionhistory"]').click();
|
||||||
|
|
||||||
// Our selected tab should be active
|
// <ds-item-version-history> tag must be loaded
|
||||||
cy.get('a[data-test="versionhistory"]').should('have.class', 'active');
|
cy.get('ds-item-version-history').should('be.visible');
|
||||||
|
|
||||||
// <ds-item-version-history> tag must be loaded
|
// Analyze for accessibility issues
|
||||||
cy.get('ds-item-version-history').should('be.visible');
|
testA11y('ds-item-version-history');
|
||||||
|
});
|
||||||
// Analyze for accessibility issues
|
|
||||||
testA11y('ds-item-version-history');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Edit Item > Access Control tab', () => {
|
describe('Edit Item > Access Control tab', () => {
|
||||||
|
|
||||||
it('should pass accessibility tests', () => {
|
it('should pass accessibility tests', () => {
|
||||||
cy.get('a[data-test="access-control"]').click();
|
cy.get('a[data-test="access-control"]').click();
|
||||||
|
|
||||||
// Our selected tab should be active
|
// <ds-item-access-control> tag must be loaded
|
||||||
cy.get('a[data-test="access-control"]').should('have.class', 'active');
|
cy.get('ds-item-access-control').should('be.visible');
|
||||||
|
|
||||||
// <ds-item-access-control> tag must be loaded
|
// Analyze for accessibility issues
|
||||||
cy.get('ds-item-access-control').should('be.visible');
|
testA11y('ds-item-access-control');
|
||||||
|
});
|
||||||
// Analyze for accessibility issues
|
|
||||||
testA11y('ds-item-access-control');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Edit Item > Collection Mapper tab', () => {
|
describe('Edit Item > Collection Mapper tab', () => {
|
||||||
|
|
||||||
it('should pass accessibility tests', () => {
|
it('should pass accessibility tests', () => {
|
||||||
cy.get('a[data-test="mapper"]').click();
|
cy.get('a[data-test="mapper"]').click();
|
||||||
|
|
||||||
// Our selected tab should be active
|
// <ds-item-collection-mapper> tag must be loaded
|
||||||
cy.get('a[data-test="mapper"]').should('have.class', 'active');
|
cy.get('ds-item-collection-mapper').should('be.visible');
|
||||||
|
|
||||||
// <ds-item-collection-mapper> tag must be loaded
|
// Analyze entire page for accessibility issues
|
||||||
cy.get('ds-item-collection-mapper').should('be.visible');
|
testA11y('ds-item-collection-mapper');
|
||||||
|
|
||||||
// Analyze entire page for accessibility issues
|
// Click on the "Map new collections" tab
|
||||||
testA11y('ds-item-collection-mapper');
|
cy.get('li[data-test="mapTab"] a').click();
|
||||||
|
|
||||||
// Click on the "Map new collections" tab
|
// Make sure search form is now visible
|
||||||
cy.get('li[data-test="mapTab"] a').click();
|
cy.get('ds-search-form').should('be.visible');
|
||||||
|
|
||||||
// Make sure search form is now visible
|
// Analyze entire page (again) for accessibility issues
|
||||||
cy.get('ds-search-form').should('be.visible');
|
testA11y('ds-item-collection-mapper');
|
||||||
|
});
|
||||||
// Analyze entire page (again) for accessibility issues
|
|
||||||
testA11y('ds-item-collection-mapper');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user