|
| 1 | +import { testA11y } from 'cypress/support/utils'; |
| 2 | + |
| 3 | +const COMMUNITY_EDIT_PAGE = '/communities/'.concat(Cypress.env('DSPACE_TEST_COMMUNITY')).concat('/edit'); |
| 4 | + |
| 5 | +beforeEach(() => { |
| 6 | + // All tests start with visiting the Edit Community Page |
| 7 | + cy.visit(COMMUNITY_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 Community > Edit Metadata tab', () => { |
| 14 | + it('should pass accessibility tests', () => { |
| 15 | + // <ds-edit-community> tag must be loaded |
| 16 | + cy.get('ds-edit-community').should('be.visible'); |
| 17 | + |
| 18 | + // Analyze <ds-edit-community> for accessibility issues |
| 19 | + testA11y('ds-edit-community'); |
| 20 | + }); |
| 21 | +}); |
| 22 | + |
| 23 | +describe('Edit Community > Assign Roles tab', () => { |
| 24 | + |
| 25 | + it('should pass accessibility tests', () => { |
| 26 | + cy.get('a[data-test="roles"]').click(); |
| 27 | + |
| 28 | + // <ds-community-roles> tag must be loaded |
| 29 | + cy.get('ds-community-roles').should('be.visible'); |
| 30 | + |
| 31 | + // Analyze for accessibility issues |
| 32 | + testA11y('ds-community-roles'); |
| 33 | + }); |
| 34 | +}); |
| 35 | + |
| 36 | +describe('Edit Community > Curate tab', () => { |
| 37 | + |
| 38 | + it('should pass accessibility tests', () => { |
| 39 | + cy.get('a[data-test="curate"]').click(); |
| 40 | + |
| 41 | + // <ds-community-curate> tag must be loaded |
| 42 | + cy.get('ds-community-curate').should('be.visible'); |
| 43 | + |
| 44 | + // Analyze for accessibility issues |
| 45 | + testA11y('ds-community-curate'); |
| 46 | + }); |
| 47 | +}); |
| 48 | + |
| 49 | +describe('Edit Community > Access Control tab', () => { |
| 50 | + |
| 51 | + it('should pass accessibility tests', () => { |
| 52 | + cy.get('a[data-test="access-control"]').click(); |
| 53 | + |
| 54 | + // <ds-community-access-control> tag must be loaded |
| 55 | + cy.get('ds-community-access-control').should('be.visible'); |
| 56 | + |
| 57 | + // Analyze for accessibility issues |
| 58 | + testA11y('ds-community-access-control'); |
| 59 | + }); |
| 60 | +}); |
| 61 | + |
| 62 | +describe('Edit Community > Authorizations tab', () => { |
| 63 | + |
| 64 | + it('should pass accessibility tests', () => { |
| 65 | + cy.get('a[data-test="authorizations"]').click(); |
| 66 | + |
| 67 | + // <ds-community-authorizations> tag must be loaded |
| 68 | + cy.get('ds-community-authorizations').should('be.visible'); |
| 69 | + |
| 70 | + // Analyze for accessibility issues |
| 71 | + testA11y('ds-community-authorizations'); |
| 72 | + }); |
| 73 | + |
| 74 | + it('should have an edit policy page which also passes accessibility tests', () => { |
| 75 | + cy.visit(COMMUNITY_EDIT_PAGE.concat('/authorizations')); |
| 76 | + |
| 77 | + cy.get('button[title="Edit policy"]').click(); |
| 78 | + |
| 79 | + // <ds-resource-policy-edit> tag must be loaded |
| 80 | + cy.get('ds-resource-policy-edit').should('be.visible'); |
| 81 | + |
| 82 | + // Analyze for accessibility issues |
| 83 | + testA11y('ds-resource-policy-edit'); |
| 84 | + }); |
| 85 | +}); |
| 86 | + |
| 87 | +describe('Edit Community > Delete page', () => { |
| 88 | + |
| 89 | + it('should pass accessibility tests', () => { |
| 90 | + cy.get('a[data-test="delete-button"]').click(); |
| 91 | + |
| 92 | + // <ds-delete-community> tag must be loaded |
| 93 | + cy.get('ds-delete-community').should('be.visible'); |
| 94 | + |
| 95 | + // Analyze for accessibility issues |
| 96 | + testA11y('ds-delete-community'); |
| 97 | + }); |
| 98 | +}); |
0 commit comments