From a2882b064476950861f310ad1d24c0dd730b5eef Mon Sep 17 00:00:00 2001 From: Andreas Awouters Date: Fri, 7 Mar 2025 10:34:14 +0100 Subject: [PATCH] 119602: Set all cookies before e2e specs --- cypress.config.ts | 1 + cypress/support/e2e.ts | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cypress.config.ts b/cypress.config.ts index 36d8120342..253644deab 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -34,6 +34,7 @@ export default defineConfig({ 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_UUID: '914955b1-cf2e-4884-8af7-a166aa24cf73', DSPACE_TEST_SUBMIT_USER_PASSWORD: 'dspace', // Administrator users group DSPACE_ADMINISTRATOR_GROUP: 'e59f5659-bff9-451e-b28f-439e7bd467e4' diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index e1785d82de..3d1a67f165 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -54,9 +54,12 @@ before(() => { // Runs once before the first test in each "block" beforeEach(() => { - // Pre-agree to all Orejime cookies by setting the orejime-anonymous cookie + // Pre-agree to all Orejime cookies by setting the orejime-* cookies // This just ensures it doesn't get in the way of matching other objects in the page. - cy.setCookie('orejime-anonymous', '{"authentication":true,"preferences":true,"acknowledgement":true,"google-analytics":true,"accessibility":true}'); + const cookieContent = '{"authentication":true,"preferences":true,"acknowledgement":true,"google-analytics":true,"accessibility":true}'; + cy.setCookie('orejime-anonymous', cookieContent); + cy.setCookie(`orejime-${Cypress.env('DSPACE_TEST_ADMIN_USER_UUID')}`, cookieContent); + cy.setCookie(`orejime-${Cypress.env('DSPACE_TEST_SUBMIT_USER_UUID')}`, cookieContent); // Remove any CSRF cookies saved from prior tests cy.clearCookie(DSPACE_XSRF_COOKIE);