@@ -23,6 +23,8 @@ const formErrors = {
2323 rationale : "rationale-helper-error" ,
2424 receivingAddress : "receiving-address-0-text-error" ,
2525 amount : "amount-0-text-error" ,
26+ constitutionalUrl : "prop=constitution-url-text-error" , // BUG wrong test id
27+ guardrailsScriptUrl : "prop-guardrails-script-url-input-error" ,
2628 link : "link-0-url-input-error" ,
2729} ;
2830
@@ -155,6 +157,10 @@ export default class ProposalSubmissionPage {
155157 if ( governanceProposal . gov_action_type_id === 2 ) {
156158 await this . fillUpdateTheConstitutionFields ( governanceProposal ) ;
157159 }
160+
161+ if ( governanceProposal . proposal_links != null ) {
162+ await this . fillProposalLinks ( governanceProposal . proposal_links ) ;
163+ }
158164 }
159165
160166 async fillupForm ( governanceProposal : ProposalCreateRequest ) {
@@ -167,9 +173,7 @@ export default class ProposalSubmissionPage {
167173 } else {
168174 await this . updateTheConstitutionBtn . click ( ) ;
169175 }
170- if ( governanceProposal . proposal_links != null ) {
171- await this . fillProposalLinks ( governanceProposal . proposal_links ) ;
172- }
176+
173177 await this . fillupFormWithTypeSelected ( governanceProposal ) ;
174178 }
175179
@@ -194,8 +198,6 @@ export default class ProposalSubmissionPage {
194198 governanceProposal . prop_constitution_url
195199 ) ;
196200
197- await this . guardrailsScriptCheckbox . click ( ) ;
198-
199201 await this . guardrailsScriptUrlInput . fill (
200202 governanceProposal . prop_guardrails_script_url
201203 ) ;
@@ -278,6 +280,16 @@ export default class ProposalSubmissionPage {
278280 }
279281 }
280282
283+ if ( governanceProposal . gov_action_type_id === 2 ) {
284+ await expect (
285+ this . page . getByTestId ( formErrors . constitutionalUrl )
286+ ) . toBeHidden ( ) ;
287+
288+ await expect (
289+ this . page . getByTestId ( formErrors . guardrailsScriptUrl )
290+ ) . toBeHidden ( ) ;
291+ }
292+
281293 await expect ( this . page . getByTestId ( formErrors . link ) ) . toBeHidden ( ) ;
282294
283295 await expect ( this . continueBtn ) . toBeEnabled ( ) ;
@@ -332,6 +344,16 @@ export default class ProposalSubmissionPage {
332344 await expect ( this . page . getByTestId ( formErrors . amount ) ) . toBeVisible ( ) ;
333345 }
334346
347+ if ( governanceProposal . gov_action_type_id === 2 ) {
348+ await expect (
349+ this . page . getByTestId ( formErrors . constitutionalUrl )
350+ ) . toBeVisible ( ) ;
351+
352+ await expect (
353+ this . page . getByTestId ( formErrors . guardrailsScriptUrl )
354+ ) . toBeVisible ( ) ;
355+ }
356+
335357 await expect ( this . continueBtn ) . toBeDisabled ( ) ;
336358 }
337359
@@ -385,14 +407,20 @@ export default class ProposalSubmissionPage {
385407 prop_link_text : invalid . name ( ) ,
386408 } ,
387409 ] ,
388- gov_action_type_id : proposalType === ProposalType . info ? 0 : 1 ,
410+ gov_action_type_id : Object . values ( ProposalType ) . indexOf ( proposalType ) ,
389411 is_draft : false ,
390412 } ;
391413
392414 if ( proposalType === ProposalType . treasury ) {
393415 ( proposal . prop_receiving_address = faker . location . streetAddress ( ) ) ,
394416 ( proposal . prop_amount = invalid . amount ( ) ) ;
395417 }
418+
419+ if ( proposalType === ProposalType . updatesToTheConstitution ) {
420+ proposal . prop_constitution_url = invalid . constitutionUrl ( ) ;
421+ proposal . prop_guardrails_script_url = invalid . url ( ) ;
422+ proposal . prop_guardrails_script_hash = faker . string . alphanumeric ( 64 ) ;
423+ }
396424 return proposal ;
397425 }
398426
0 commit comments