Commits
Tim Donohue authored and GitHub committed 340cc0aa3f4 Merge
1 1 | import { Options } from 'cypress-axe'; |
2 2 | import { TEST_SUBMIT_USER, TEST_SUBMIT_USER_PASSWORD, TEST_SUBMIT_COLLECTION_NAME } from 'cypress/support'; |
3 3 | import { testA11y } from 'cypress/support/utils'; |
4 4 | |
5 5 | describe('My DSpace page', () => { |
6 6 | it('should display recent submissions and pass accessibility tests', () => { |
7 - | cy.login(TEST_SUBMIT_USER, TEST_SUBMIT_USER_PASSWORD); |
8 - | |
9 7 | cy.visit('/mydspace'); |
10 8 | |
9 + | // This page is restricted, so we will be shown the login form. Fill it out & submit. |
10 + | cy.loginViaForm(TEST_SUBMIT_USER, TEST_SUBMIT_USER_PASSWORD); |
11 + | |
11 12 | cy.get('ds-my-dspace-page').should('exist'); |
12 13 | |
13 14 | // At least one recent submission should be displayed |
14 15 | cy.get('[data-test="list-object"]').should('be.visible'); |
15 16 | |
16 17 | // Click each filter toggle to open *every* filter |
17 18 | // (As we want to scan filter section for accessibility issues as well) |
18 19 | cy.get('.filter-toggle').click({ multiple: true }); |
19 20 | |
20 21 | // Analyze <ds-my-dspace-page> for accessibility issues |
29 30 | rules: { |
30 31 | // Search filters fail these two "moderate" impact rules |
31 32 | 'heading-order': { enabled: false }, |
32 33 | 'landmark-unique': { enabled: false } |
33 34 | } |
34 35 | } as Options |
35 36 | ); |
36 37 | }); |
37 38 | |
38 39 | it('should have a working detailed view that passes accessibility tests', () => { |
39 - | cy.login(TEST_SUBMIT_USER, TEST_SUBMIT_USER_PASSWORD); |
40 - | |
41 40 | cy.visit('/mydspace'); |
42 41 | |
42 + | // This page is restricted, so we will be shown the login form. Fill it out & submit. |
43 + | cy.loginViaForm(TEST_SUBMIT_USER, TEST_SUBMIT_USER_PASSWORD); |
44 + | |
43 45 | cy.get('ds-my-dspace-page').should('exist'); |
44 46 | |
45 47 | // Click button in sidebar to display detailed view |
46 48 | cy.get('ds-search-sidebar [data-test="detail-view"]').click(); |
47 49 | |
48 50 | cy.get('ds-object-detail').should('exist'); |
49 51 | |
50 52 | // Analyze <ds-search-page> for accessibility issues |
51 53 | testA11y('ds-my-dspace-page', |
52 54 | { |
53 55 | rules: { |
54 56 | // Search filters fail these two "moderate" impact rules |
55 57 | 'heading-order': { enabled: false }, |
56 58 | 'landmark-unique': { enabled: false } |
57 59 | } |
58 60 | } as Options |
59 61 | ); |
60 62 | }); |
61 63 | |
62 64 | // NOTE: Deleting existing submissions is exercised by submission.spec.ts |
63 65 | it('should let you start a new submission & edit in-progress submissions', () => { |
64 - | cy.login(TEST_SUBMIT_USER, TEST_SUBMIT_USER_PASSWORD); |
65 66 | cy.visit('/mydspace'); |
66 67 | |
68 + | // This page is restricted, so we will be shown the login form. Fill it out & submit. |
69 + | cy.loginViaForm(TEST_SUBMIT_USER, TEST_SUBMIT_USER_PASSWORD); |
70 + | |
67 71 | // Open the New Submission dropdown |
68 72 | cy.get('button[data-test="submission-dropdown"]').click(); |
69 73 | // Click on the "Item" type in that dropdown |
70 74 | cy.get('#entityControlsDropdownMenu button[title="none"]').click(); |
71 75 | |
72 76 | // This should display the <ds-create-item-parent-selector> (popup window) |
73 77 | cy.get('ds-create-item-parent-selector').should('be.visible'); |
74 78 | |
75 79 | // Type in a known Collection name in the search box |
76 80 | cy.get('ds-authorized-collection-selector input[type="search"]').type(TEST_SUBMIT_COLLECTION_NAME); |
124 128 | // Discard our new submission by clicking Discard in Submission form & confirming |
125 129 | cy.get('ds-submission-form-footer [data-test="discard"]').click(); |
126 130 | cy.get('button#discard_submit').click(); |
127 131 | |
128 132 | // Discarding should send us back to MyDSpace |
129 133 | cy.url().should('include', '/mydspace'); |
130 134 | }); |
131 135 | }); |
132 136 | |
133 137 | it('should let you import from external sources', () => { |
134 - | cy.login(TEST_SUBMIT_USER, TEST_SUBMIT_USER_PASSWORD); |
135 138 | cy.visit('/mydspace'); |
136 139 | |
140 + | // This page is restricted, so we will be shown the login form. Fill it out & submit. |
141 + | cy.loginViaForm(TEST_SUBMIT_USER, TEST_SUBMIT_USER_PASSWORD); |
142 + | |
137 143 | // Open the New Import dropdown |
138 144 | cy.get('button[data-test="import-dropdown"]').click(); |
139 145 | // Click on the "Item" type in that dropdown |
140 146 | cy.get('#importControlsDropdownMenu button[title="none"]').click(); |
141 147 | |
142 148 | // New URL should include /import-external, as we've moved to the import page |
143 149 | cy.url().should('include', '/import-external'); |
144 150 | |
145 151 | // The external import searchbox should be visible |
146 152 | cy.get('ds-submission-import-external-searchbar').should('be.visible'); |