Skip to content

Commit c83e974

Browse files
authored
Merge pull request #3384 from IntersectMBO/tests/proposal-budget
tests: validate budget propsal review your submission
2 parents a689982 + 13007b6 commit c83e974

File tree

6 files changed

+301
-38
lines changed

6 files changed

+301
-38
lines changed

tests/govtool-frontend/playwright/lib/pages/budgetDiscussionDetailsPage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export default class BudgetDiscussionDetailsPage {
199199
budgetProposal.costing.adaAmount.toString()
200200
);
201201
await expect(this.costingConversionRateContent).toHaveText(
202-
budgetProposal.costing.usaToAdaCnversionRate.toString()
202+
budgetProposal.costing.adaToUsdConversionRate.toString()
203203
);
204204
await expect(this.constingPreferedCurrencyContent).toHaveText(
205205
budgetProposal.costing.preferredCurrency
@@ -218,7 +218,7 @@ export default class BudgetDiscussionDetailsPage {
218218

219219
// administration and auditing validation
220220
await expect(this.includeAsAuditorContent).toHaveText(
221-
budgetProposal.administrationAndAuditing.intersectAdministration
221+
budgetProposal.administrationAndAuditing.intersectAdministration === true
222222
? "Yes"
223223
: "No"
224224
);

tests/govtool-frontend/playwright/lib/pages/budgetDiscussionSubmissionPage.ts

Lines changed: 261 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,93 @@ export default class BudgetDiscussionSubmissionPage {
170170
readonly linkTextContent = this.page.getByTestId("link-0-text-content");
171171
readonly linkUrlContent = this.page.getByTestId("link-0-url-content");
172172

173+
// contact information
174+
readonly beneficiaryFullNameContent = this.page.getByTestId(
175+
"beneficiary-full-name-content"
176+
);
177+
readonly beneficiaryCountryOfResidenceContent = this.page.getByTestId(
178+
"beneficiary-country-of-residence-content"
179+
);
180+
181+
// proposal ownership
182+
readonly companyTypeContent = this.page.getByTestId(
183+
"submited-on-behalf-content"
184+
);
185+
readonly groupNameContent = this.page.getByTestId("group-name-content");
186+
readonly groupTypeContent = this.page.getByTestId("group-type-content");
187+
readonly groupKeyIdentityContent = this.page.getByTestId(
188+
"group-identity-information-content"
189+
);
190+
readonly companyNameContent = this.page.getByTestId("company-name-content");
191+
readonly companyDomainNameContent = this.page.getByTestId(
192+
"company-domain-name-content"
193+
);
194+
readonly countryOfIncorporationContent = this.page.getByTestId(
195+
"country-of-incorporation-content"
196+
);
197+
readonly providePreferredContent = this.page.getByTestId(
198+
"provide-preferred-content"
199+
);
200+
readonly socialHandlesContent = this.page.getByTestId(
201+
"social-handles-content"
202+
);
203+
204+
// problem statements and benefits
205+
readonly problemStatementContent = this.page.getByTestId(
206+
"problem-statement-content"
207+
);
208+
readonly proposalBenefitsContent = this.page.getByTestId(
209+
"proposal-benefit-content"
210+
);
211+
readonly roadmapContent = this.page.getByTestId("roadmap-content");
212+
readonly budgetCategoryContent = this.page.getByTestId(
213+
"budget-category-content"
214+
);
215+
readonly committeeContent = this.page.getByTestId("committee-content");
216+
readonly endorsementContent = this.page.getByTestId("endorsement-content");
217+
218+
// proposal details
219+
readonly proposalNameContent = this.page.getByTestId("proposal-name-content");
220+
readonly proposalDescriptionContent = this.page.getByTestId(
221+
"proposal-description-content"
222+
);
223+
readonly proposalKeyDependenciesContent = this.page.getByTestId(
224+
"key-dependencies-content"
225+
);
226+
readonly proposalMaintainAndSupportContent = this.page.getByTestId(
227+
"maintain-and-support-content"
228+
);
229+
readonly proposalDeliverablesContent = this.page.getByTestId(
230+
"key-proposal-deliverables-content"
231+
);
232+
readonly resourcingDurationEstimatesContent = this.page.getByTestId(
233+
"resourcing-duration-estimates-content"
234+
);
235+
readonly experienceContent = this.page.getByTestId("experience-content");
236+
readonly contractingContent = this.page.getByTestId(
237+
"contracting-type-name-content"
238+
);
239+
240+
// costing
241+
readonly adaAmountContent = this.page.getByTestId("ada-amount-content");
242+
readonly adaToUsdConversionRateContent = this.page.getByTestId(
243+
"usd-to-ada-conversion-rate-content"
244+
); // BUG typo
245+
readonly preferredCurrencyContent = this.page.getByTestId(
246+
"preferred-currency-content"
247+
);
248+
readonly preferredCurrencyAmountContent = this.page.getByTestId(
249+
"amount-in-preferred-currency-content"
250+
);
251+
readonly costBreakdownContent = this.page.getByTestId(
252+
"cost-breakdown-content"
253+
);
254+
255+
// administration and auditing
256+
readonly intersectAdministrationContent = this.page.getByTestId(
257+
"intersect-named-administrator-content"
258+
);
259+
173260
constructor(private readonly page: Page) {}
174261

175262
get currentPage(): Page {
@@ -195,13 +282,13 @@ export default class BudgetDiscussionSubmissionPage {
195282
await this.beneficiaryCountrySelect.click();
196283
await this.page
197284
.getByTestId(
198-
`${contactInformation.beneficiaryCountry.toLowerCase()}-button`
285+
`${contactInformation.beneficiaryCountry.toLowerCase().replace(/ /g, "-")}-button`
199286
)
200287
.click();
201288
await this.beneficiaryNationalitySelect.click();
202289
await this.page
203290
.getByTestId(
204-
`${contactInformation.beneficiaryNationality.toLowerCase()}-button`
291+
`${contactInformation.beneficiaryNationality.toLowerCase().replace(/ /g, "-")}-button`
205292
)
206293
.click();
207294

@@ -245,7 +332,7 @@ export default class BudgetDiscussionSubmissionPage {
245332
await this.countryOfIncorporationBtn.click();
246333
await this.page
247334
.getByTestId(
248-
`${proposalOwnership.countryOfIncorportation.toLowerCase()}-country-of-incorporation-button`
335+
`${proposalOwnership.countryOfIncorportation.toLowerCase().replace(/ /g, "-")}-country-of-incorporation-button`
249336
)
250337
.click();
251338
}
@@ -330,7 +417,7 @@ export default class BudgetDiscussionSubmissionPage {
330417
async fillupCostingForm(costing: BudgetCostingProps) {
331418
await this.adaAmountInput.fill(costing.adaAmount.toString());
332419
await this.usaToAdaCnversionRateInput.fill(
333-
costing.usaToAdaCnversionRate.toString()
420+
costing.adaToUsdConversionRate.toString()
334421
);
335422
await this.preferredCurrencySelect.click();
336423
await this.page
@@ -439,12 +526,12 @@ export default class BudgetDiscussionSubmissionPage {
439526
return {
440527
beneficiaryFullName: faker.person.fullName(),
441528
beneficiaryEmail: faker.internet.email(),
442-
beneficiaryCountry: faker.helpers
443-
.arrayElement(Object.values(LocationEnum))
444-
.replace(/ /g, "-"),
445-
beneficiaryNationality: faker.helpers
446-
.arrayElement(Object.values(LocationEnum))
447-
.replace(/ /g, "-"),
529+
beneficiaryCountry: faker.helpers.arrayElement(
530+
Object.values(LocationEnum)
531+
),
532+
beneficiaryNationality: faker.helpers.arrayElement(
533+
Object.values(LocationEnum)
534+
),
448535
submissionLeadFullName: faker.person.fullName(),
449536
submissionLeadEmail: faker.internet.email(),
450537
};
@@ -480,9 +567,9 @@ export default class BudgetDiscussionSubmissionPage {
480567
groupKeyIdentity: faker.lorem.paragraph(2),
481568
companyName: faker.company.name(),
482569
companyDomainName: faker.internet.domainName(),
483-
countryOfIncorportation: faker.helpers
484-
.arrayElement(Object.values(LocationEnum))
485-
.replace(/ /g, "-"),
570+
countryOfIncorportation: faker.helpers.arrayElement(
571+
Object.values(LocationEnum)
572+
),
486573
};
487574
}
488575

@@ -505,7 +592,7 @@ export default class BudgetDiscussionSubmissionPage {
505592
generateValidCosting(): BudgetCostingProps {
506593
return {
507594
adaAmount: faker.number.int({ min: 100, max: 10000 }),
508-
usaToAdaCnversionRate: faker.number.int({ min: 1, max: 100 }),
595+
adaToUsdConversionRate: faker.number.int({ min: 1, max: 100 }),
509596
preferredCurrency: faker.helpers.arrayElement(
510597
Object.values(PreferredCurrencyEnum)
511598
),
@@ -587,4 +674,164 @@ export default class BudgetDiscussionSubmissionPage {
587674
proposalDetails: budgetProposalRequest,
588675
};
589676
}
677+
678+
async validateReviewBudgetProposal(
679+
proposalInformations: BudgetProposalProps
680+
) {
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+
710+
// proposal ownership
711+
await expect(this.companyTypeContent).toHaveText(
712+
proposalInformations.proposalOwnership.companyType
713+
);
714+
await expect(this.providePreferredContent).toHaveText(
715+
proposalInformations.proposalOwnership.publicChampion
716+
);
717+
await expect(this.socialHandlesContent).toHaveText(
718+
proposalInformations.proposalOwnership.contactDetails
719+
);
720+
721+
if (
722+
proposalInformations.proposalOwnership.companyType === CompanyEnum.Company
723+
) {
724+
await expect(this.companyNameContent).toHaveText(
725+
proposalInformations.proposalOwnership.companyName
726+
);
727+
await expect(this.companyDomainNameContent).toHaveText(
728+
proposalInformations.proposalOwnership.companyDomainName
729+
);
730+
await expect(this.countryOfIncorporationContent).toHaveText(
731+
proposalInformations.proposalOwnership.countryOfIncorportation
732+
);
733+
}
734+
if (
735+
proposalInformations.proposalOwnership.companyType === CompanyEnum.Group
736+
) {
737+
await expect(this.groupNameContent).toHaveText(
738+
proposalInformations.proposalOwnership.groupName
739+
);
740+
await expect(this.groupTypeContent).toHaveText(
741+
proposalInformations.proposalOwnership.groupType
742+
);
743+
await expect(this.groupKeyIdentityContent).toHaveText(
744+
proposalInformations.proposalOwnership.groupKeyIdentity
745+
);
746+
}
747+
748+
// problem statement and proposal benefits
749+
await expect(this.problemStatementContent).toHaveText(
750+
proposalInformations.problemStatementAndBenefits.problemStatement
751+
);
752+
await expect(this.proposalBenefitsContent).toHaveText(
753+
proposalInformations.problemStatementAndBenefits.proposalBenefits
754+
);
755+
await expect(this.roadmapContent).toHaveText(
756+
proposalInformations.problemStatementAndBenefits.roadmapName
757+
);
758+
await expect(this.budgetCategoryContent).toHaveText(
759+
proposalInformations.problemStatementAndBenefits.budgetDiscussionType
760+
);
761+
await expect(this.committeeContent).toHaveText(
762+
proposalInformations.problemStatementAndBenefits.committeeAlignmentType
763+
);
764+
await expect(this.endorsementContent).toHaveText(
765+
proposalInformations.problemStatementAndBenefits.suplimentaryEndorsement
766+
);
767+
768+
// proposal details
769+
await expect(this.proposalNameContent).toHaveText(
770+
proposalInformations.proposalDetails.proposalName
771+
);
772+
await expect(this.proposalDescriptionContent).toHaveText(
773+
proposalInformations.proposalDetails.proposalDescription
774+
);
775+
await expect(this.proposalKeyDependenciesContent).toHaveText(
776+
proposalInformations.proposalDetails.proposalKeyDependencies
777+
);
778+
await expect(this.proposalMaintainAndSupportContent).toHaveText(
779+
proposalInformations.proposalDetails.proposalMaintainAndSupport
780+
);
781+
await expect(this.proposalDeliverablesContent).toHaveText(
782+
proposalInformations.proposalDetails.milestones
783+
);
784+
await expect(this.resourcingDurationEstimatesContent).toHaveText(
785+
proposalInformations.proposalDetails.teamSizeAndDuration
786+
);
787+
await expect(this.experienceContent).toHaveText(
788+
proposalInformations.proposalDetails.previousExperience
789+
);
790+
await expect(this.contractingContent).toHaveText(
791+
proposalInformations.proposalDetails.contracting
792+
);
793+
794+
// costing
795+
await expect(this.adaAmountContent).toHaveText(
796+
proposalInformations.costing.adaAmount.toString()
797+
);
798+
await expect(this.adaToUsdConversionRateContent).toHaveText(
799+
proposalInformations.costing.adaToUsdConversionRate.toString()
800+
);
801+
802+
const preferredCurrencyShortForm = Object.keys(PreferredCurrencyEnum).find(
803+
(key) =>
804+
PreferredCurrencyEnum[key as keyof typeof PreferredCurrencyEnum] ===
805+
proposalInformations.costing.preferredCurrency
806+
);
807+
808+
await expect(this.preferredCurrencyContent).toHaveText(
809+
preferredCurrencyShortForm
810+
);
811+
await expect(this.preferredCurrencyAmountContent).toHaveText(
812+
proposalInformations.costing.AmountInPreferredCurrency.toString()
813+
);
814+
await expect(this.costBreakdownContent).toHaveText(
815+
proposalInformations.costing.costBreakdown
816+
);
817+
818+
// further information
819+
for (let i = 0; i < proposalInformations.furtherInformation.length; i++) {
820+
//BUG missing testId
821+
await expect(
822+
this.currentPage.getByRole("link", {
823+
name: proposalInformations.furtherInformation[i].prop_link_text,
824+
exact: true,
825+
})
826+
).toBeVisible();
827+
}
828+
829+
// administration and auditing
830+
await expect(this.intersectAdministrationContent).toHaveText(
831+
proposalInformations.administrationAndAuditing.intersectAdministration ===
832+
true
833+
? "Yes"
834+
: "No"
835+
);
836+
}
590837
}

tests/govtool-frontend/playwright/lib/types.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -489,16 +489,16 @@ export type preferredCurrencyType =
489489
| "Nepalese Rupee";
490490

491491
export enum PreferredCurrencyEnum {
492-
UnitedStatesDollar = "United States Dollar",
493-
Euro = "Euro",
494-
JapaneseYen = "Japanese Yen",
495-
AustralianDollar = "Australian Dollar",
496-
NepaleseRupee = "Nepalese Rupee",
492+
USD = "United States Dollar",
493+
EUR = "Euro",
494+
JPY = "Japanese Yen",
495+
AUD = "Australian Dollar",
496+
NPR = "Nepalese Rupee",
497497
}
498498

499499
export interface BudgetCostingProps {
500500
adaAmount: number;
501-
usaToAdaCnversionRate: number;
501+
adaToUsdConversionRate: number;
502502
preferredCurrency: preferredCurrencyType;
503503
AmountInPreferredCurrency: number;
504504
costBreakdown: string;

tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.dRep.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ test.describe("Budget proposal dRep behaviour", () => {
8080
const comment = faker.lorem.paragraph(2);
8181
const budgetDiscussionPage = new BudgetDiscussionPage(page);
8282
await budgetDiscussionPage.goto();
83+
await budgetDiscussionPage.verifyIdentityBtn.click();
8384
const budgetDiscussionDetailsPage =
8485
await budgetDiscussionPage.viewFirstProposal();
8586
await budgetDiscussionDetailsPage.addComment(comment);

0 commit comments

Comments
 (0)