Skip to content

Commit a5a89a4

Browse files
committed
Add environment variable for Person collection name. Use it in submission e2e tests.
1 parent 0aaf313 commit a5a89a4

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

cypress.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ export default defineConfig({
2525
DSPACE_TEST_ENTITY_PUBLICATION: '6160810f-1e53-40db-81ef-f6621a727398',
2626
// Search term (should return results) used in search tests
2727
DSPACE_TEST_SEARCH_TERM: 'test',
28-
// Collection used for submission tests
28+
// Main Collection used for submission tests. Should be able to accept normal Item objects
2929
DSPACE_TEST_SUBMIT_COLLECTION_NAME: 'Sample Collection',
3030
DSPACE_TEST_SUBMIT_COLLECTION_UUID: '9d8334e9-25d3-4a67-9cea-3dffdef80144',
31+
// Collection used for Person entity submission tests. MUST be configured with EntityType=Person.
32+
DSPACE_TEST_SUBMIT_PERSON_COLLECTION_NAME: 'People',
3133
// Account used to test basic submission process
3234
DSPACE_TEST_SUBMIT_USER: 'dspacedemo+submit@gmail.com',
3335
DSPACE_TEST_SUBMIT_USER_PASSWORD: 'dspace',

cypress/e2e/submission.cy.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,21 @@ describe('New Submission page', () => {
168168
// This should display the <ds-create-item-parent-selector> (popup window)
169169
cy.get('ds-create-item-parent-selector').should('be.visible');
170170

171-
// Click on the first Collection button to seelect a collection (actual collection doesn't matter)
172-
cy.get('ds-authorized-collection-selector button:first-child').click();
171+
// Type in a known Collection name in the search box
172+
cy.get('ds-authorized-collection-selector input[type="search"]').type(Cypress.env('DSPACE_TEST_SUBMIT_PERSON_COLLECTION_NAME'));
173+
174+
// Click on the button matching that known Collection name
175+
cy.get('ds-authorized-collection-selector button[title="'.concat(Cypress.env('DSPACE_TEST_SUBMIT_PERSON_COLLECTION_NAME')).concat('"]')).click();
173176

174177
// New URL should include /workspaceitems, as we've started a new submission
175178
cy.url().should('include', '/workspaceitems');
176179

177180
// The Submission edit form tag should be visible
178181
cy.get('ds-submission-edit').should('be.visible');
179182

183+
// A Collection menu button should exist & its value should be the selected collection
184+
cy.get('#collectionControlsMenuButton span').should('have.text', Cypress.env('DSPACE_TEST_SUBMIT_PERSON_COLLECTION_NAME'));
185+
180186
// 3 sections should be visible by default
181187
cy.get('div#section_personStep').should('be.visible');
182188
cy.get('div#section_upload').should('be.visible');

0 commit comments

Comments
 (0)