From 34a8094be2eee2ba917a9d75f42f470cd3219928 Mon Sep 17 00:00:00 2001 From: Taslan Graham Date: Wed, 27 Nov 2024 18:35:45 -0500 Subject: [PATCH] pkp/pkp-lib#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 4d13ec8776..f349b98e21 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('addCategory', (categoryName, categoryPath) => { cy.get('div.pkp_grid_category a[id^=component-grid-settings-category-categorycategorygrid-addCategory-button-]').click(); diff --git a/cypress/tests/integration/orcid/Orcid.cy.js b/cypress/tests/integration/orcid/Orcid.cy.js new file mode 100644 index 0000000000..5d1cd3bfc1 --- /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, 'Al-Khafaji'); + + 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'); + }); + }); +});