11import '../support/commands.js' ;
22
3- function beginSubmission ( submissionData ) {
4- cy . get ( 'input[name="locale"][value="en"]' ) . click ( ) ;
5- cy . setTinyMceContent ( 'startSubmission-title-control' , submissionData . title ) ;
6-
7- cy . get ( 'input[name="submissionRequirements"]' ) . check ( ) ;
8- cy . get ( 'input[name="privacyConsent"]' ) . check ( ) ;
9- cy . contains ( 'button' , 'Begin Submission' ) . click ( ) ;
10- }
11-
12- function detailsStep ( submissionData ) {
13- cy . setTinyMceContent ( 'titleAbstract-abstract-control-en' , submissionData . abstract ) ;
14- cy . contains ( 'button' , 'Continue' ) . click ( ) ;
15- }
16-
17- function addContributor ( contributorData , toUpperCase = false ) {
18- let given = ( toUpperCase ) ? contributorData . given . toUpperCase ( ) : contributorData . given ;
19- let family = ( toUpperCase ) ? contributorData . family . toUpperCase ( ) : contributorData . family ;
20-
21- cy . contains ( 'button' , 'Add Contributor' ) . click ( ) ;
22- cy . get ( 'input[name="givenName-en"]' ) . type ( given , { delay : 0 } ) ;
23- cy . get ( 'input[name="familyName-en"]' ) . type ( family , { delay : 0 } ) ;
24- cy . get ( 'input[name="email"]' ) . type ( contributorData . email , { delay : 0 } ) ;
25- cy . get ( 'select[name="country"]' ) . select ( contributorData . country ) ;
26-
27- if ( 'orcid' in contributorData ) {
28- cy . get ( 'input[name="orcid"]' ) . type ( contributorData . orcid , { delay : 0 } ) ;
29- }
30-
31- cy . get ( 'input[name="affiliation-en"]' ) . should ( 'have.attr' , 'required' ) ;
32- cy . get ( 'input[name="affiliation-en"]' ) . type ( contributorData . affiliation , { delay : 0 } ) ;
33-
34- cy . get ( '.modal__panel:contains("Add Contributor")' ) . find ( 'button' ) . contains ( 'Save' ) . click ( ) ;
35- cy . waitJQuery ( ) ;
36- }
37-
383describe ( 'SciELO Screening Plugin - Submission wizard tests' , function ( ) {
394 let submissionData ;
405 let files ;
@@ -96,8 +61,8 @@ describe('SciELO Screening Plugin - Submission wizard tests', function() {
9661 cy . login ( 'dphillips' , null , 'publicknowledge' ) ;
9762 cy . get ( 'div#myQueue a:contains("New Submission")' ) . click ( ) ;
9863
99- beginSubmission ( submissionData ) ;
100- detailsStep ( submissionData ) ;
64+ cy . beginSubmission ( submissionData ) ;
65+ cy . detailsStep ( submissionData ) ;
10166 cy . contains ( 'button' , 'Continue' ) . click ( ) ;
10267
10368 cy . get ( '.contributorsListPanel button:contains("Delete")' ) . click ( ) ;
@@ -108,7 +73,7 @@ describe('SciELO Screening Plugin - Submission wizard tests', function() {
10873 cy . contains ( 'Please inform the total number of contributors to this publication' ) ;
10974 cy . get ( 'input[name="numberContributors"]' ) . clear ( ) . type ( '5' , { delay : 0 } ) ;
11075
111- addContributor ( submissionData . contributors [ 0 ] ) ;
76+ cy . addContributor ( submissionData . contributors [ 0 ] ) ;
11277 cy . contains ( 'button' , 'Continue' ) . click ( ) ;
11378 cy . contains ( 'button' , 'Continue' ) . click ( ) ;
11479 cy . wait ( 1000 ) ;
@@ -129,7 +94,7 @@ describe('SciELO Screening Plugin - Submission wizard tests', function() {
12994 cy . contains ( 'button' , 'Continue' ) . click ( ) ;
13095 cy . contains ( 'button' , 'Continue' ) . click ( ) ;
13196
132- addContributor ( submissionData . contributors [ 1 ] , true ) ;
97+ cy . addContributor ( submissionData . contributors [ 1 ] , { toUpperCase : true } ) ;
13398 cy . get ( 'input[name="numberContributors"]' ) . clear ( ) . type ( '2' , { delay : 0 } ) ;
13499 cy . contains ( 'button' , 'Continue' ) . click ( ) ;
135100 cy . contains ( 'button' , 'Continue' ) . click ( ) ;
@@ -144,7 +109,7 @@ describe('SciELO Screening Plugin - Submission wizard tests', function() {
144109 cy . contains ( 'button' , 'Delete Contributor' ) . click ( ) ;
145110 cy . waitJQuery ( ) ;
146111
147- addContributor ( submissionData . contributors [ 1 ] ) ;
112+ cy . addContributor ( submissionData . contributors [ 1 ] ) ;
148113 cy . contains ( 'button' , 'Continue' ) . click ( ) ;
149114 cy . contains ( 'button' , 'Continue' ) . click ( ) ;
150115 cy . wait ( 1000 ) ;
@@ -162,7 +127,7 @@ describe('SciELO Screening Plugin - Submission wizard tests', function() {
162127 cy . contains ( 'At least one contributor must have their ORCID confirmed. Please, check your e-mail' ) ;
163128
164129 cy . get ( '.pkpSteps__step button:contains("Contributors")' ) . click ( ) ;
165- addContributor ( submissionData . contributors [ 2 ] ) ;
130+ cy . addContributor ( submissionData . contributors [ 2 ] ) ;
166131 cy . get ( 'input[name="numberContributors"]' ) . clear ( ) . type ( '3' , { delay : 0 } ) ;
167132 cy . contains ( 'button' , 'Continue' ) . click ( ) ;
168133 cy . contains ( 'button' , 'Continue' ) . click ( ) ;
0 commit comments