Skip to content

Commit ecce28d

Browse files
committed
tests: budget discussion form field visibility
1 parent ce88512 commit ecce28d

File tree

2 files changed

+214
-43
lines changed

2 files changed

+214
-43
lines changed

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

Lines changed: 47 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ export default class BudgetDiscussionSubmissionPage {
7474

7575
// proposal-ownership
7676
readonly companyNameInput = this.page.getByLabel("Company Name *"); //BUG missing test Ids
77-
readonly companyDomainName = this.page.getByLabel("Company Domain Name *"); //BUG missing test Ids
77+
readonly companyDomainNameInput = this.page.getByLabel(
78+
"Company Domain Name *"
79+
); //BUG missing test Ids
7880
readonly groupNameInput = this.page.getByLabel("Group Name *"); //BUG missing test Ids
7981
readonly groupTypeInput = this.page.getByLabel("Type of Group *"); //BUG missing test Ids
8082
readonly keyInformationOfGroupInput = this.page.getByLabel(
@@ -144,7 +146,9 @@ export default class BudgetDiscussionSubmissionPage {
144146
);
145147

146148
readonly companyTypeSelect = this.page.getByTestId("beneficiary-type");
147-
readonly publicChampion = this.page.getByTestId("proposal-public-champion");
149+
readonly publicChampionSelect = this.page.getByTestId(
150+
"proposal-public-champion"
151+
);
148152

149153
readonly roadmapNameSelect = this.page.getByTestId("roadmap-name");
150154
readonly budgetDiscussionTypeSelect = this.page.getByTestId(
@@ -168,6 +172,10 @@ export default class BudgetDiscussionSubmissionPage {
168172

169173
constructor(private readonly page: Page) {}
170174

175+
get currentPage(): Page {
176+
return this.page;
177+
}
178+
171179
async goto() {
172180
await this.page.goto(`${environments.frontendUrl}/budget_discussion`);
173181

@@ -215,7 +223,7 @@ export default class BudgetDiscussionSubmissionPage {
215223
.getByRole("option", { name: proposalOwnership.companyType })
216224
.click(); //BUG missing testId
217225

218-
await this.publicChampion.click();
226+
await this.publicChampionSelect.click();
219227
await this.page
220228
.getByRole("option", { name: proposalOwnership.publicChampion })
221229
.click(); //BUG missing testId
@@ -231,7 +239,9 @@ export default class BudgetDiscussionSubmissionPage {
231239
}
232240
if (proposalOwnership.companyType === "Company") {
233241
await this.companyNameInput.fill(proposalOwnership.companyName);
234-
await this.companyDomainName.fill(proposalOwnership.companyDomainName);
242+
await this.companyDomainNameInput.fill(
243+
proposalOwnership.companyDomainName
244+
);
235245
await this.countryOfIncorporationBtn.click();
236246
await this.page
237247
.getByTestId(
@@ -349,35 +359,46 @@ export default class BudgetDiscussionSubmissionPage {
349359
await this.continueBtn.click();
350360
}
351361

352-
async fillupForm(budgetProposal: BudgetProposalProps) {
362+
async fillupForm(budgetProposal: BudgetProposalProps, stage = 8) {
353363
await this.fillupContactInformationForm(budgetProposal.contactInformation);
354364

355-
await this.fillupProposalOwnershipForm(budgetProposal.proposalOwnership);
365+
if (stage > 2) {
366+
await this.fillupProposalOwnershipForm(budgetProposal.proposalOwnership);
367+
}
356368

357-
await this.fillupProblemStatementAndBenefitsForm(
358-
budgetProposal.problemStatementAndBenefits
359-
);
369+
if (stage > 3) {
370+
await this.fillupProblemStatementAndBenefitsForm(
371+
budgetProposal.problemStatementAndBenefits
372+
);
373+
}
360374

361-
await this.fillupProposalDetailsForm(budgetProposal.proposalDetails);
362-
await this.fillupCostingForm(budgetProposal.costing);
363-
await this.fillupFurtherInformation(budgetProposal.furtherInformation);
375+
if (stage > 4) {
376+
await this.fillupProposalDetailsForm(budgetProposal.proposalDetails);
377+
}
378+
if (stage > 5) {
379+
await this.fillupCostingForm(budgetProposal.costing);
380+
}
381+
if (stage > 6) {
382+
await this.fillupFurtherInformation(budgetProposal.furtherInformation);
383+
}
384+
if (stage > 7) {
385+
await this.intersectNamedAdministratorSelect.click();
364386

365-
await this.intersectNamedAdministratorSelect.click();
387+
await this.page
388+
.getByTestId(
389+
`${budgetProposal.administrationAndAuditing.intersectAdministration}-button`
390+
)
391+
.click();
392+
if (!budgetProposal.administrationAndAuditing.intersectAdministration) {
393+
await this.venderDetailsInput.fill(
394+
budgetProposal.administrationAndAuditing.venderDetails
395+
);
396+
}
397+
await this.continueBtn.click();
366398

367-
await this.page
368-
.getByTestId(
369-
`${budgetProposal.administrationAndAuditing.intersectAdministration}-button`
370-
)
371-
.click();
372-
if (!budgetProposal.administrationAndAuditing.intersectAdministration) {
373-
await this.venderDetailsInput.fill(
374-
budgetProposal.administrationAndAuditing.venderDetails
375-
);
399+
await this.submitCheckbox.click();
400+
await this.continueBtn.click();
376401
}
377-
await this.continueBtn.click();
378-
379-
await this.submitCheckbox.click();
380-
await this.continueBtn.click();
381402
}
382403

383404
async getAllDrafts() {

tests/govtool-frontend/playwright/tests/12-proposal-budget-submission/proposalBudgetSubmission.loggedin.spec.ts

Lines changed: 167 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { expect } from "@playwright/test";
1313
import {
1414
BudgetProposalContactInformationProps,
1515
BudgetProposalProps,
16+
CompanyEnum,
1617
} from "@types";
1718

1819
test.beforeEach(async () => {
@@ -40,34 +41,183 @@ test.describe("Budget proposal 01 wallet", () => {
4041
test.describe("Budget proposal with proposalSubmissionPageNavigation", () => {
4142
let budgetProposalSubmissionPage: BudgetDiscussionSubmissionPage;
4243
test.beforeEach(async ({ page }) => {
43-
const budgetSubmissionPage = new BudgetDiscussionSubmissionPage(page);
44-
await budgetSubmissionPage.goto();
44+
budgetProposalSubmissionPage = new BudgetDiscussionSubmissionPage(page);
45+
await budgetProposalSubmissionPage.goto();
4546
});
47+
4648
test.describe("Budget proposal field verification", () => {
47-
test("12D_1. Should verify all field of “contact information” section", async ({}) => {});
48-
test("12D_2. Should verify all field of “proposal ownership” section", async ({}) => {});
49-
test("12D_3. Should verify all field of “problem statements and proposal benefits” section", async ({}) => {});
50-
test("12D_4. Should verify all field of “costing” section", async ({}) => {});
51-
test("12D_5. Should verify all field of “further information” section", async ({}) => {});
52-
test("12D_6. Should verify all field of “administration and auditing” section", async ({}) => {});
53-
test("12D_7. Should verify all field of “submit” section", async ({}) => {});
49+
test("12D_1. Should verify all field of “contact information” section", async () => {
50+
await expect(
51+
budgetProposalSubmissionPage.beneficiaryFullNameInput
52+
).toBeVisible();
53+
await expect(
54+
budgetProposalSubmissionPage.beneficiaryEmailInput
55+
).toBeVisible();
56+
await expect(
57+
budgetProposalSubmissionPage.beneficiaryCountrySelect
58+
).toBeVisible();
59+
await expect(
60+
budgetProposalSubmissionPage.beneficiaryNationalitySelect
61+
).toBeVisible();
62+
await expect(
63+
budgetProposalSubmissionPage.submissionLeadFullNameInput
64+
).toBeVisible();
65+
});
66+
67+
test("12D_2. Should verify all field of “proposal ownership” section", async () => {
68+
const proposalContactInformationContent =
69+
budgetProposalSubmissionPage.generateValidBudgetProposalContactInformation();
70+
await budgetProposalSubmissionPage.fillupContactInformationForm(
71+
proposalContactInformationContent
72+
);
73+
74+
// default field
75+
await expect(
76+
budgetProposalSubmissionPage.companyTypeSelect
77+
).toBeVisible();
78+
await expect(
79+
budgetProposalSubmissionPage.publicChampionSelect
80+
).toBeVisible();
81+
await expect(
82+
budgetProposalSubmissionPage.contactDetailsInput
83+
).toBeVisible();
84+
85+
// company type field
86+
await budgetProposalSubmissionPage.companyTypeSelect.click();
87+
await budgetProposalSubmissionPage.currentPage
88+
.getByRole("option", { name: CompanyEnum.Company })
89+
.click(); //BUG missing testId
90+
91+
await expect(
92+
budgetProposalSubmissionPage.companyNameInput
93+
).toBeVisible();
94+
await expect(
95+
budgetProposalSubmissionPage.companyDomainNameInput
96+
).toBeVisible();
97+
await expect(
98+
budgetProposalSubmissionPage.countryOfIncorporationBtn
99+
).toBeVisible();
100+
101+
// group type field
102+
await budgetProposalSubmissionPage.companyTypeSelect.click();
103+
await budgetProposalSubmissionPage.currentPage
104+
.getByRole("option", { name: CompanyEnum.Group })
105+
.click(); //BUG missing testId
106+
await expect(budgetProposalSubmissionPage.groupNameInput).toBeVisible();
107+
await expect(budgetProposalSubmissionPage.groupTypeInput).toBeVisible();
108+
await expect(
109+
budgetProposalSubmissionPage.keyInformationOfGroupInput
110+
).toBeVisible();
111+
});
112+
113+
test("12D_3. Should verify all field of “problem statements and proposal benefits” section", async () => {
114+
const proposalInformation =
115+
budgetProposalSubmissionPage.generateValidBudgetProposalInformation();
116+
await budgetProposalSubmissionPage.fillupForm(proposalInformation, 3);
117+
118+
await expect(
119+
budgetProposalSubmissionPage.problemStatementInput
120+
).toBeVisible();
121+
await expect(
122+
budgetProposalSubmissionPage.proposalBenefitInput
123+
).toBeVisible();
124+
await expect(
125+
budgetProposalSubmissionPage.roadmapNameSelect
126+
).toBeVisible();
127+
await expect(
128+
budgetProposalSubmissionPage.budgetDiscussionTypeSelect
129+
).toBeVisible();
130+
await expect(
131+
budgetProposalSubmissionPage.committeeAlignmentTypeSelect
132+
).toBeVisible();
133+
await expect(
134+
budgetProposalSubmissionPage.suplimentaryEndorsementInput
135+
).toBeVisible();
136+
});
137+
138+
test("12D_4. Should verify all field of “proposal details” section", async () => {
139+
const proposalInformation =
140+
budgetProposalSubmissionPage.generateValidBudgetProposalInformation();
141+
await budgetProposalSubmissionPage.fillupForm(proposalInformation, 4);
142+
143+
await expect(
144+
budgetProposalSubmissionPage.proposalNameInput
145+
).toBeVisible();
146+
await expect(
147+
budgetProposalSubmissionPage.proposalDescriptionInput
148+
).toBeVisible();
149+
await expect(
150+
budgetProposalSubmissionPage.proposalKeyDependenciesInput
151+
).toBeVisible();
152+
await expect(
153+
budgetProposalSubmissionPage.milestonesInput
154+
).toBeVisible();
155+
await expect(
156+
budgetProposalSubmissionPage.teamSizeAndDurationInput
157+
).toBeVisible();
158+
await expect(
159+
budgetProposalSubmissionPage.previousExperienceInput
160+
).toBeVisible();
161+
await expect(
162+
budgetProposalSubmissionPage.contractingTypeSelect
163+
).toBeVisible();
164+
});
165+
166+
test("12D_5. Should verify all field of “costing” section", async () => {
167+
const proposalInformation =
168+
budgetProposalSubmissionPage.generateValidBudgetProposalInformation();
169+
await budgetProposalSubmissionPage.fillupForm(proposalInformation, 5);
170+
171+
await expect(budgetProposalSubmissionPage.adaAmountInput).toBeVisible();
172+
await expect(
173+
budgetProposalSubmissionPage.usaToAdaCnversionRateInput
174+
).toBeVisible();
175+
await expect(
176+
budgetProposalSubmissionPage.preferredCurrencySelect
177+
).toBeVisible();
178+
await expect(
179+
budgetProposalSubmissionPage.preferredCurrencyAmountInput
180+
).toBeVisible();
181+
await expect(
182+
budgetProposalSubmissionPage.costBreakdownInput
183+
).toBeVisible();
184+
});
185+
186+
test("12D_6. Should verify all field of “further information” section", async () => {
187+
const proposalInformation =
188+
budgetProposalSubmissionPage.generateValidBudgetProposalInformation();
189+
await budgetProposalSubmissionPage.fillupForm(proposalInformation, 6);
190+
191+
await expect(budgetProposalSubmissionPage.linkTextInput).toBeVisible();
192+
await expect(budgetProposalSubmissionPage.linkUrlInput).toBeVisible();
193+
await expect(budgetProposalSubmissionPage.addLinkBtn).toBeVisible();
194+
});
195+
196+
test("12D_7. Should verify all field of “administration and auditing” section", async () => {
197+
const proposalInformation =
198+
budgetProposalSubmissionPage.generateValidBudgetProposalInformation();
199+
await budgetProposalSubmissionPage.fillupForm(proposalInformation, 7);
200+
201+
await expect(
202+
budgetProposalSubmissionPage.intersectNamedAdministratorSelect
203+
).toBeVisible();
204+
});
54205
});
55206

56207
test.describe("Budget proposal field validation", () => {
57208
test("12E_1. Should accept valid data in “contact information” section", async ({}) => {});
58209
test("12E_2. Should accept valid data in “proposal ownership” section", async ({}) => {});
59210
test("12E_3. Should accept valid data in “problem statements and proposal benefits” section", async ({}) => {});
60-
test("12E_4. Should accept valid data in “costing” section", async ({}) => {});
61-
test("12E_5. Should accept valid data in “further information” section", async ({}) => {});
62-
test("12E_6. Should accept valid data in “administration and auditing” section", async ({}) => {});
63-
test("12E_7. Should accept valid data in “submit” section", async ({}) => {});
211+
test("12E_4. Should accept valid data in “proposal details” section", async ({}) => {});
212+
test("12E_5. Should accept valid data in “costing” section", async ({}) => {});
213+
test("12E_6. Should accept valid data in “further information” section", async ({}) => {});
214+
64215
test("12F_1. Should reject invalid data in “contact information” section", async ({}) => {});
65216
test("12F_2. Should reject invalid data in “proposal ownership” section", async ({}) => {});
66217
test("12F_3. Should reject invalid data in “problem statements and proposal benefits” section", async ({}) => {});
67-
test("12F_4. Should reject invalid data in “costing” section", async ({}) => {});
68-
test("12F_5. Should reject invalid data in “further information” section", async ({}) => {});
69-
test("12F_6. Should reject invalid data in “administration and auditing” section", async ({}) => {});
70-
test("12F_7. Should reject invalid data in “submit” section", async ({}) => {});
218+
test("12E_4. Should accept invalid data in “proposal details” section", async ({}) => {});
219+
test("12F_5. Should reject invalid data in “costing” section", async ({}) => {});
220+
test("12F_6. Should reject invalid data in “further information” section", async ({}) => {});
71221
});
72222

73223
test("12G. Should validate and review submitted budget proposal", async ({}) => {});

0 commit comments

Comments
 (0)