|
| 1 | +import { testA11y } from 'cypress/support/utils'; |
| 2 | + |
| 3 | +const COLLECTION_EDIT_PAGE = '/collections/'.concat(Cypress.env('DSPACE_TEST_COLLECTION')).concat('/edit'); |
| 4 | + |
| 5 | +beforeEach(() => { |
| 6 | + // All tests start with visiting the Edit Collection Page |
| 7 | + cy.visit(COLLECTION_EDIT_PAGE); |
| 8 | + |
| 9 | + // This page is restricted, so we will be shown the login form. Fill it out & submit. |
| 10 | + cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); |
| 11 | +}); |
| 12 | + |
| 13 | +describe('Edit Collection > Edit Metadata tab', () => { |
| 14 | + it('should pass accessibility tests', () => { |
| 15 | + // <ds-edit-collection> tag must be loaded |
| 16 | + cy.get('ds-edit-collection').should('be.visible'); |
| 17 | + |
| 18 | + // Analyze <ds-edit-collection> for accessibility issues |
| 19 | + testA11y('ds-edit-collection'); |
| 20 | + }); |
| 21 | +}); |
| 22 | + |
| 23 | +describe('Edit Collection > Assign Roles tab', () => { |
| 24 | + |
| 25 | + it('should pass accessibility tests', () => { |
| 26 | + cy.get('a[data-test="roles"]').click(); |
| 27 | + |
| 28 | + // <ds-collection-roles> tag must be loaded |
| 29 | + cy.get('ds-collection-roles').should('be.visible'); |
| 30 | + |
| 31 | + // Analyze for accessibility issues |
| 32 | + testA11y('ds-collection-roles'); |
| 33 | + }); |
| 34 | +}); |
| 35 | + |
| 36 | +describe('Edit Collection > Content Source tab', () => { |
| 37 | + |
| 38 | + it('should pass accessibility tests', () => { |
| 39 | + cy.get('a[data-test="source"]').click(); |
| 40 | + |
| 41 | + // <ds-collection-source> tag must be loaded |
| 42 | + cy.get('ds-collection-source').should('be.visible'); |
| 43 | + |
| 44 | + // Check the external source checkbox (to display all fields on the page) |
| 45 | + cy.get('#externalSourceCheck').check(); |
| 46 | + |
| 47 | + // Wait for the source controls to appear |
| 48 | + cy.get('ds-collection-source-controls').should('be.visible'); |
| 49 | + |
| 50 | + // Analyze entire page for accessibility issues |
| 51 | + testA11y('ds-collection-source'); |
| 52 | + }); |
| 53 | +}); |
| 54 | + |
| 55 | +describe('Edit Collection > Curate tab', () => { |
| 56 | + |
| 57 | + it('should pass accessibility tests', () => { |
| 58 | + cy.get('a[data-test="curate"]').click(); |
| 59 | + |
| 60 | + // <ds-collection-curate> tag must be loaded |
| 61 | + cy.get('ds-collection-curate').should('be.visible'); |
| 62 | + |
| 63 | + // Analyze for accessibility issues |
| 64 | + testA11y('ds-collection-curate'); |
| 65 | + }); |
| 66 | +}); |
| 67 | + |
| 68 | +describe('Edit Collection > Access Control tab', () => { |
| 69 | + |
| 70 | + it('should pass accessibility tests', () => { |
| 71 | + cy.get('a[data-test="access-control"]').click(); |
| 72 | + |
| 73 | + // <ds-collection-access-control> tag must be loaded |
| 74 | + cy.get('ds-collection-access-control').should('be.visible'); |
| 75 | + |
| 76 | + // Analyze for accessibility issues |
| 77 | + testA11y('ds-collection-access-control'); |
| 78 | + }); |
| 79 | +}); |
| 80 | + |
| 81 | +describe('Edit Collection > Authorizations tab', () => { |
| 82 | + |
| 83 | + it('should pass accessibility tests', () => { |
| 84 | + cy.get('a[data-test="authorizations"]').click(); |
| 85 | + |
| 86 | + // <ds-collection-authorizations> tag must be loaded |
| 87 | + cy.get('ds-collection-authorizations').should('be.visible'); |
| 88 | + |
| 89 | + // Analyze for accessibility issues |
| 90 | + testA11y('ds-collection-authorizations'); |
| 91 | + }); |
| 92 | +}); |
| 93 | + |
| 94 | +describe('Edit Collection > Item Mapper tab', () => { |
| 95 | + |
| 96 | + it('should pass accessibility tests', () => { |
| 97 | + cy.get('a[data-test="mapper"]').click(); |
| 98 | + |
| 99 | + // <ds-collection-item-mapper> tag must be loaded |
| 100 | + cy.get('ds-collection-item-mapper').should('be.visible'); |
| 101 | + |
| 102 | + // Analyze entire page for accessibility issues |
| 103 | + testA11y('ds-collection-item-mapper'); |
| 104 | + |
| 105 | + // Click on the "Map new Items" tab |
| 106 | + cy.get('li[data-test="mapTab"] a').click(); |
| 107 | + |
| 108 | + // Make sure search form is now visible |
| 109 | + cy.get('ds-search-form').should('be.visible'); |
| 110 | + |
| 111 | + // Analyze entire page (again) for accessibility issues |
| 112 | + testA11y('ds-collection-item-mapper'); |
| 113 | + }); |
| 114 | +}); |
| 115 | + |
| 116 | + |
| 117 | +describe('Edit Collection > Delete page', () => { |
| 118 | + |
| 119 | + it('should pass accessibility tests', () => { |
| 120 | + cy.get('a[data-test="delete-button"]').click(); |
| 121 | + |
| 122 | + // <ds-delete-collection> tag must be loaded |
| 123 | + cy.get('ds-delete-collection').should('be.visible'); |
| 124 | + |
| 125 | + // Analyze for accessibility issues |
| 126 | + testA11y('ds-delete-collection'); |
| 127 | + }); |
| 128 | +}); |
0 commit comments