Skip to content

Commit 3481070

Browse files
authored
Merge pull request #3460 from IntersectMBO/fix/proposal-budget-test
Fix/proposal budget test
2 parents 641f981 + 4b3eeaa commit 3481070

File tree

7 files changed

+118
-162
lines changed

7 files changed

+118
-162
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,6 @@ export default class BudgetDiscussionDetailsPage {
144144
await this.readMoreBtn.click();
145145

146146
// proposal ownership validation
147-
await expect(this.publicProposalChampionContent).toHaveText(
148-
budgetProposal.proposalOwnership.publicChampion
149-
);
150147
await expect(this.socialHandlesContent).toHaveText(
151148
budgetProposal.proposalOwnership.contactDetails
152149
);

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

Lines changed: 15 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import environments from "@constants/environments";
2-
import { fa, faker } from "@faker-js/faker";
2+
import { faker } from "@faker-js/faker";
33
import { extractProposalIdFromUrl } from "@helpers/string";
44
import { Page, expect } from "@playwright/test";
55
import {
@@ -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
);

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ export default class LoginPage {
4747
// Handle multiple stake keys
4848
if (stakeKeys.length > 1) {
4949
await this.page
50-
.getByTestId(`${rewardAddresses[0]}-radio`).locator('div').first()
50+
.getByTestId(`${rewardAddresses[0]}-radio`)
51+
.locator("div")
52+
.first()
5153
.click({ force: true });
5254
await this.page.getByTestId("select-button").click();
5355
}

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -352,17 +352,8 @@ export enum CompanyEnum {
352352
Group = "Group",
353353
}
354354

355-
export type ProposalChampionType =
356-
| "Beneficiary listed above"
357-
| "Submission lead listed above";
358-
export enum ProposalChampionEnum {
359-
BeneficiaryListedAbove = "Beneficiary listed above",
360-
SubmissionLeadListedAbove = "Submission lead listed above",
361-
}
362-
363355
export interface BudgetProposalOwnershipProps {
364356
companyType: CompanyType;
365-
publicChampion: ProposalChampionType;
366357
contactDetails: string;
367358
groupName?: string;
368359
groupType?: string;
@@ -510,11 +501,20 @@ export interface AdministrationAndAuditingProps {
510501
}
511502

512503
export interface BudgetProposalProps {
513-
contactInformation: BudgetProposalContactInformationProps;
514504
proposalOwnership: BudgetProposalOwnershipProps;
515505
problemStatementAndBenefits: BudgetProposalProblemStatementAndBenefitProps;
516506
proposalDetails: BudgetProposalDetailsProps;
517507
costing: BudgetCostingProps;
518508
furtherInformation: Array<ProposalLink>;
519509
administrationAndAuditing: AdministrationAndAuditingProps;
520510
}
511+
512+
export enum BudgetProposalStageEnum {
513+
ProposalOwnership = 1,
514+
ProblemStatementAndBenefits = 2,
515+
ProposalDetails = 3,
516+
Costing = 4,
517+
FurtherInformation = 5,
518+
AdministrationAndAuditing = 6,
519+
Review = 7,
520+
}

tests/govtool-frontend/playwright/package-lock.json

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/govtool-frontend/playwright/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"generate-wallets": "ts-node ./generate_wallets.ts 24"
3030
},
3131
"dependencies": {
32-
"@cardanoapi/cardano-test-wallet": "^3.0.0",
32+
"@cardanoapi/cardano-test-wallet": "^3.2.0",
3333
"@faker-js/faker": "^8.4.1",
3434
"@noble/curves": "^1.3.0",
3535
"@noble/ed25519": "^2.0.0",

0 commit comments

Comments
 (0)