From ae4b8cb93c7287bf28a723c7436ac84fe7fd09bc Mon Sep 17 00:00:00 2001 From: Taslan Graham Date: Wed, 27 Nov 2024 16:49:06 -0500 Subject: [PATCH] pkp#10127 Add e2e tests for ORCID --- cypress/support/commands.js | 1 + cypress/tests/integration/orcid/Orcid.cy.js | 44 +++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 cypress/tests/integration/orcid/Orcid.cy.js diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 9b0c67774b4..ebaa4391b58 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -9,6 +9,7 @@ import Api from '../../lib/pkp/cypress/support/api.js'; import '../../lib/pkp/cypress/support/commands_new_workflow.js'; +import '../../lib/pkp/cypress/support/commands_orcid.js'; Cypress.Commands.add('addToCatalog', function() { cy.get('button:contains("Publish")').click(); diff --git a/cypress/tests/integration/orcid/Orcid.cy.js b/cypress/tests/integration/orcid/Orcid.cy.js new file mode 100644 index 00000000000..1e921b16986 --- /dev/null +++ b/cypress/tests/integration/orcid/Orcid.cy.js @@ -0,0 +1,44 @@ +/** + * @file cypress/tests/integration/Orcid.cy.js + * + * Copyright (c) 2014-2024 Simon Fraser University + * Copyright (c) 2000-2024 John Willinsky + * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. + * + */ + +describe('ORCID tests', function() { + before(() => { + cy.enableOrcid(); + }); + + it('Sends ORCID verification request to author', function() { + cy.login('dbarnes'); + cy.visit( + 'index.php/publicknowledge/en/dashboard/editorial?currentViewId=assigned-to-me' + ); + + // Select a submission in submission list + cy.findSubmissionAsEditor('dbarnes', null, 'Bernnard'); + + cy.get('a').contains('Contributors').click(); + + cy.get('div.listPanel__itemActions') + .contains('Primary Contact') + .parents('div.listPanel__itemActions') + .within(() => { + cy.contains('button', 'Edit').click(); + }) + .then(() => { + // Ensure side modal is opened before continuing + cy.wait(10000); + + cy.get('[data-cy="sidemodal-header"]').should('be.visible'); + cy.contains('Request verification').click(); + cy.get('button').contains('Yes').click(); + cy.contains( + 'ORCID Verification has been requested! Resend Verification Email' + ).should('be.visible'); + }); + }); +});