@@ -30,6 +30,8 @@ const formErrors = {
3030 constitutionalUrl : "prop-constitution-url-text-error" ,
3131 guardrailsScriptUrl : "prop-guardrails-script-url-input-error" ,
3232 link : "link-0-url-input-error" ,
33+ majorError : "major-error" ,
34+ minorError : "minor-error" ,
3335} ;
3436
3537export default class ProposalSubmissionPage {
@@ -61,6 +63,7 @@ export default class ProposalSubmissionPage {
6163 readonly motionOfNoConfidenceBtn = this . page . getByTestId (
6264 "motion of no confidence-button"
6365 ) ;
66+ readonly hardForkBtn = this . page . getByTestId ( "hard fork-button" ) ;
6467 readonly editSubmissionButton = this . page . getByTestId (
6568 "edit-submission-button"
6669 ) ;
@@ -101,6 +104,12 @@ export default class ProposalSubmissionPage {
101104 readonly closeDraftSuccessModalBtn = this . page . getByTestId ( "close-button" ) ;
102105 readonly linkTextInput = this . page . getByTestId ( "link-0-text-input" ) ;
103106 readonly linkUrlInput = this . page . getByTestId ( "link-0-url-input" ) ;
107+ readonly previousGAHashInput = this . page . getByTestId (
108+ "previous-ga-hash-input"
109+ ) ;
110+ readonly previousGAIdInput = this . page . getByTestId ( "previous-ga-id-input" ) ;
111+ readonly majorInput = this . page . getByTestId ( "major-input" ) ;
112+ readonly minorInput = this . page . getByTestId ( "minor-input" ) ;
104113
105114 // content
106115 readonly governanceActionTypeContent = this . page . getByTestId (
@@ -125,6 +134,8 @@ export default class ProposalSubmissionPage {
125134 ) ;
126135 readonly linkTextContent = this . page . getByTestId ( "link-0-text-content" ) ;
127136 readonly linkUrlContent = this . page . getByTestId ( "link-0-url-content" ) ;
137+ readonly majorVersionContent = this . page . getByTestId ( "major-version-content" ) ;
138+ readonly minorVersionContent = this . page . getByTestId ( "minor-version-content" ) ;
128139
129140 constructor ( private readonly page : Page ) { }
130141
@@ -172,9 +183,14 @@ export default class ProposalSubmissionPage {
172183 if ( governanceProposal . proposal_links != null ) {
173184 await this . fillProposalLinks ( governanceProposal . proposal_links ) ;
174185 }
186+
187+ if ( governanceProposal . gov_action_type_id == 4 ) {
188+ await this . fillHardForkFields ( governanceProposal ) ;
189+ }
175190 }
176191
177192 async fillupForm ( governanceProposal : ProposalCreateRequest ) {
193+ console . log ( governanceProposal . gov_action_type_id ) ;
178194 await this . governanceActionType . click ( ) ;
179195
180196 if ( governanceProposal . gov_action_type_id === 0 ) {
@@ -186,8 +202,10 @@ export default class ProposalSubmissionPage {
186202 if ( governanceProposal . has_guardrails ) {
187203 await this . guardrailsScriptCheckbox . click ( ) ;
188204 }
189- } else {
205+ } else if ( governanceProposal . gov_action_type_id === 3 ) {
190206 await this . motionOfNoConfidenceBtn . click ( ) ;
207+ } else {
208+ await this . hardForkBtn . click ( ) ;
191209 }
192210
193211 await this . fillupFormWithTypeSelected ( governanceProposal ) ;
@@ -238,6 +256,11 @@ export default class ProposalSubmissionPage {
238256 }
239257 }
240258
259+ async fillHardForkFields ( hardForkProposal : ProposalCreateRequest ) {
260+ await this . minorInput . fill ( hardForkProposal . prop_min_version . toString ( ) ) ;
261+ await this . majorInput . fill ( hardForkProposal . prop_major_version . toString ( ) ) ;
262+ }
263+
241264 async getAllDrafts ( ) {
242265 await expect (
243266 this . page . locator ( '[data-testid^="draft-"][data-testid$="-card"]' )
@@ -345,6 +368,27 @@ export default class ProposalSubmissionPage {
345368 } ) . toBeHidden ( ) ;
346369 }
347370
371+ if ( governanceProposal . gov_action_type_id === 4 ) {
372+ const isMajorErrorVisible = await this . page
373+ . getByTestId ( formErrors . majorError )
374+ . isVisible ( ) ;
375+ const isMinorErrorVisible = await this . page
376+ . getByTestId ( formErrors . minorError )
377+ . isVisible ( ) ;
378+
379+ await expect ( this . page . getByTestId ( formErrors . majorError ) , {
380+ message : isMajorErrorVisible
381+ ? "Major version error should be hidden"
382+ : "Major version error is correctly hidden" ,
383+ } ) . toBeHidden ( ) ;
384+
385+ await expect ( this . page . getByTestId ( formErrors . minorError ) , {
386+ message : isMinorErrorVisible
387+ ? "Minor version error should be hidden"
388+ : "Minor version error is correctly hidden" ,
389+ } ) . toBeHidden ( ) ;
390+ }
391+
348392 await expect ( this . page . getByTestId ( formErrors . link ) , {
349393 message :
350394 isLinkErrorVisible &&
@@ -457,6 +501,11 @@ export default class ProposalSubmissionPage {
457501 } ) . toBeVisible ( ) ;
458502 }
459503
504+ if ( governanceProposal . gov_action_type_id === 4 ) {
505+ await expect ( this . page . getByTestId ( formErrors . majorError ) ) . toBeVisible ( ) ;
506+ await expect ( this . page . getByTestId ( formErrors . minorError ) ) . toBeVisible ( ) ;
507+ }
508+
460509 await expect ( this . continueBtn ) . toBeDisabled ( ) ;
461510 }
462511
@@ -512,6 +561,15 @@ export default class ProposalSubmissionPage {
512561 }
513562 }
514563 }
564+ if ( proposalType == ProposalType . hardFork ) {
565+ proposal . prop_min_version = faker . number
566+ . float ( { min : 0 , max : 100 } )
567+ . toString ( ) ;
568+ proposal . prop_major_version = faker . number
569+ . float ( { min : 0 , max : 100 } )
570+ . toString ( ) ;
571+ }
572+
515573 return proposal ;
516574 }
517575
@@ -546,6 +604,12 @@ export default class ProposalSubmissionPage {
546604 proposal . prop_guardrails_script_url = invalid . url ( ) ;
547605 proposal . prop_guardrails_script_hash = faker . string . alphanumeric ( 64 ) ;
548606 }
607+
608+ if ( proposalType === ProposalType . hardFork ) {
609+ proposal . prop_min_version = invalid . amount ( ) ;
610+ proposal . prop_major_version = invalid . amount ( ) ;
611+ }
612+
549613 return proposal ;
550614 }
551615
0 commit comments