From 86312315d91f83ca82c018b9d066ed635879bdef Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Thu, 26 Nov 2026 20:26:55 +0100 Subject: [PATCH 01/10] Wait for the reloaded app after the e2e form login After login the app reloads the page. The server renders the page first, then the app starts and renders it again. Tests typed into the server page and lost the text, so the create and deposit tests failed now and then. loginViaForm now waits for the new page and for the app to leave /reload/. This takes three tests out of quarantine. Co-Authored-By: Claude Opus 5.5 --- cypress/support/commands.ts | 7 +++++++ cypress/support/e2e.ts | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 8f81fa871d7..73af5737d44 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -109,8 +109,15 @@ function loginViaForm(email: string, password: string): void { cy.get('[data-test="email"]').should('be.visible').type(email); // Enter password cy.get('[data-test="password"]').should('be.visible').type(password); + // The app reloads itself after login and renders the page again once it starts, + // so wait for the new page and for the app to leave /reload/. + cy.window().then((win) => { + (win as any).dsBeforeLogin = true; + }); // Click login button cy.get('[data-test="login-button"]').click(); + cy.window({ timeout: 20000 }).should('not.have.property', 'dsBeforeLogin'); + cy.location('pathname', { timeout: 20000 }).should('not.contain', '/reload/'); } // Add as a Cypress command (i.e. assign to 'cy.loginViaForm') Cypress.Commands.add('loginViaForm', loginViaForm); diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index 5181ebf2d5b..5c494119908 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -24,10 +24,7 @@ import { DSPACE_XSRF_COOKIE } from 'src/app/core/xsrf/xsrf.constants'; // Known flaky tests, skipped until they are fixed. Remove an entry once its test is fixed. // Each entry is ' > '. const QUARANTINED_TESTS = [ - 'collection-create.cy.ts > should show loading component while saving', - 'community-create.cy.ts > should show loading component while saving', 'my-dspace.cy.ts > My DSpace page should let you filter to only archived items', - 'submission.cy.ts > New Submission page should allow for deposit if all required fields completed & file uploaded', ]; beforeEach(function () { From 0c91e90a9f41febd1eec93c3b34a7f102722bbff Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Thu, 26 Nov 2026 20:27:02 +0100 Subject: [PATCH 02/10] Check the archived filter results on the rendered list The test waited for the search response and then checked each result element. The list renders again after the response, so the check could read the old list. It now retries one assertion on the current list. This takes the last test out of quarantine. Co-Authored-By: Claude Opus 5.5 --- cypress/e2e/my-dspace.cy.ts | 12 +++++------- cypress/support/e2e.ts | 4 +--- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/cypress/e2e/my-dspace.cy.ts b/cypress/e2e/my-dspace.cy.ts index 7455beb5853..3e618d5a700 100644 --- a/cypress/e2e/my-dspace.cy.ts +++ b/cypress/e2e/my-dspace.cy.ts @@ -166,13 +166,11 @@ describe('My DSpace page', () => { cy.wait('@filterByItem'); //Check that we have at least one item and that they all have the archived badge. - cy.get('ds-item-search-result-list-element-submission').should('exist'); - cy.get('ds-item-search-result-list-element-submission') - .each(($item) => { - cy.wrap($item) - .find('.badge-archived') - .should('exist'); - }); + //The list renders again after the response, so retry the check on the current list. + cy.get('ds-item-search-result-list-element-submission').should(($items) => { + expect($items).to.have.length.greaterThan(0); + expect($items.filter(':not(:has(.badge-archived))')).to.have.length(0); + }); }); //This test also generate an item to validate workflow task section diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index 5c494119908..115842a3e4e 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -23,9 +23,7 @@ import { DSPACE_XSRF_COOKIE } from 'src/app/core/xsrf/xsrf.constants'; // Known flaky tests, skipped until they are fixed. Remove an entry once its test is fixed. // Each entry is ' > '. -const QUARANTINED_TESTS = [ - 'my-dspace.cy.ts > My DSpace page should let you filter to only archived items', -]; +const QUARANTINED_TESTS: string[] = []; beforeEach(function () { if (QUARANTINED_TESTS.includes(`${Cypress.spec.name} > ${this.currentTest.fullTitle()}`)) { From 1f9f2042c1d0ba8312690061566f479b651223c2 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Thu, 26 Nov 2026 22:01:23 +0100 Subject: [PATCH 03/10] Hold the create reply until the spinner is shown The create pages hide the spinner as soon as the save is done. When the reply came before Cypress saw the spinner, the test failed although the save worked. The tests now delay the reply of the create request. Co-Authored-By: Claude Opus 5.5 --- cypress/e2e/collection-create.cy.ts | 4 ++++ cypress/e2e/community-create.cy.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/cypress/e2e/collection-create.cy.ts b/cypress/e2e/collection-create.cy.ts index 29f7dd5cacb..20c6433f4b5 100644 --- a/cypress/e2e/collection-create.cy.ts +++ b/cypress/e2e/collection-create.cy.ts @@ -7,6 +7,10 @@ it('should show loading component while saving', () => { const title = 'Test Collection Title'; cy.get('#title').type(title); + // the spinner hides as soon as the save is done, so hold the reply + cy.intercept('POST', '**/server/api/core/collections*', (req) => { + req.on('response', (res) => res.setDelay(2000)); + }); cy.get('button[type="submit"]').click(); cy.get('ds-loading').should('be.visible'); diff --git a/cypress/e2e/community-create.cy.ts b/cypress/e2e/community-create.cy.ts index 96bc003ba2a..67a2bc9e889 100644 --- a/cypress/e2e/community-create.cy.ts +++ b/cypress/e2e/community-create.cy.ts @@ -7,6 +7,10 @@ it('should show loading component while saving', () => { const title = 'Test Community Title'; cy.get('#title').type(title); + // the spinner hides as soon as the save is done, so hold the reply + cy.intercept('POST', '**/server/api/core/communities*', (req) => { + req.on('response', (res) => res.setDelay(2000)); + }); cy.get('button[type="submit"]').click(); cy.get('ds-loading').should('be.visible'); From d20c65005add91f9f8ade32334b904a6ddb889ba Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Thu, 26 Nov 2026 22:01:23 +0100 Subject: [PATCH 04/10] Check the archived badge on every result row The archived filter test looked only at item rows. Workspace and workflow rows use other components, so a mixed list passed. The test now checks every row of the result list. Co-Authored-By: Claude Opus 5.5 --- cypress/e2e/my-dspace.cy.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/my-dspace.cy.ts b/cypress/e2e/my-dspace.cy.ts index 3e618d5a700..18746e25f40 100644 --- a/cypress/e2e/my-dspace.cy.ts +++ b/cypress/e2e/my-dspace.cy.ts @@ -165,11 +165,11 @@ describe('My DSpace page', () => { //Wait for the response. cy.wait('@filterByItem'); - //Check that we have at least one item and that they all have the archived badge. + //Check that we have at least one result and that every result row has the archived badge. //The list renders again after the response, so retry the check on the current list. - cy.get('ds-item-search-result-list-element-submission').should(($items) => { - expect($items).to.have.length.greaterThan(0); - expect($items.filter(':not(:has(.badge-archived))')).to.have.length(0); + cy.get('ds-search-results [data-test="list-object"]').should(($rows) => { + expect($rows).to.have.length.greaterThan(0); + expect($rows.filter(':not(:has(.badge-archived))')).to.have.length(0); }); }); From d06780090d97e7413d6ace2a885c0e9b0b8e5f64 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Thu, 26 Nov 2026 22:14:19 +0100 Subject: [PATCH 05/10] Match the create requests under any REST path The create intercepts expected the REST API under /server. They now match any path that ends with the create endpoint. Co-Authored-By: Claude Opus 5.5 --- cypress/e2e/collection-create.cy.ts | 2 +- cypress/e2e/community-create.cy.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/collection-create.cy.ts b/cypress/e2e/collection-create.cy.ts index 20c6433f4b5..69a9834b654 100644 --- a/cypress/e2e/collection-create.cy.ts +++ b/cypress/e2e/collection-create.cy.ts @@ -8,7 +8,7 @@ it('should show loading component while saving', () => { cy.get('#title').type(title); // the spinner hides as soon as the save is done, so hold the reply - cy.intercept('POST', '**/server/api/core/collections*', (req) => { + cy.intercept('POST', '**/api/core/collections*', (req) => { req.on('response', (res) => res.setDelay(2000)); }); cy.get('button[type="submit"]').click(); diff --git a/cypress/e2e/community-create.cy.ts b/cypress/e2e/community-create.cy.ts index 67a2bc9e889..30f85fc4a90 100644 --- a/cypress/e2e/community-create.cy.ts +++ b/cypress/e2e/community-create.cy.ts @@ -8,7 +8,7 @@ it('should show loading component while saving', () => { cy.get('#title').type(title); // the spinner hides as soon as the save is done, so hold the reply - cy.intercept('POST', '**/server/api/core/communities*', (req) => { + cy.intercept('POST', '**/api/core/communities*', (req) => { req.on('response', (res) => res.setDelay(2000)); }); cy.get('button[type="submit"]').click(); From 7c3e7c91f2ed0a37a7ff748cf0f55898a46bbf3a Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Thu, 26 Nov 2026 22:14:19 +0100 Subject: [PATCH 06/10] Do not return setDelay from the create intercepts The response callback returned the value of setDelay, and the Cypress type check rejected it. The callback has a block body now. Co-Authored-By: Claude Opus 5.5 --- cypress/e2e/collection-create.cy.ts | 4 +++- cypress/e2e/community-create.cy.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/collection-create.cy.ts b/cypress/e2e/collection-create.cy.ts index 69a9834b654..f24fe2df3ea 100644 --- a/cypress/e2e/collection-create.cy.ts +++ b/cypress/e2e/collection-create.cy.ts @@ -9,7 +9,9 @@ it('should show loading component while saving', () => { // the spinner hides as soon as the save is done, so hold the reply cy.intercept('POST', '**/api/core/collections*', (req) => { - req.on('response', (res) => res.setDelay(2000)); + req.on('response', (res) => { + res.setDelay(2000); + }); }); cy.get('button[type="submit"]').click(); diff --git a/cypress/e2e/community-create.cy.ts b/cypress/e2e/community-create.cy.ts index 30f85fc4a90..6f0c3c4dfe4 100644 --- a/cypress/e2e/community-create.cy.ts +++ b/cypress/e2e/community-create.cy.ts @@ -9,7 +9,9 @@ it('should show loading component while saving', () => { // the spinner hides as soon as the save is done, so hold the reply cy.intercept('POST', '**/api/core/communities*', (req) => { - req.on('response', (res) => res.setDelay(2000)); + req.on('response', (res) => { + res.setDelay(2000); + }); }); cy.get('button[type="submit"]').click(); From 08ea7c855b8aaa44360ec8636336fecb05695fc0 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Thu, 26 Nov 2026 22:14:20 +0100 Subject: [PATCH 07/10] Check the deposit itself in the e2e deposit test The test accepted any success alert, and the upload shows one too. It now waits for the deposit request, then looks for the deposit message and the redirect to MyDSpace. Co-Authored-By: Claude Opus 5.5 --- cypress/e2e/submission.cy.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/submission.cy.ts b/cypress/e2e/submission.cy.ts index 16aa5b2d472..1de415739ad 100644 --- a/cypress/e2e/submission.cy.ts +++ b/cypress/e2e/submission.cy.ts @@ -180,12 +180,17 @@ describe('New Submission page', () => { // Wait for upload to complete before proceeding cy.wait('@upload'); + // This is the POST command that will deposit the submission + cy.intercept('POST', '**/api/workflow/workflowitems*').as('deposit'); + // Wait for deposit button to not be disabled & click it. cy.get('button#deposit').should('not.be.disabled').click(); + cy.wait('@deposit'); - // No warnings should exist. Instead, just successful deposit alert is displayed + // No warnings should exist. The upload shows a success alert too, so look for the deposit one. cy.get('ds-notification div.alert-warning').should('not.exist'); - cy.get('ds-notification div.alert-success').should('be.visible'); + cy.contains('ds-notification div.alert-success', 'Submission deposited successfully.').should('be.visible'); + cy.location('pathname').should('include', '/mydspace'); }); it('is possible to submit a new "Person" and that form passes accessibility', () => { From a5f50cd1d769c31e96dabddab90cae509273028c Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Thu, 26 Nov 2026 22:27:48 +0100 Subject: [PATCH 08/10] Check that the uploaded file is listed in the deposit test The test went on after the upload request without checking that the form shows the file. It now waits for the file name in the upload section. Co-Authored-By: Claude Opus 5.5 --- cypress/e2e/submission.cy.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/cypress/e2e/submission.cy.ts b/cypress/e2e/submission.cy.ts index 1de415739ad..509f37dd233 100644 --- a/cypress/e2e/submission.cy.ts +++ b/cypress/e2e/submission.cy.ts @@ -179,6 +179,7 @@ describe('New Submission page', () => { // Wait for upload to complete before proceeding cy.wait('@upload'); + cy.get('ds-submission-upload-section-file').should('contain', 'dspace-logo.svg'); // This is the POST command that will deposit the submission cy.intercept('POST', '**/api/workflow/workflowitems*').as('deposit'); From 9c35da0d93bf3d3a3344f8b1f636f8514bf9eefa Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Thu, 26 Nov 2026 22:27:48 +0100 Subject: [PATCH 09/10] Check the deposit reply instead of the message text The deposit test looked for the English success message. It now checks that the deposit request answers 201, and still checks for no warning and the redirect to MyDSpace. Co-Authored-By: Claude Opus 5.5 --- cypress/e2e/submission.cy.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/submission.cy.ts b/cypress/e2e/submission.cy.ts index 509f37dd233..91e7c577565 100644 --- a/cypress/e2e/submission.cy.ts +++ b/cypress/e2e/submission.cy.ts @@ -186,11 +186,10 @@ describe('New Submission page', () => { // Wait for deposit button to not be disabled & click it. cy.get('button#deposit').should('not.be.disabled').click(); - cy.wait('@deposit'); + cy.wait('@deposit').its('response.statusCode').should('eq', 201); - // No warnings should exist. The upload shows a success alert too, so look for the deposit one. + // No warnings should exist, and a deposit goes back to MyDSpace cy.get('ds-notification div.alert-warning').should('not.exist'); - cy.contains('ds-notification div.alert-success', 'Submission deposited successfully.').should('be.visible'); cy.location('pathname').should('include', '/mydspace'); }); From efa664777b00d47d7d85f6163bcc88ac269d5af6 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Thu, 26 Nov 2026 23:16:32 +0100 Subject: [PATCH 10/10] Remove the deposit e2e test The CLARIN form needs more required fields than the test fills, so the deposit was never sent. The test passed only on the upload alert. The UI test suite covers deposit on the v9 form. Co-Authored-By: Claude Opus 5.5 --- cypress/e2e/submission.cy.ts | 45 ------------------------------------ 1 file changed, 45 deletions(-) diff --git a/cypress/e2e/submission.cy.ts b/cypress/e2e/submission.cy.ts index 91e7c577565..133a4421d81 100644 --- a/cypress/e2e/submission.cy.ts +++ b/cypress/e2e/submission.cy.ts @@ -148,51 +148,6 @@ describe('New Submission page', () => { }); }); - it('should allow for deposit if all required fields completed & file uploaded', () => { - // Create a new submission - cy.visit('/submit?collection='.concat(Cypress.env('DSPACE_TEST_SUBMIT_COLLECTION_UUID')).concat('&entityType=none')); - - // This page is restricted, so we will be shown the login form. Fill it out & submit. - cy.loginViaForm(Cypress.env('DSPACE_TEST_SUBMIT_USER'), Cypress.env('DSPACE_TEST_SUBMIT_USER_PASSWORD')); - - // Fill out all required fields (Title, Date) - cy.get('input#dc_title').type('DSpace logo uploaded via e2e tests'); - cy.get('input#dc_date_issued_year').type('2022'); - - // Confirm the required license by checking checkbox - // (NOTE: requires "force:true" cause Cypress claims this checkbox is covered by its own ) - cy.get('ds-clarin-license-distribution ng-toggle').click(); - - // Before using Cypress drag & drop, we have to manually trigger the "dragover" event. - // This ensures our UI displays the dropzone that covers the entire submission page. - // (For some reason Cypress drag & drop doesn't trigger this even itself & upload won't work without this trigger) - cy.get('ds-uploader').trigger('dragover'); - - // This is the POST command that will upload the file - cy.intercept('POST', '/server/api/submission/workspaceitems/*').as('upload'); - - // Upload our DSpace logo via drag & drop onto submission form - // cy.get('div#section_upload') - cy.get('div.ds-document-drop-zone').selectFile('src/assets/images/dspace-logo.svg', { - action: 'drag-drop', - }); - - // Wait for upload to complete before proceeding - cy.wait('@upload'); - cy.get('ds-submission-upload-section-file').should('contain', 'dspace-logo.svg'); - - // This is the POST command that will deposit the submission - cy.intercept('POST', '**/api/workflow/workflowitems*').as('deposit'); - - // Wait for deposit button to not be disabled & click it. - cy.get('button#deposit').should('not.be.disabled').click(); - cy.wait('@deposit').its('response.statusCode').should('eq', 201); - - // No warnings should exist, and a deposit goes back to MyDSpace - cy.get('ds-notification div.alert-warning').should('not.exist'); - cy.location('pathname').should('include', '/mydspace'); - }); - it('is possible to submit a new "Person" and that form passes accessibility', () => { // To submit a different entity type, we'll start from MyDSpace cy.visit('/mydspace');