Skip to content

Commit d3f1b15

Browse files
milanmajchrakclaude
andcommitted
fix(cypress): stabilize submission & admin-workflow specs on slow CI
These VSB/CLARIN pages render slower than Cypress' 4s default, which caused the last two failures after the login fix: - submission: the CLARIN submission form loads several controlled vocabularies before the metadata fields appear, so input#dc_title was not yet in the DOM. Wait for ds-submission-edit and give dc_title a generous timeout. After a failed deposit the metadata accordion section can collapse (ngb-accordion drops its body), so re-expand it before asserting the title field is invalid. - admin-workflow: the supervision-configured search can take a while to return on a freshly started backend; allow extra time for the first list-object to render. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c2c9e7b commit d3f1b15

2 files changed

Lines changed: 23 additions & 4 deletions

File tree

cypress/e2e/admin-workflow-page.cy.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ describe('Admin Workflow Page', () => {
88
it('should pass accessibility tests', () => {
99
// Page must first be visible
1010
cy.get('ds-admin-workflow-page').should('be.visible');
11-
// At least one search result should be displayed
12-
cy.get('[data-test="list-object"]').should('be.visible');
11+
// At least one search result should be displayed. The supervision-configured search on a
12+
// freshly-started CI backend can take a while to return, so allow extra time.
13+
cy.get('[data-test="list-object"]', { timeout: 30000 }).should('be.visible');
1314
// Click each filter toggle to open *every* filter
1415
// (As we want to scan filter section for accessibility issues as well)
1516
cy.get('[data-test="filter-toggle"]').click({ multiple: true });

cypress/e2e/submission.cy.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ describe('New Submission page', () => {
5959
// This page is restricted, so we will be shown the login form. Fill it out & submit.
6060
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
6161

62+
// The CLARIN submission form is heavy (loads several controlled vocabularies),
63+
// so wait until it has fully rendered before interacting with it.
64+
cy.get('ds-submission-edit').should('be.visible');
65+
cy.get('input#dc_title', { timeout: 30000 }).should('exist');
66+
6267
// Attempt an immediate deposit without filling out any fields
6368
cy.get('button#deposit').click();
6469

@@ -70,8 +75,17 @@ describe('New Submission page', () => {
7075
// (as it has required fields)
7176
cy.get('div#traditionalpageone-header i.fa-exclamation-circle').should('be.visible');
7277

78+
// After a failed deposit the metadata accordion section may be collapsed, which (with
79+
// ngb-accordion) removes its fields from the DOM. Ensure it is expanded before asserting
80+
// on the title field.
81+
cy.get('body').then(($body) => {
82+
if ($body.find('input#dc_title').length === 0) {
83+
cy.get('div#traditionalpageone-header').click();
84+
}
85+
});
86+
7387
// Title field should have class "is-invalid" applied, as it's required
74-
cy.get('input#dc_title').should('have.class', 'is-invalid');
88+
cy.get('input#dc_title', { timeout: 15000 }).should('have.class', 'is-invalid');
7589

7690
// Date Year field should also have "is-valid" class
7791
cy.get('input#dc_date_issued_year').should('have.class', 'is-invalid');
@@ -120,8 +134,12 @@ describe('New Submission page', () => {
120134
// This page is restricted, so we will be shown the login form. Fill it out & submit.
121135
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
122136

137+
// The CLARIN submission form is heavy (loads several controlled vocabularies),
138+
// so wait until it has fully rendered before interacting with it.
139+
cy.get('ds-submission-edit').should('be.visible');
140+
123141
// Fill out all required fields (Title, Date)
124-
cy.get('input#dc_title').type('DSpace logo uploaded via e2e tests');
142+
cy.get('input#dc_title', { timeout: 30000 }).type('DSpace logo uploaded via e2e tests');
125143
cy.get('input#dc_date_issued_year').type('2022');
126144

127145
// Confirm the required license by checking checkbox

0 commit comments

Comments
 (0)