Skip to content

Commit

Permalink
pkp/pkp-lib#7495 Migrating e2e tests for new workflow&submissions
Browse files Browse the repository at this point in the history
  • Loading branch information
jardakotesovec committed Oct 17, 2024
1 parent abbc624 commit c3f4979
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 124 deletions.
2 changes: 1 addition & 1 deletion classes/decision/types/RecommendDeclineInternal.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ class RecommendDeclineInternal extends RecommendDecline

public function getDecision(): int
{
return Decision::RECOMMEND_ACCEPT_INTERNAL;
return Decision::RECOMMEND_DECLINE_INTERNAL;
}
}
2 changes: 1 addition & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import Api from '../../lib/pkp/cypress/support/api.js';
import '../../lib/pkp/cypress/support/commands';
import '../../lib/pkp/cypress/support/commands_new_workflow.js';

Cypress.Commands.add('addToCatalog', function() {
cy.get('button:contains("Publish")').click();
Expand Down
2 changes: 1 addition & 1 deletion cypress/tests/data/60-content/AfinkelSubmission.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ describe('Data suite tests', function() {
cy.get('a').contains('Create a new submission');
cy.get('a').contains('Return to your dashboard');
cy.get('a').contains('Review this submission').click();
cy.get('h1:contains("' + submission.title + '")');
cy.get('p:contains("' + submission.title + '")');
cy.logout();

cy.findSubmissionAsEditor('dbarnes', null, 'Finkel');
Expand Down
3 changes: 1 addition & 2 deletions cypress/tests/data/60-content/BbeatySubmission.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ describe('Data suite tests', function() {
cy.assignParticipant('Layout Editor', 'Graham Cox');

// Add a publication format with ISBNs
cy.get('button[id="publication-button"]').click();
cy.get('button[id="publicationFormats-button"]').click();
cy.openWorkflowMenu('Publication Formats');
cy.get('*[id^="component-grid-catalogentry-publicationformatgrid-addFormat-button-"]').click();
cy.wait(1000); // Avoid occasional failure due to form init taking time
cy.get('input[id^="name-en-"]').type('PDF', {delay: 0});
Expand Down
13 changes: 6 additions & 7 deletions cypress/tests/data/60-content/CallanSubmission.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ describe('Data suite tests', function() {
cy.assignParticipant('Proofreader', 'Catherine Turner');

// Add a publication format
cy.get('button[id="publication-button"]').click();
cy.get('button[id="publicationFormats-button"]').click();
cy.openWorkflowMenu('Publication Formats');
cy.get('*[id^="component-grid-catalogentry-publicationformatgrid-addFormat-button-"]').click();
cy.wait(1000); // Avoid occasional failure due to form init taking time
cy.get('input[id^="name-en-"]').type('PDF', {delay: 0});
Expand Down Expand Up @@ -180,11 +179,11 @@ describe('Data suite tests', function() {
});

it('Book is not available when unpublished', function() {
cy.findSubmissionAsEditor('dbarnes', null, 'Allan');
cy.get('#publication-button').click();
cy.findSubmissionAsEditor('dbarnes', null, 'Allan', null, 'Published');
cy.openWorkflowMenu('Title & Abstract');
cy.get('button').contains('Unpublish').click();
cy.contains('Are you sure you don\'t want this to be published?');
cy.get('div[role=dialog] button').contains('Unpublish').click();
cy.get('[data-cy="dialog"] button').contains('Unpublish').click();
cy.wait(1000);
cy.visit('index.php/publicknowledge/catalog');
cy.contains('Bomb Canada and Other Unkind Remarks in the American Media').should('not.exist');
Expand All @@ -199,8 +198,8 @@ describe('Data suite tests', function() {

// Re-publish it
cy.findSubmissionAsEditor('dbarnes', null, 'Allan');
cy.get('#publication-button').click();
cy.get('.pkpPublication button').contains('Publish').click();
cy.openWorkflowMenu('Title & Abstract');
cy.get('button').contains('Publish').click();
cy.contains('All publication requirements have been met.');
cy.get('.pkpWorkflow__publishModal button').contains('Publish').click();
});
Expand Down
11 changes: 9 additions & 2 deletions cypress/tests/data/60-content/DbernnardSubmission.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,23 @@ describe('Data suite tests', function() {
cy.assignParticipant('Press editor', 'Daniel Barnes');
// Assign a recommendOnly section editor
cy.assignParticipant('Series editor', 'Minoti Inoue', true);

cy.logout();
// Find the submission as the section editor
cy.login('minoue', null, 'publicknowledge'),
cy.get('#myQueue').find('a').contains('View Bernnard').click({force: true});
cy.findSubmissionAsEditor('minoue', null, 'Bernnard', null, 'Assigned to me');


// Recommend
cy.clickDecision('Recommend Accept');
cy.recordRecommendation('Recommend Accept', ['Daniel Barnes', 'David Buskins']);
cy.logout();

// Log in as editor and see the existing recommendation
cy.findSubmissionAsEditor('dbarnes', null, 'Bernnard');
cy.get('div.pkp_workflow_recommendations:contains("Recommendations: Accept Submission")');
cy.get('[data-cy="workflow-secondary-items"] h2').contains("Recommendation");
// FIX ME correct label should come with
//cy.get('[data-cy="workflow-actions"] p').contains("Accept Submission");
cy.get('[data-cy="workflow-secondary-items"] p').contains("Recommend Accept");
});
});
3 changes: 1 addition & 2 deletions cypress/tests/data/60-content/MdawsonSubmission.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ describe('Data suite tests', function() {
cy.assignParticipant('Proofreader', 'Sabine Kumar');

// Add a publication format
cy.get('button[id="publication-button"]').click();
cy.get('button[id="publicationFormats-button"]').click();
cy.openWorkflowMenu('Publication Formats');
cy.get('*[id^="component-grid-catalogentry-publicationformatgrid-addFormat-button-"]').click();
cy.wait(1000); // Avoid occasional failure due to form init taking time
cy.get('input[id^="name-en-"]').type('PDF', {delay: 0});
Expand Down
18 changes: 12 additions & 6 deletions cypress/tests/integration/CompetingInterests.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Data suite tests', function() {

// Submit review with no competing interests
cy.login('agallego', null, 'publicknowledge');
cy.get('a:contains("View Lost Tracks")').click({force: true});
cy.openReviewAssignment('Lost Tracks');

cy.get('form#reviewStep1Form');
cy.get('label[for="noCompetingInterests"]').should('not.exist');
Expand All @@ -44,8 +44,9 @@ describe('Data suite tests', function() {

// Find and view the review
cy.findSubmissionAsEditor('dbarnes', null, 'Brower');
cy.waitJQuery();
cy.get('span:contains("Adela Gallego")').parent().parent().find('a:contains("Read Review")').click();
cy.contains('table tr', 'Adela Gallego').within(() => {
cy.get('button').contains("Read Review").click()
})

// There should not be a visible CI statement.
cy.get('h3:contains("Reviewer Comments")');
Expand Down Expand Up @@ -73,7 +74,8 @@ describe('Data suite tests', function() {
// Submit review with competing interests
const competingInterests = 'I work for a competing company';
cy.login('alzacharia', null, 'publicknowledge');
cy.get('a:contains("View Lost Tracks")').click({force: true});
cy.openReviewAssignment('Lost Tracks');


cy.get('input#hasCompetingInterests').click();
cy.wait(2000); // Give TinyMCE control time to load
Expand All @@ -95,7 +97,9 @@ describe('Data suite tests', function() {
// Find and view the review
cy.findSubmissionAsEditor('dbarnes', null, 'Brower');
cy.waitJQuery();
cy.get('span:contains("Al Zacharia")').parent().parent().find('a:contains("Read Review")').click();
cy.contains('table tr', 'Al Zacharia').within(() => {
cy.get('button').contains("Read Review").click()
})

// There should be a visible CI statement.
cy.get('h3:contains("Reviewer Comments")');
Expand All @@ -119,7 +123,9 @@ describe('Data suite tests', function() {
// The CI statement entered previously should still be visible.
cy.findSubmissionAsEditor('dbarnes', null, 'Brower');
cy.waitJQuery();
cy.get('span:contains("Al Zacharia")').parent().parent().find('a:contains("Read Review")').click();
cy.contains('table tr', 'Al Zacharia').within(() => {
cy.get('button').contains("Read Review").click()
})
cy.get('h3:contains("Reviewer Comments")');
cy.get('p').contains(competingInterests);
});
Expand Down
26 changes: 11 additions & 15 deletions cypress/tests/integration/Payments.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,22 @@ describe('Payments', function() {

it('Add a direct sales on Submission chapter', function () {
cy.login('dbarnes', null, 'publicknowledge');
cy.get('nav').contains('Submissions').click();
cy.get('button[id="archive-button"]').click();

var submissionElement = cy.get('#archive .listPanel__item').contains('Bomb Canada and Other Unkind Remarks in the American Media').parents('.listPanel__item');
submissionElement.within(() => {
cy.get('.listPanel__itemActions .pkpButton').click();
})
cy.get('button[id="publication-button"]').click();
cy.get('nav').contains('Published').click();
cy.openSubmission('Bomb Canada and Other Unkind Remarks in the American Media');
cy.openWorkflowMenu('Title & Abstract');
cy.get('button').contains('Unpublish').click();
cy.get('[role=dialog] button').contains('Unpublish').should('be.visible').click();
cy.get('[data-cy="dialog"] button').contains('Unpublish').should('be.visible').click();
cy.waitJQuery();
cy.get('#publicationFormats-button').click();
cy.openWorkflowMenu('Publication Formats');
cy.get('.pkp_linkaction_editApprovedProof').click();
cy.wait(1000);
cy.get('[role="dialog"] #directSales').click();
cy.get('[role="dialog"] input[type="text"][name="price"]').type('9.99');
cy.get('[role="dialog"] .formButtons .submitFormButton').click();
cy.get('#publication .pkpButton').contains('Publish').click();
cy.get('[role="dialog"] .pkpButton').contains('Publish').click();
cy.get('.pkpPublication__versionPublished').should('be.visible');
cy.get('#directSales').click();
cy.get('input[type="text"][name="price"]').type('9.99');
cy.get('.formButtons .submitFormButton').click();
cy.get('button').contains('Publish').click();
cy.get('[data-cy="active-modal"] button').contains('Publish').click();
cy.contains('This version has been published and can not be edited.');
cy.logout();
});

Expand Down
56 changes: 29 additions & 27 deletions cypress/tests/integration/Z_MonographViewDCMetadata.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ describe('Monograph View Metadata - DC Plugin', function() {
cy.checkDoiConfig(['publication', 'chapter', 'representation', 'file']);

// After configuration, go to submissions
cy.get('nav').contains('Submissions').click();
cy.get('nav').contains('Dashboards').click();

// Create a new submission
cy.getCsrfToken();
Expand All @@ -414,32 +414,33 @@ describe('Monograph View Metadata - DC Plugin', function() {
return cy.submitSubmissionWithApi(submission.id, this.csrfToken);
})
.then(xhr => {
cy.visit('/index.php/publicknowledge/en/workflow/index/' + submission.id + '/1');
cy.visit('/index.php/publicknowledge/workflow/access/' + submission.id);
});


// Go to publication tabs
cy.get('#publication-button').click();
cy.openWorkflowMenu('Title & Abstract');

// Open multilanguage inputs and add data to fr_CA inputs
cy.get('div#titleAbstract button').contains('French').click();
cy.get('.pkpFormLocales button').contains('French').click();

cy.get('#titleAbstract input[name=prefix-en]').type(submission.prefix, {delay: 0});
cy.get('#titleAbstract input[name=prefix-en]').click({force: true});
cy.get('input[name=prefix-en]').type(submission.prefix, {delay: 0});
cy.get('input[name=prefix-en]').click({force: true});
cy.setTinyMceContent('titleAbstract-subtitle-control-en', submission.subtitle);

cy.setTinyMceContent('titleAbstract-title-control-fr_CA', submission.localeTitles.fr_CA.title);
cy.get('#titleAbstract input[name=prefix-fr_CA]').type(submission.localeTitles.fr_CA.prefix, {delay: 0});
cy.get('input[name=prefix-fr_CA]').type(submission.localeTitles.fr_CA.prefix, {delay: 0});
cy.setTinyMceContent('titleAbstract-subtitle-control-fr_CA', submission.localeTitles.fr_CA.subtitle);
cy.setTinyMceContent('titleAbstract-abstract-control-fr_CA', submission.localeTitles.fr_CA.abstract);
cy.get('#titleAbstract-title-control-fr_CA').click({force: true}); // Ensure blur event is fired
cy.get('#titleAbstract-subtitle-control-fr_CA').click({force: true});
cy.get('#titleAbstract button').contains('Save').click();
cy.get('#titleAbstract [role="status"]').contains('Saved');
cy.get('button').contains('Save').click();
cy.get('[role="status"]').contains('Saved');

// Go to metadata
cy.get('#metadata-button').click();
cy.get('div#metadata button').contains('French').click();
cy.openWorkflowMenu('Metadata');
cy.wait(500);
cy.get('.pkpFormLocales button').contains('French').click();

// Add the metadata to the submission
submission.localeMetadata.forEach((locale) => {
Expand All @@ -461,20 +462,21 @@ describe('Monograph View Metadata - DC Plugin', function() {
});
});

cy.get('#metadata button').contains('Save').click();
cy.get('#metadata [role="status"]').contains('Saved');
cy.get('button').contains('Save').click();
cy.get('[role="status"]').contains('Saved');

// Permissions & Disclosure
cy.get('#license-button').click();
cy.get('#license [name="licenseUrl"]').type(submission.licenceUrl, {delay: 0});
cy.get('#license button').contains('Save').click();
cy.get('#license [role="status"]').contains('Saved');
cy.openWorkflowMenu('Permissions & Disclosure');

cy.get('[name="licenseUrl"]').type(submission.licenceUrl, {delay: 0});
cy.get('button').contains('Save').click();
cy.get('[role="status"]').contains('Saved');

// Add a publication format
submission.publicationFormats.forEach((publicationFormat) => {
cy.get('button[id="publicationFormats-button"]').click();
cy.openWorkflowMenu('Publication Formats');
cy.wait(1500); // Wait for the form to settle
cy.get('div#representations-grid a').contains('Add publication format').click();
cy.get('[data-cy="publication-format-manager"] a').contains('Add publication format').click();
cy.wait(1500); // Wait for the form to settle
cy.get('input[id^="name-en-"]').type(publicationFormat.name, {delay: 0});
cy.get('[role="dialog"] h1:contains("Add publication format")').click();
Expand Down Expand Up @@ -507,21 +509,21 @@ describe('Monograph View Metadata - DC Plugin', function() {
});

// Catalog Entry
cy.get('#catalogEntry-button').click();
cy.get('#catalogEntry [name="seriesId"]').select(submission.seriesData.title);
cy.get('#catalogEntry [name="seriesPosition"]').type(submission.seriesPosition, {delay: 0});
cy.get('#catalogEntry [name="urlPath"]').type(submission.urlPath);
cy.get('#catalogEntry button').contains('Save').click();
cy.get('#catalogEntry [role="status"]').contains('Saved');
cy.openWorkflowMenu('Catalog Entry')
cy.get('[name="seriesId"]').select(submission.seriesData.title);
cy.get('[name="seriesPosition"]').type(submission.seriesPosition, {delay: 0});
cy.get('[name="urlPath"]').type(submission.urlPath);
cy.get('button').contains('Save').click();
cy.get('[role="status"]').contains('Saved');

// Go to workflow to send the submission to Copyediting stage
cy.get('#workflow-button').click();
cy.openWorkflowMenu('Submission')
cy.clickDecision('Accept and Skip Review');
cy.recordDecision('and has been sent to the copyediting stage');
cy.isActiveStageTab('Copyediting');

// Add to catalog - Publish the submission
cy.get('#publication-button').click();
cy.openWorkflowMenu('Title & Abstract');
cy.addToCatalog();
});

Expand Down
Loading

0 comments on commit c3f4979

Please sign in to comment.