Skip to content

Commit 4b3eeaa

Browse files
committed
chore: refactor fillupForm method to use BudgetProposalStageEnum for stage management
1 parent 6b970e8 commit 4b3eeaa

File tree

3 files changed

+37
-10
lines changed

3 files changed

+37
-10
lines changed

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
BudgetProposalOwnershipProps,
1212
BudgetProposalProblemStatementAndBenefitProps,
1313
BudgetProposalProps,
14+
BudgetProposalStageEnum,
1415
CommitteeAlignmentEnum,
1516
CompanyEnum,
1617
LocationEnum,
@@ -440,25 +441,28 @@ export default class BudgetDiscussionSubmissionPage {
440441
await this.continueBtn.click();
441442
}
442443

443-
async fillupForm(budgetProposal: BudgetProposalProps, stage = 7) {
444+
async fillupForm(
445+
budgetProposal: BudgetProposalProps,
446+
stage: BudgetProposalStageEnum = BudgetProposalStageEnum.AdministrationAndAuditing
447+
) {
444448
await this.fillupProposalOwnershipForm(budgetProposal.proposalOwnership);
445449

446-
if (stage > 2) {
450+
if (stage > BudgetProposalStageEnum.ProposalOwnership) {
447451
await this.fillupProblemStatementAndBenefitsForm(
448452
budgetProposal.problemStatementAndBenefits
449453
);
450454
}
451455

452-
if (stage > 3) {
456+
if (stage > BudgetProposalStageEnum.ProblemStatementAndBenefits) {
453457
await this.fillupProposalDetailsForm(budgetProposal.proposalDetails);
454458
}
455-
if (stage > 4) {
459+
if (stage > BudgetProposalStageEnum.ProposalDetails) {
456460
await this.fillupCostingForm(budgetProposal.costing);
457461
}
458-
if (stage > 5) {
462+
if (stage > BudgetProposalStageEnum.Costing) {
459463
await this.fillupFurtherInformation(budgetProposal.furtherInformation);
460464
}
461-
if (stage > 6) {
465+
if (stage > BudgetProposalStageEnum.FurtherInformation) {
462466
await this.intersectNamedAdministratorSelect.click();
463467

464468
await this.page

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,3 +508,13 @@ export interface BudgetProposalProps {
508508
furtherInformation: Array<ProposalLink>;
509509
administrationAndAuditing: AdministrationAndAuditingProps;
510510
}
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/tests/12-proposal-budget-submission/proposalBudgetSubmission.loggedin.spec.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { expect } from "@playwright/test";
1313
import {
1414
BudgetProposalOwnershipProps,
1515
BudgetProposalProps,
16+
BudgetProposalStageEnum,
1617
CompanyEnum,
1718
} from "@types";
1819
import { allure } from "allure-playwright";
@@ -115,7 +116,10 @@ test.describe("Budget proposal 01 wallet", () => {
115116
test("12D_3. Should verify all field of “proposal details” section", async () => {
116117
const proposalInformation =
117118
budgetProposalSubmissionPage.generateValidBudgetProposalInformation();
118-
await budgetProposalSubmissionPage.fillupForm(proposalInformation, 3);
119+
await budgetProposalSubmissionPage.fillupForm(
120+
proposalInformation,
121+
BudgetProposalStageEnum.ProblemStatementAndBenefits
122+
);
119123

120124
await expect(
121125
budgetProposalSubmissionPage.proposalNameInput
@@ -143,7 +147,10 @@ test.describe("Budget proposal 01 wallet", () => {
143147
test("12D_4. Should verify all field of “costing” section", async () => {
144148
const proposalInformation =
145149
budgetProposalSubmissionPage.generateValidBudgetProposalInformation();
146-
await budgetProposalSubmissionPage.fillupForm(proposalInformation, 4);
150+
await budgetProposalSubmissionPage.fillupForm(
151+
proposalInformation,
152+
BudgetProposalStageEnum.ProposalDetails
153+
);
147154

148155
await expect(budgetProposalSubmissionPage.adaAmountInput).toBeVisible();
149156
await expect(
@@ -163,7 +170,10 @@ test.describe("Budget proposal 01 wallet", () => {
163170
test("12D_5. Should verify all field of “further information” section", async () => {
164171
const proposalInformation =
165172
budgetProposalSubmissionPage.generateValidBudgetProposalInformation();
166-
await budgetProposalSubmissionPage.fillupForm(proposalInformation, 5);
173+
await budgetProposalSubmissionPage.fillupForm(
174+
proposalInformation,
175+
BudgetProposalStageEnum.Costing
176+
);
167177

168178
await expect(budgetProposalSubmissionPage.linkTextInput).toBeVisible();
169179
await expect(budgetProposalSubmissionPage.linkUrlInput).toBeVisible();
@@ -173,7 +183,10 @@ test.describe("Budget proposal 01 wallet", () => {
173183
test("12D_6. Should verify all field of “administration and auditing” section", async () => {
174184
const proposalInformation =
175185
budgetProposalSubmissionPage.generateValidBudgetProposalInformation();
176-
await budgetProposalSubmissionPage.fillupForm(proposalInformation, 6);
186+
await budgetProposalSubmissionPage.fillupForm(
187+
proposalInformation,
188+
BudgetProposalStageEnum.FurtherInformation
189+
);
177190

178191
await expect(
179192
budgetProposalSubmissionPage.intersectNamedAdministratorSelect

0 commit comments

Comments
 (0)