From af33c24cab94b50bcd6eede943e9df5ba48bf32b Mon Sep 17 00:00:00 2001 From: jyhein <124268211+jyhein@users.noreply.github.com> Date: Thu, 24 Aug 2023 09:38:51 +0300 Subject: [PATCH] pkp/pkp-lib#5502 Change Submission Language --- .../ChangeSubmissionLanguage.cy.js | 48 +++++++++---------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/cypress/tests/integration/ChangeSubmissionLanguage.cy.js b/cypress/tests/integration/ChangeSubmissionLanguage.cy.js index 8222b7bf788..9e7dc7b27da 100644 --- a/cypress/tests/integration/ChangeSubmissionLanguage.cy.js +++ b/cypress/tests/integration/ChangeSubmissionLanguage.cy.js @@ -35,44 +35,40 @@ describe('Change Submission Language', function() { }; }); + it('Try to change submission language after publication', function() { + cy.login(user, password, 'publicknowledge'); + cy.get('button[id="archive-button"]').click(); + cy.contains('View ' + author.familyName).click({force: true}); + cy.get(`button:contains("${originalLanguage}")`).should('be.disabled'); + }); + it('Change submission language', function() { - cy.findSubmissionAsEditor(user, password, author.familyName); - // Change Language + cy.login(user, password, 'publicknowledge'); + cy.get('button[id="archive-button"]').click(); + cy.contains('View ' + author.familyName).click({force: true}); + // Unpublish + cy.get('button[id="publication-button"]').click(); + cy.get('#publication button:contains("Unpublish")').click(); + cy.get('#modals-container button:contains("Unpublish")').click(); + cy.wait(1000); + // Change language cy.get(`.pkpHeader__actions button:contains("${originalLanguage}")`).click(); cy.get('#changeSubmissionLanguage').find(`input[value="${newLocaleKey}"]`).click(); cy.setTinyMceContent('changeSubmissionLanguageMetadata-title-control-' + newLocaleKey, title[newLocaleKey]); cy.setTinyMceContent('changeSubmissionLanguageMetadata-abstract-control-' + newLocaleKey, abstract[newLocaleKey]); cy.get('#changeSubmissionLanguage button[label="Save"]').click(); - // Publish - cy.clickDecision('Accept and Skip Review'); - cy.waitForEmailTemplateToBeLoaded('Notify Authors'); - cy.get('button:contains("Continue")').click(); - cy.recordDecision('Skipped Review'); - cy.get('button[id="publication-button"]').click(); - cy.get('#publication button:contains("Schedule For Publication")').click(); - cy.get('div[id^="publish-"] button[label="Publish"]').click(); - }); - - it('Try to change submission language after publication', function() { - cy.findSubmissionAsEditor(user, password, author.familyName); - cy.get(`button:contains("${newLanguage}")`).should('be.disabled'); }); it('Change submission language back to the original', function() { cy.findSubmissionAsEditor(user, password, author.familyName); - // Unpublish - cy.get('button[id="publication-button"]').click(); - cy.get('#publication button:contains("Unpublish")').click(); - cy.get('#modals-container button:contains("Unpublish")').click(); - cy.get('button[id="workflow-button"]').click(); - cy.get('#ui-id-1').click(); - cy.get('#ui-id-5').click(); - cy.clickDecision('Cancel Copyediting'); - cy.waitForEmailTemplateToBeLoaded('Notify Authors'); - cy.recordDecision('Sent Back from Copyediting'); - // Change language back to the original + // Change language cy.get(`.pkpHeader__actions button:contains("${newLanguage}")`).click(); cy.get('#changeSubmissionLanguage').find(`input[value="${originalLocaleKey}"]`).click(); cy.get('#changeSubmissionLanguage button[label="Save"]').click(); + cy.wait(2000); + // Publish + cy.get('button[id="publication-button"]').click(); + cy.get('div#publication button:contains("Schedule For Publication")').click(); + cy.get('div.pkpWorkflow__publishModal button:contains("Publish")').click(); }); });