11import environments from "@constants/environments" ;
2- import { fa , faker } from "@faker-js/faker" ;
2+ import { faker } from "@faker-js/faker" ;
33import { extractProposalIdFromUrl } from "@helpers/string" ;
44import { Page , expect } from "@playwright/test" ;
55import {
@@ -11,11 +11,11 @@ import {
1111 BudgetProposalOwnershipProps ,
1212 BudgetProposalProblemStatementAndBenefitProps ,
1313 BudgetProposalProps ,
14+ BudgetProposalStageEnum ,
1415 CommitteeAlignmentEnum ,
1516 CompanyEnum ,
1617 LocationEnum ,
1718 PreferredCurrencyEnum ,
18- ProposalChampionEnum ,
1919 ProposalContractingEnum ,
2020 ProposalLink ,
2121 RoadmapNameEnum ,
@@ -163,7 +163,7 @@ export default class BudgetDiscussionSubmissionPage {
163163 this . page . getByTestId ( "preferred-currency" ) ;
164164
165165 readonly intersectNamedAdministratorSelect = this . page . getByTestId (
166- "itersect -named-administrator"
166+ "intersect -named-administrator"
167167 ) ;
168168
169169 // content
@@ -310,11 +310,6 @@ export default class BudgetDiscussionSubmissionPage {
310310 . getByRole ( "option" , { name : proposalOwnership . companyType } )
311311 . click ( ) ; //BUG missing testId
312312
313- await this . publicChampionSelect . click ( ) ;
314- await this . page
315- . getByRole ( "option" , { name : proposalOwnership . publicChampion } )
316- . click ( ) ; //BUG missing testId
317-
318313 await this . contactDetailsInput . fill ( proposalOwnership . contactDetails ) ;
319314
320315 if ( proposalOwnership . companyType === "Group" ) {
@@ -446,29 +441,28 @@ export default class BudgetDiscussionSubmissionPage {
446441 await this . continueBtn . click ( ) ;
447442 }
448443
449- async fillupForm ( budgetProposal : BudgetProposalProps , stage = 8 ) {
450- await this . fillupContactInformationForm ( budgetProposal . contactInformation ) ;
451-
452- if ( stage > 2 ) {
453- await this . fillupProposalOwnershipForm ( budgetProposal . proposalOwnership ) ;
454- }
444+ async fillupForm (
445+ budgetProposal : BudgetProposalProps ,
446+ stage : BudgetProposalStageEnum = BudgetProposalStageEnum . AdministrationAndAuditing
447+ ) {
448+ await this . fillupProposalOwnershipForm ( budgetProposal . proposalOwnership ) ;
455449
456- if ( stage > 3 ) {
450+ if ( stage > BudgetProposalStageEnum . ProposalOwnership ) {
457451 await this . fillupProblemStatementAndBenefitsForm (
458452 budgetProposal . problemStatementAndBenefits
459453 ) ;
460454 }
461455
462- if ( stage > 4 ) {
456+ if ( stage > BudgetProposalStageEnum . ProblemStatementAndBenefits ) {
463457 await this . fillupProposalDetailsForm ( budgetProposal . proposalDetails ) ;
464458 }
465- if ( stage > 5 ) {
459+ if ( stage > BudgetProposalStageEnum . ProposalDetails ) {
466460 await this . fillupCostingForm ( budgetProposal . costing ) ;
467461 }
468- if ( stage > 6 ) {
462+ if ( stage > BudgetProposalStageEnum . Costing ) {
469463 await this . fillupFurtherInformation ( budgetProposal . furtherInformation ) ;
470464 }
471- if ( stage > 7 ) {
465+ if ( stage > BudgetProposalStageEnum . FurtherInformation ) {
472466 await this . intersectNamedAdministratorSelect . click ( ) ;
473467
474468 await this . page
@@ -558,9 +552,6 @@ export default class BudgetDiscussionSubmissionPage {
558552 generateValidProposalOwnerShip ( ) : BudgetProposalOwnershipProps {
559553 return {
560554 companyType : faker . helpers . arrayElement ( Object . values ( CompanyEnum ) ) ,
561- publicChampion : faker . helpers . arrayElement (
562- Object . values ( ProposalChampionEnum )
563- ) ,
564555 contactDetails : faker . internet . email ( ) ,
565556 groupName : faker . company . name ( ) ,
566557 groupType : faker . company . buzzVerb ( ) ,
@@ -623,7 +614,6 @@ export default class BudgetDiscussionSubmissionPage {
623614
624615 generateValidBudgetProposalInformation ( ) : BudgetProposalProps {
625616 return {
626- contactInformation : this . generateValidBudgetProposalContactInformation ( ) ,
627617 proposalOwnership : this . generateValidProposalOwnerShip ( ) ,
628618 problemStatementAndBenefits :
629619 this . generateValidBudgetProposalProblemStatementAndBenefits ( ) ,
@@ -640,17 +630,15 @@ export default class BudgetDiscussionSubmissionPage {
640630 if ( fillAllDetails ) {
641631 await this . fillupForm ( budgetProposal ) ;
642632 } else {
643- await this . fillupContactInformationForm (
644- budgetProposal . contactInformation
645- ) ;
633+ await this . fillupProposalOwnershipForm ( budgetProposal . proposalOwnership ) ;
646634 }
647635
648636 await this . saveDraftBtn . click ( ) ;
649637 await this . closeDraftBtn . click ( ) ;
650638 await this . cancelBtn . click ( ) ;
651639 await this . createBudgetProposalBtn . click ( ) ;
652640
653- return fillAllDetails ? budgetProposal : budgetProposal . contactInformation ;
641+ return fillAllDetails ? budgetProposal : budgetProposal . proposalOwnership ;
654642 }
655643
656644 async createBudgetProposal ( ) : Promise < {
@@ -678,42 +666,10 @@ export default class BudgetDiscussionSubmissionPage {
678666 async validateReviewBudgetProposal (
679667 proposalInformations : BudgetProposalProps
680668 ) {
681- // contact information
682- await expect ( this . beneficiaryFullNameContent ) . toHaveText (
683- proposalInformations . contactInformation . beneficiaryFullName
684- ) ;
685- await expect ( this . beneficiaryCountryOfResidenceContent ) . toHaveText (
686- proposalInformations . contactInformation . beneficiaryCountry
687- ) ;
688- //BUG missing testId
689- await expect (
690- this . currentPage . getByText (
691- proposalInformations . contactInformation . beneficiaryNationality ,
692- { exact : true }
693- )
694- ) . toBeVisible ( ) ;
695- //BUG missing testId
696- await expect (
697- this . currentPage . getByText (
698- proposalInformations . contactInformation . submissionLeadEmail ,
699- { exact : true }
700- )
701- ) . toBeVisible ( ) ;
702- //BUG missing testId
703- await expect (
704- this . currentPage . getByText (
705- proposalInformations . contactInformation . submissionLeadFullName ,
706- { exact : true }
707- )
708- ) . toBeVisible ( ) ;
709-
710669 // proposal ownership
711670 await expect ( this . companyTypeContent ) . toHaveText (
712671 proposalInformations . proposalOwnership . companyType
713672 ) ;
714- await expect ( this . providePreferredContent ) . toHaveText (
715- proposalInformations . proposalOwnership . publicChampion
716- ) ;
717673 await expect ( this . socialHandlesContent ) . toHaveText (
718674 proposalInformations . proposalOwnership . contactDetails
719675 ) ;
0 commit comments