diff --git a/cypress/e2e/add-forge-now-request-create.cy.js b/cypress/e2e/add-forge-now-request-create.cy.js --- a/cypress/e2e/add-forge-now-request-create.cy.js +++ b/cypress/e2e/add-forge-now-request-create.cy.js @@ -7,11 +7,11 @@ function populateForm(type, url, contact, email, consent, comment) { cy.get('#swh-input-forge-type').select(type); - cy.get('#swh-input-forge-url').clear().type(url, {delay: 0, force: true}); - cy.get('#swh-input-forge-contact-name').clear().type(contact, {delay: 0, force: true}); - cy.get('#swh-input-forge-contact-email').clear().type(email, {delay: 0, force: true}); + cy.get('#swh-input-forge-url').clear().type(url); + cy.get('#swh-input-forge-contact-name').clear().type(contact); + cy.get('#swh-input-forge-contact-email').clear().type(email); if (comment) { - cy.get('#swh-input-forge-comment').clear().type(comment, {delay: 0, force: true}); + cy.get('#swh-input-forge-comment').clear().type(comment); } cy.get('#swh-input-consent-check').click({force: consent === 'on'}); } diff --git a/cypress/e2e/deposit-admin.cy.js b/cypress/e2e/deposit-admin.cy.js --- a/cypress/e2e/deposit-admin.cy.js +++ b/cypress/e2e/deposit-admin.cy.js @@ -188,7 +188,7 @@ cy.get('#swh-web-modal-html code.xml').should('be.visible'); // Dismiss the modal - cy.get('body').wait(500).type('{esc}'); + cy.wait(500).get('#swh-web-modal-html .close').click(); cy.get('#swh-web-modal-html code.xml').should('not.be.visible'); } else { cy.get('button.metadata', {withinSubject: row}).should('not.exist'); diff --git a/cypress/e2e/mailmap.cy.js b/cypress/e2e/mailmap.cy.js --- a/cypress/e2e/mailmap.cy.js +++ b/cypress/e2e/mailmap.cy.js @@ -11,13 +11,13 @@ if (fromEmail) { cy.get('#swh-mailmap-from-email') .clear() - .type(fromEmail, {delay: 0, force: true}); + .type(fromEmail); } if (displayName) { cy.get('#swh-mailmap-display-name') .clear() - .type(displayName, {delay: 0, force: true}); + .type(displayName); } if (activated) { diff --git a/cypress/e2e/origin-search.cy.js b/cypress/e2e/origin-search.cy.js --- a/cypress/e2e/origin-search.cy.js +++ b/cypress/e2e/origin-search.cy.js @@ -215,7 +215,7 @@ .as('searchOrigin'); cy.get('#swh-origins-url-patterns') - .type(origin.url.slice(0, -1), {delay: 0, force: true}); + .type(origin.url.slice(0, -1)); cy.get('.swh-search-icon') .click(); @@ -567,7 +567,7 @@ .as('searchOrigin'); cy.get('#swh-origins-url-patterns') - .type(swhid, {delay: 0, force: true}); + .type(swhid); cy.get('.swh-search-icon') .click(); diff --git a/cypress/e2e/persistent-identifiers.cy.js b/cypress/e2e/persistent-identifiers.cy.js --- a/cypress/e2e/persistent-identifiers.cy.js +++ b/cypress/e2e/persistent-identifiers.cy.js @@ -29,6 +29,9 @@ if (win.location.port) { urlPrefix += `:${win.location.port}`; } + // for some reasons, cypress hangs when visiting that URL in beforeEach callback + // due to HTTP redirection, so get the redirected URL here to workaround that issue. + url = win.location.href; const swhids = win.swh.webapp.getSwhIdsContext(); cntSWHID = swhids.content.swhid; cntSWHIDWithContext = swhids.content.swhid_with_context; diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js --- a/cypress/support/e2e.js +++ b/cypress/support/e2e.js @@ -108,3 +108,9 @@ beforeEach(function() { mockCostlyRequests(); }); + +Cypress.Commands.overwrite('type', (originalFn, subject, text, options = {}) => { + options.delay = options.delay || 0; + options.force = options.force || true; + return originalFn(subject, text, options); +});