From a5a89a4b985897a02a9ab4110ca0a02b8afdc6ad Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Wed, 17 Jan 2024 12:05:00 -0600 Subject: [PATCH] Add environment variable for Person collection name. Use it in submission e2e tests. --- cypress.config.ts | 4 +++- cypress/e2e/submission.cy.ts | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cypress.config.ts b/cypress.config.ts index 4143327870..458b035a48 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -25,9 +25,11 @@ export default defineConfig({ DSPACE_TEST_ENTITY_PUBLICATION: '6160810f-1e53-40db-81ef-f6621a727398', // Search term (should return results) used in search tests DSPACE_TEST_SEARCH_TERM: 'test', - // Collection used for submission tests + // Main Collection used for submission tests. Should be able to accept normal Item objects DSPACE_TEST_SUBMIT_COLLECTION_NAME: 'Sample Collection', DSPACE_TEST_SUBMIT_COLLECTION_UUID: '9d8334e9-25d3-4a67-9cea-3dffdef80144', + // Collection used for Person entity submission tests. MUST be configured with EntityType=Person. + DSPACE_TEST_SUBMIT_PERSON_COLLECTION_NAME: 'People', // Account used to test basic submission process DSPACE_TEST_SUBMIT_USER: 'dspacedemo+submit@gmail.com', DSPACE_TEST_SUBMIT_USER_PASSWORD: 'dspace', diff --git a/cypress/e2e/submission.cy.ts b/cypress/e2e/submission.cy.ts index 97676ca25c..4402410f23 100644 --- a/cypress/e2e/submission.cy.ts +++ b/cypress/e2e/submission.cy.ts @@ -168,8 +168,11 @@ describe('New Submission page', () => { // This should display the (popup window) cy.get('ds-create-item-parent-selector').should('be.visible'); - // Click on the first Collection button to seelect a collection (actual collection doesn't matter) - cy.get('ds-authorized-collection-selector button:first-child').click(); + // Type in a known Collection name in the search box + cy.get('ds-authorized-collection-selector input[type="search"]').type(Cypress.env('DSPACE_TEST_SUBMIT_PERSON_COLLECTION_NAME')); + + // Click on the button matching that known Collection name + cy.get('ds-authorized-collection-selector button[title="'.concat(Cypress.env('DSPACE_TEST_SUBMIT_PERSON_COLLECTION_NAME')).concat('"]')).click(); // New URL should include /workspaceitems, as we've started a new submission cy.url().should('include', '/workspaceitems'); @@ -177,6 +180,9 @@ describe('New Submission page', () => { // The Submission edit form tag should be visible cy.get('ds-submission-edit').should('be.visible'); + // A Collection menu button should exist & its value should be the selected collection + cy.get('#collectionControlsMenuButton span').should('have.text', Cypress.env('DSPACE_TEST_SUBMIT_PERSON_COLLECTION_NAME')); + // 3 sections should be visible by default cy.get('div#section_personStep').should('be.visible'); cy.get('div#section_upload').should('be.visible');