@trevordsouzabrite/test-package 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/.claude/agents/playwright-test-generator.md +85 -0
  2. package/.claude/agents/playwright-test-healer.md +45 -0
  3. package/.claude/agents/playwright-test-planner.md +52 -0
  4. package/.claude/prompts/playwright-test-coverage.md +31 -0
  5. package/.claude/prompts/playwright-test-generate.md +12 -0
  6. package/.claude/prompts/playwright-test-heal.md +6 -0
  7. package/.claude/prompts/playwright-test-plan.md +12 -0
  8. package/.claude/settings.local.json +31 -0
  9. package/.github/agents/playwright-test-generator.agent.md +113 -0
  10. package/.github/agents/playwright-test-healer.agent.md +70 -0
  11. package/.github/agents/playwright-test-planner.agent.md +82 -0
  12. package/.github/prompts/playwright-test-coverage.prompt.md +31 -0
  13. package/.github/prompts/playwright-test-generate.prompt.md +12 -0
  14. package/.github/prompts/playwright-test-heal.prompt.md +6 -0
  15. package/.github/prompts/playwright-test-plan.prompt.md +9 -0
  16. package/.github/workflows/copilot-setup-steps.yml +34 -0
  17. package/.github/workflows/playwright-healer-agent.yml +140 -0
  18. package/.github/workflows/playwright.yml +40 -0
  19. package/.mcp.json +13 -0
  20. package/.vscode/extensions.json +6 -0
  21. package/.vscode/mcp.json +13 -0
  22. package/.vscode/settings.example.json +15 -0
  23. package/bitbucket-pipelines.yml +86 -0
  24. package/lib/WebActions.ts +107 -0
  25. package/package.json +33 -0
  26. package/pageRepository/ApplicantPage.ts +1171 -0
  27. package/pageRepository/CreateApplicationPage.ts +1736 -0
  28. package/playwright/.auth/user.json +0 -0
  29. package/specs/Applicant Create Application Page Test Plan.md +440 -0
  30. package/specs/Applicant Dashboard Page Test Plan.md +74 -0
  31. package/specs/Applicant Forgot Password Page Test Plan.md +112 -0
  32. package/specs/Applicant Help Page Test Plan.md +369 -0
  33. package/specs/Applicant Landing Page Test Plan.md +42 -0
  34. package/specs/Applicant Login Page Test Plan.md +116 -0
  35. package/specs/Applicant My Applications Page Test Plan.md +558 -0
  36. package/specs/Applicant My Medical Coverage Page Test Plan.md +689 -0
  37. package/specs/Applicant Privacy Policy Page Test Plan.md +196 -0
  38. package/specs/Applicant Resources Page Test Plan.md +107 -0
  39. package/specs/Applicant Self Register Page Test Plan.md +190 -0
  40. package/specs/README.md +3 -0
  41. package/test-data/Sample.png +0 -0
  42. package/test-data/createApplication/formData.json +42 -0
  43. package/test-data/createApplication/textMessages.json +52 -0
  44. package/test-data/forgotPassword/email.json +5 -0
  45. package/test-data/forgotPassword/textMessages.json +5 -0
  46. package/test-data/help/textContent.json +48 -0
  47. package/test-data/login/invalidUsernamePassword.json +4 -0
  48. package/test-data/login/textMessages.json +5 -0
  49. package/test-data/privacyPolicy/textContent.json +25 -0
  50. package/test-data/selfRegister/mailingAddressStates.json +21 -0
  51. package/test-data/selfRegister/registrationFieldData.json +13 -0
  52. package/test-data/selfRegister/suffix.json +3 -0
  53. package/test-data/selfRegister/textMessages.json +13 -0
  54. package/test-data/test-data.zip +0 -0
  55. package/tests/ApplicantCreateApplicationPageTest.spec.ts +1452 -0
  56. package/tests/ApplicantDashboardPageTest.spec.ts +74 -0
  57. package/tests/ApplicantForgotPasswordPageTest.spec.ts +88 -0
  58. package/tests/ApplicantHelpPageTest.spec.ts +468 -0
  59. package/tests/ApplicantLandingPageTest.spec.ts +33 -0
  60. package/tests/ApplicantLoginPageTest.spec.ts +117 -0
  61. package/tests/ApplicantMyApplicationsPageTest.spec.ts +516 -0
  62. package/tests/ApplicantMyMedicalCoveragePageTest.spec.ts +470 -0
  63. package/tests/ApplicantPrivacyPolicyPageTest.spec.ts +188 -0
  64. package/tests/ApplicantResourcesPageTest.spec.ts +117 -0
  65. package/tests/ApplicantSelfRegisterPageTest.spec.ts +254 -0
  66. package/tests/auth.setup.ts +42 -0
  67. package/tests/authState.ts +15 -0
  68. package/tests/example.spec.ts +18 -0
  69. package/tests/seed.spec.ts +7 -0
@@ -0,0 +1,1452 @@
1
+ // spec: specs/Applicant Create Application Page Test Plan.md
2
+ // seed: seed.spec.ts
3
+
4
+ import { test, expect, type Locator } from '@playwright/test';
5
+ import { ApplicantPage } from '@pages/ApplicantPage';
6
+ import {
7
+ CreateApplicationPage,
8
+ type ApplicantIncomeScreenFillResultYes,
9
+ type ApplicantIncomeSimpleSource,
10
+ } from '@pages/CreateApplicationPage';
11
+ import { WebActions } from '@lib/WebActions';
12
+ import { testConfig } from '../testConfig';
13
+ import createApplicationTextMessagesData from '../test-data/createApplication/textMessages.json';
14
+ import createApplicationFormData from '../test-data/createApplication/formData.json';
15
+ import { saveAuthState } from './authState';
16
+
17
+ test.describe('Applicant Create Application Page Tests', () => {
18
+ test.skip(process.env.AUTH !== 'true', 'Authenticated Create Application tests require AUTH=true and playwright/.auth/user.json.');
19
+
20
+ // These flows span multiple OmniScript screens and can exceed the default 60s test timeout.
21
+ test.describe.configure({ timeout: 180_000 });
22
+
23
+ let applicantPage: ApplicantPage;
24
+ let createApplicationPage: CreateApplicationPage;
25
+ let webActions: WebActions;
26
+ test.beforeEach(async ({ page }) => {
27
+ applicantPage = new ApplicantPage(page);
28
+ createApplicationPage = new CreateApplicationPage(page);
29
+ webActions = new WebActions(page, page.context());
30
+ await applicantPage.gotoURL('/polkphpapplicant/s/?language=en_US');
31
+ await webActions.waitForElementAttached(applicantPage.Logout_Btn);
32
+
33
+ //Click on the Create Application link in the header
34
+ await applicantPage.clickCreateApplicationLink();
35
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationLanguageTitle_Lbl);
36
+ });
37
+
38
+ test.afterEach(async ({ page }) => {
39
+ if (process.env.AUTH !== 'true') {
40
+ return;
41
+ }
42
+ await saveAuthState(page.context());
43
+ });
44
+
45
+ test.describe('Screen 1 — Application Language', () => {
46
+ test('Verify the all the elements are visible on the Create Application page - Applicant Language @auth ', async ({ page }) => {
47
+ await expect.soft(createApplicationPage.ApplicationLanguageTitle_Lbl).toBeVisible();
48
+ await webActions.waitForElementAttached(createApplicationPage.PreferredLanguage_Lbl);
49
+ await expect.soft(createApplicationPage.PreferredLanguage_Lbl).toBeVisible();
50
+ await expect.soft(createApplicationPage.PreferredLanguage_Input).toBeVisible();
51
+ });
52
+
53
+ test('Verify the all the required elements error messages are visible on the Create Application page - Applicant Language @auth', async ({ page }) => {
54
+ await createApplicationPage.clickNextButton();
55
+ expect.soft(await createApplicationPage.PreferredLanguage_Lbl.textContent()).toContain(createApplicationTextMessagesData.preferredLanguageError);
56
+ });
57
+
58
+ test('Verify the dropdowns are populated with the correct values on the Application Language screen @auth', async () => {
59
+ const expectedOptions = createApplicationFormData.dropdowns.preferredLanguage;
60
+ const dropdown = createApplicationPage.PreferredLanguage_Input;
61
+
62
+ await expect(dropdown).toBeVisible();
63
+ const actualOptions = await createApplicationPage.getDropdownOptions(dropdown, 1);
64
+
65
+ for (const expected of expectedOptions) {
66
+ expect.soft(actualOptions, `Preferred Language should list "${expected}"`).toContain(expected);
67
+ }
68
+ await createApplicationPage.closeDropdown(dropdown);
69
+ });
70
+
71
+ test('Verify the application Language are filled correctly in screen - 1 - Application Language and the user moves to the next screen - 2 - Application Details @auth', async ({ page }) => {
72
+ // Screen 1 — Application Language
73
+ await createApplicationPage.selectRandomPreferredLanguage();
74
+ await createApplicationPage.clickNextButton();
75
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
76
+ await expect.soft(createApplicationPage.ApplicationDetailsTitle_Lbl).toBeVisible();
77
+ });
78
+ });
79
+
80
+ test.describe('Screen 2 — Application Details', () => {
81
+ test('Verify the all the elements are visible on the Create Application page - Applicant Details @auth', async ({ page }) => {
82
+ test.setTimeout(0);
83
+ // Screen 1 — Application Language
84
+ await createApplicationPage.selectRandomPreferredLanguage();
85
+ await createApplicationPage.clickNextButton();
86
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
87
+ //Verify the element are visible on the Create Application page - Applicant Details
88
+ await expect.soft(createApplicationPage.ApplicationDetailsTitle_Lbl).toBeVisible();
89
+ await expect.soft(createApplicationPage.FirstName_Lbl).toBeVisible();
90
+ await expect.soft(createApplicationPage.FirstName_Input).toBeVisible();
91
+ await expect.soft(createApplicationPage.MiddleName_Lbl).toBeVisible();
92
+ await expect.soft(createApplicationPage.MiddleName_Input).toBeVisible();
93
+ await expect.soft(createApplicationPage.LastName_Lbl).toBeVisible();
94
+ await expect.soft(createApplicationPage.LastName_Input).toBeVisible();
95
+ await expect.soft(createApplicationPage.Suffix_Lbl).toBeVisible();
96
+ await expect.soft(createApplicationPage.SuffixField_dd).toBeVisible();
97
+ await expect.soft(createApplicationPage.DOB_Lbl).toBeVisible();
98
+ await expect.soft(createApplicationPage.DOB_Input).toBeVisible();
99
+ await expect.soft(createApplicationPage.SSN_Lbl).toBeVisible();
100
+ await expect.soft(createApplicationPage.SSN_Input).toBeVisible();
101
+ await expect.soft(createApplicationPage.Email_Lbl).toBeVisible();
102
+ await expect.soft(createApplicationPage.Email_Input).toBeVisible();
103
+ await expect.soft(createApplicationPage.Landline_lbl).toBeVisible();
104
+ await expect.soft(createApplicationPage.Landline_Input).toBeVisible();
105
+ await expect.soft(createApplicationPage.CellPhone_Lbl).toBeVisible();
106
+ await expect.soft(createApplicationPage.CellPhone_Input).toBeVisible();
107
+ await expect.soft(createApplicationPage.isPrimaryPhoneLandlineOrCellPhone_Lbl).toBeVisible();
108
+ await expect.soft(createApplicationPage.isPrimaryPhoneLandlineOrCellPhone_dd).toBeVisible();
109
+ await expect.soft(createApplicationPage.Race_Lbl).toBeVisible();
110
+ await expect.soft(createApplicationPage.Race_dd).toBeVisible();
111
+ await expect.soft(createApplicationPage.Ethnicity_Lbl).toBeVisible();
112
+ await expect.soft(createApplicationPage.Ethnicity_dd).toBeVisible();
113
+ await expect.soft(createApplicationPage.Gender_Lbl).toBeVisible();
114
+ await expect.soft(createApplicationPage.Gender_dd).toBeVisible();
115
+ await expect.soft(createApplicationPage.MaritalStatus_Lbl).toBeVisible();
116
+ await expect.soft(createApplicationPage.MaritalStatus_dd).toBeVisible();
117
+ await expect.soft(createApplicationPage.Citizenship_Lbl).toBeVisible();
118
+ await expect.soft(createApplicationPage.Citizenship_dd).toBeVisible();
119
+ await expect.soft(createApplicationPage.Veteran_Lbl).toBeVisible();
120
+ await expect.soft(createApplicationPage.Veteran_dd).toBeVisible();
121
+ await expect.soft(createApplicationPage.Language_Lbl).toBeVisible();
122
+ await expect.soft(createApplicationPage.Language_dd).toBeVisible();
123
+ await expect.soft(createApplicationPage.InsuranceCoverage_Lbl).toBeVisible();
124
+ await expect.soft(createApplicationPage.InsuranceCoverage_dd).toBeVisible();
125
+ await expect.soft(createApplicationPage.IAmCurrentlyHomeless_ChkBox).toBeVisible();
126
+
127
+ await expect.soft(createApplicationPage.PhysicalAddress_Card).toBeVisible();
128
+ await expect.soft(createApplicationPage.PhysicalAddressTitle_Lbl).toBeVisible();
129
+ await expect.soft(createApplicationPage.PhysicalAddressHint_Lbl).toBeVisible();
130
+ await expect.soft(createApplicationPage.PhysicalAddressAddressField_Input).toBeVisible();
131
+ await expect.soft(createApplicationPage.PhysicalAddressCountryField_Lbl).toBeVisible();
132
+ await expect.soft(createApplicationPage.PhysicalAddressCountryField_dd).toBeVisible();
133
+ await expect.soft(createApplicationPage.PhysicalAddressStreetField_Lbl).toBeVisible();
134
+ await expect.soft(createApplicationPage.PhysicalAddressStreetField_Input).toBeVisible();
135
+ await expect.soft(createApplicationPage.PhysicalAddressCityField_Lbl).toBeVisible();
136
+ await expect.soft(createApplicationPage.PhysicalAddressCityField_Input).toBeVisible();
137
+ await expect.soft(createApplicationPage.PhysicalAddressStateField_Lbl).toBeVisible();
138
+ await expect.soft(createApplicationPage.PhysicalAddressStateField_dd).toBeVisible();
139
+ await expect.soft(createApplicationPage.PhysicalAddressZIP_Lbl).toBeVisible();
140
+ await expect.soft(createApplicationPage.PhysicalAddressZIP_Input).toBeVisible();
141
+
142
+ await expect.soft(createApplicationPage.MailingAddress_Card).toBeVisible();
143
+ await expect.soft(createApplicationPage.MailingAddressTitle_Lbl).toBeVisible();
144
+ await expect.soft(createApplicationPage.MailingAddress_SameAsPhysical_Toggle).toBeVisible();
145
+ await expect.soft(createApplicationPage.MailingAddressHint_Lbl).toBeVisible();
146
+ await webActions.waitForElementAttached(createApplicationPage.MailingAddressAddressField_Input);
147
+ await expect.soft(createApplicationPage.MailingAddressAddressField_Input).toBeVisible();
148
+ await expect.soft(createApplicationPage.MailingAddressCountryField_Lbl).toBeVisible();
149
+ await expect.soft(createApplicationPage.MailingAddressCountryField_dd).toBeVisible();
150
+ await expect.soft(createApplicationPage.MailingAddressStreetField_Lbl).toBeVisible();
151
+ await expect.soft(createApplicationPage.MailingAddressStreetField_Input).toBeVisible();
152
+ await expect.soft(createApplicationPage.MailingAddressCityField_Lbl).toBeVisible();
153
+ await expect.soft(createApplicationPage.MailingAddressCityField_Input).toBeVisible();
154
+ await expect.soft(createApplicationPage.MailingAddressStateField_Lbl).toBeVisible();
155
+ await expect.soft(createApplicationPage.MailingAddressStateField_dd).toBeVisible();
156
+ await expect.soft(createApplicationPage.MailingAddressZIP_Lbl).toBeVisible();
157
+ await expect.soft(createApplicationPage.MailingAddressZIP_Input).toBeVisible();
158
+ });
159
+
160
+ test('Verify the required elements error messages are visible on the Create Application page - Applicant Details @auth', async ({ page }) => {
161
+ test.setTimeout(0);
162
+ // Screen 1 — Application Language
163
+ await createApplicationPage.selectRandomPreferredLanguage();
164
+ await createApplicationPage.clickNextButton();
165
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
166
+ //Verify the required elements error messages are visible on the Create Application page - Applicant Details
167
+ //Clear the fields if the data are already populated
168
+ await createApplicationPage.clearTextbox(createApplicationPage.FirstName_Input);
169
+ await createApplicationPage.clearTextbox(createApplicationPage.LastName_Input);
170
+ await createApplicationPage.clearTextbox(createApplicationPage.DOB_Input);
171
+ await createApplicationPage.clearTextbox(createApplicationPage.SSN_Input);
172
+ await createApplicationPage.clearTextbox(createApplicationPage.Email_Input);
173
+ await createApplicationPage.fillDropdown(createApplicationPage.isPrimaryPhoneLandlineOrCellPhone_dd, '-- No Value --');
174
+ await createApplicationPage.fillDropdown(createApplicationPage.Race_dd, '-- No Value --');
175
+ await createApplicationPage.fillDropdown(createApplicationPage.Ethnicity_dd, '-- No Value --');
176
+ await createApplicationPage.fillDropdown(createApplicationPage.Gender_dd, '-- No Value --');
177
+ await createApplicationPage.fillDropdown(createApplicationPage.MaritalStatus_dd, '-- No Value --');
178
+ await createApplicationPage.fillDropdown(createApplicationPage.Citizenship_dd, '-- No Value --');
179
+ await createApplicationPage.fillDropdown(createApplicationPage.Veteran_dd, '-- No Value --');
180
+ await createApplicationPage.fillDropdown(createApplicationPage.Language_dd, '-- No Value --');
181
+ await createApplicationPage.fillDropdown(createApplicationPage.InsuranceCoverage_dd, '-- No Value --');
182
+ //Click the Next Button to trigger all the error messages
183
+ await createApplicationPage.Next_Btn.scrollIntoViewIfNeeded();
184
+ await createApplicationPage.clickNextButton();
185
+ //Verify the error messages are visible
186
+ await createApplicationPage.FirstName_Lbl.scrollIntoViewIfNeeded();
187
+ expect.soft(await createApplicationPage.FirstName_Lbl.textContent()).toContain(createApplicationTextMessagesData.firstNameRequiredError);
188
+ expect.soft(await createApplicationPage.LastName_Lbl.textContent()).toContain(createApplicationTextMessagesData.lastNameRequiredError);
189
+ expect.soft(await createApplicationPage.DOB_Lbl.textContent()).toContain(createApplicationTextMessagesData.dobRequiredError);
190
+ expect.soft(await createApplicationPage.SSN_Lbl.textContent()).toContain(createApplicationTextMessagesData.ssnRequiredError);
191
+ expect.soft(await createApplicationPage.Email_Lbl.textContent()).toContain(createApplicationTextMessagesData.emailRequiredError);
192
+ expect.soft(await createApplicationPage.isPrimaryPhoneLandlineOrCellPhone_Lbl.textContent()).toContain(createApplicationTextMessagesData.isPrimaryPhoneLandlineOrCellPhoneRequiredError);
193
+ expect.soft(await createApplicationPage.Race_Lbl.textContent()).toContain(createApplicationTextMessagesData.raceRequiredError);
194
+ expect.soft(await createApplicationPage.Ethnicity_Lbl.textContent()).toContain(createApplicationTextMessagesData.ethnicityRequiredError);
195
+ expect.soft(await createApplicationPage.Gender_Lbl.textContent()).toContain(createApplicationTextMessagesData.genderRequiredError);
196
+ expect.soft(await createApplicationPage.MaritalStatus_Lbl.textContent()).toContain(createApplicationTextMessagesData.maritalStatusRequiredError);
197
+ expect.soft(await createApplicationPage.Citizenship_Lbl.textContent()).toContain(createApplicationTextMessagesData.citizenshipRequiredError);
198
+ expect.soft(await createApplicationPage.Veteran_Lbl.textContent()).toContain(createApplicationTextMessagesData.veteranRequiredError);
199
+ expect.soft(await createApplicationPage.Language_Lbl.textContent()).toContain(createApplicationTextMessagesData.languageRequiredError);
200
+ expect.soft(await createApplicationPage.InsuranceCoverage_Lbl.textContent()).toContain(createApplicationTextMessagesData.insuranceCoverageRequiredError);
201
+ });
202
+
203
+ test('Verify the dropdowns are populated with the correct values on the Application Details screen @auth', async () => {
204
+ test.setTimeout(0);
205
+ // Screen 1 — Application Language
206
+ await createApplicationPage.selectRandomPreferredLanguage();
207
+ await createApplicationPage.clickNextButton();
208
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
209
+ /** Open order matches Application Details demographics layout (not JSON key order). */
210
+ const dropdownFieldOrder = [
211
+ 'race',
212
+ 'ethnicity',
213
+ 'gender',
214
+ 'maritalStatus',
215
+ 'citizenship',
216
+ 'veteran',
217
+ 'language',
218
+ 'insuranceCoverage',
219
+ 'isPrimaryPhoneLandlineOrCellPhone',
220
+ ] as const satisfies readonly (keyof typeof createApplicationFormData.dropdowns)[];
221
+
222
+ const dropdownByField: Record<(typeof dropdownFieldOrder)[number], Locator> = {
223
+ isPrimaryPhoneLandlineOrCellPhone: createApplicationPage.isPrimaryPhoneLandlineOrCellPhone_dd,
224
+ race: createApplicationPage.Race_dd,
225
+ ethnicity: createApplicationPage.Ethnicity_dd,
226
+ gender: createApplicationPage.Gender_dd,
227
+ maritalStatus: createApplicationPage.MaritalStatus_dd,
228
+ citizenship: createApplicationPage.Citizenship_dd,
229
+ veteran: createApplicationPage.Veteran_dd,
230
+ language: createApplicationPage.Language_dd,
231
+ insuranceCoverage: createApplicationPage.InsuranceCoverage_dd,
232
+ };
233
+
234
+ for (const field of dropdownFieldOrder) {
235
+
236
+ const expectedOptions = createApplicationFormData.dropdowns[field];
237
+ const dropdown = dropdownByField[field];
238
+ await expect(dropdown).toBeVisible();
239
+ const actualOptions = await createApplicationPage.getDropdownOptions(dropdown, 1);
240
+
241
+ for (const expected of expectedOptions) {
242
+ expect.soft(actualOptions, `Dropdown "${String(field)}" should list "${expected}"`).toContain(expected);
243
+ }
244
+ await createApplicationPage.closeDropdown(dropdown);
245
+ }
246
+ });
247
+
248
+
249
+ test('Verify the application details are filled correctly in screen - Application Language, Details and the user moves to the next screen - Income @auth', async ({ page }) => {
250
+ // Screen 1 — Application Language
251
+ await createApplicationPage.selectRandomPreferredLanguage();
252
+ await createApplicationPage.clickNextButton();
253
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
254
+ // Screen 2 — Application Details
255
+ await createApplicationPage.fillApplicationDetails();
256
+ await createApplicationPage.clickNextButton();
257
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
258
+ await expect.soft(createApplicationPage.ApplicantIncomeTitle_Lbl).toBeVisible();
259
+ });
260
+ });
261
+
262
+ test.describe('Screen 3 — Applicant Income', () => {
263
+ test('Verify the all the elements & required messages are visible on the Create Application page - Applicant Income @auth', async ({ page }) => {
264
+ test.setTimeout(0);
265
+ // Screen 1 — Application Language
266
+ await createApplicationPage.selectRandomPreferredLanguage();
267
+ await createApplicationPage.clickNextButton();
268
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
269
+ // Screen 2 — Application Details
270
+ await createApplicationPage.fillApplicationDetails();
271
+ await createApplicationPage.clickNextButton();
272
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
273
+ //Verify the elements are visible
274
+ await webActions.waitForElementAttached(createApplicationPage.HaveYouReceivedIncomeInLast30Days_Block);
275
+ await expect.soft(createApplicationPage.HaveYouReceivedIncomeInLast30Days_Block).toBeVisible();
276
+ await expect.soft(createApplicationPage.HaveYouReceivedIncomeInLast30Days_dd).toBeVisible();
277
+ //To trigger required messages for the question 'Have you received income in last 30 days?'
278
+ await createApplicationPage.clickNextButton();
279
+ await createApplicationPage.HaveYouReceivedIncomeInLast30Days_Block.locator('.slds-form-element__help').waitFor({ state: 'visible' });
280
+ expect.soft(await createApplicationPage.HaveYouReceivedIncomeInLast30Days_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.haveYouReceivedIncomeInLast30DaysRequiredError);
281
+
282
+ //Income Section - Yes
283
+ await createApplicationPage.fillDropdown(createApplicationPage.HaveYouReceivedIncomeInLast30Days_dd, 'Yes');
284
+ //Verify the elements are visible
285
+ await expect.soft(createApplicationPage.IncomeSource_Block).toBeVisible();
286
+ await expect.soft(createApplicationPage.IncomeSource_Lbl).toBeVisible();
287
+ await expect.soft(createApplicationPage.Paycheck_ChkBox).toBeVisible();
288
+ await expect.soft(createApplicationPage.Pension_ChkBox).toBeVisible();
289
+ await expect.soft(createApplicationPage.RentalIncome_ChkBox).toBeVisible();
290
+ await expect.soft(createApplicationPage.SelfEmployed_ChkBox).toBeVisible();
291
+ await expect.soft(createApplicationPage.FourZeroOneK_ChkBox).toBeVisible();
292
+ await expect.soft(createApplicationPage.SocialSecurityRetirement_ChkBox).toBeVisible();
293
+ await expect.soft(createApplicationPage.SSDI_ChkBox).toBeVisible();
294
+ await expect.soft(createApplicationPage.UnemploymentCompensation_ChkBox).toBeVisible();
295
+ await expect.soft(createApplicationPage.InterestIncome_ChkBox).toBeVisible();
296
+ await expect.soft(createApplicationPage.AnnuityPayments_ChkBox).toBeVisible();
297
+ await expect.soft(createApplicationPage.Dividends_ChkBox).toBeVisible();
298
+ await expect.soft(createApplicationPage.TotalPrimaryApplicantIncomeMonthly_Block).toBeVisible();
299
+ await expect.soft(createApplicationPage.TotalPrimaryApplicantIncomeMonthly_Txtbox).toBeVisible();
300
+ //To trigger required messages for the question 'What type of MONTHLY income does applicant haveÔÇï? Please select all income sources that apply'
301
+ await createApplicationPage.clickNextButton();
302
+ await createApplicationPage.IncomeSource_Block.locator('.slds-form-element__help').waitFor({ state: 'visible' });
303
+ expect.soft(await createApplicationPage.IncomeSource_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.whatTypeOfMonthlyIncomeDoesApplicantHaveRequiredError);
304
+ //Enable the Paycheck chkbox
305
+ await createApplicationPage.clickPaycheckChkbox();
306
+ await expect.soft(createApplicationPage.PaycheckMessage_Lbl).toBeVisible();
307
+ await webActions.waitForElementAttached(createApplicationPage.ICanProvideLastYearTaxReturn_ChkBox);
308
+ await expect.soft(createApplicationPage.ICanProvideLastYearTaxReturn_ChkBox).toBeVisible();
309
+ await expect.soft(createApplicationPage.ICanHaveMyEmployerComplete_ChkBox).toBeVisible();
310
+ await createApplicationPage.clickICanHaveMyEmployerCompleteChkbox();
311
+ await expect.soft(createApplicationPage.EmployerVerification_Block).toBeVisible();
312
+ await expect.soft(createApplicationPage.EmployerVerficationForm_Lnk).toBeVisible();
313
+ await expect.soft(createApplicationPage.FirstEmployer_Block).toBeVisible();
314
+ await expect.soft(createApplicationPage.FirstEmployer_Name_Block).toBeVisible();
315
+ await expect.soft(createApplicationPage.FirstEmployer_Name_Txtbox).toBeVisible();
316
+ await expect.soft(createApplicationPage.DoYouWantToAddAnotherEmployer_dd).toBeVisible();
317
+ await expect.soft(createApplicationPage.FirstEmployerGMI_Block).toBeVisible();
318
+ await expect.soft(createApplicationPage.FirstEmployerGMI_Txtbox).toBeVisible();
319
+ //Enable the Pension chkbox
320
+ await createApplicationPage.clickPensionChkbox();
321
+ await expect.soft(createApplicationPage.Pension_Block).toBeVisible();
322
+ await expect.soft(createApplicationPage.MonthlyPensionAmount_Block).toBeVisible();
323
+ await expect.soft(createApplicationPage.MonthlyPensionAmount_Txtbox).toBeVisible();
324
+ //Enable the Rental Income chkbox
325
+ await createApplicationPage.clickRentalIncomeChkbox();
326
+ await expect.soft(createApplicationPage.RentalIncome_Block).toBeVisible();
327
+ await expect.soft(createApplicationPage.RentalIncomeAmount_Block).toBeVisible();
328
+ await expect.soft(createApplicationPage.RentalIncomeAmount_Txtbox).toBeVisible();
329
+ //Enable the Self Employed chkbox
330
+ await createApplicationPage.clickSelfEmployedChkbox();
331
+ await expect.soft(createApplicationPage.SelfEmployed_Block).toBeVisible();
332
+ await expect.soft(createApplicationPage.SelfEmploymentValidation_Block).toBeVisible();
333
+ await expect.soft(createApplicationPage.SelfEmploymentValidation_dd).toBeVisible();
334
+ await expect.soft(createApplicationPage.ICertifyThatIAmSelfEmployed_ChkBox).toBeVisible();
335
+ await expect.soft(createApplicationPage.SelfEmploymentName_Block).toBeVisible();
336
+ await expect.soft(createApplicationPage.SelfEmploymentName_Txtbox).toBeVisible();
337
+ await expect.soft(createApplicationPage.DateOfCertificationTodayDate_Block).toBeVisible();
338
+ await expect.soft(createApplicationPage.DateOfCertificationTodayDate_Txtbox).toBeVisible();
339
+ await expect.soft(createApplicationPage.SelfEmploymentTypeOfWork_Block).toBeVisible();
340
+ await expect.soft(createApplicationPage.SelfEmploymentTypeOfWork_Txtbox).toBeVisible();
341
+ await expect.soft(createApplicationPage.SelfEmployedAmount_Block).toBeVisible();
342
+ await expect.soft(createApplicationPage.SelfEmployedAmount_Txtbox).toBeVisible();
343
+ //Enable the 401K chkbox
344
+ await createApplicationPage.clickFourZeroOneKChkbox();
345
+ await expect.soft(createApplicationPage.FourZeroOneK_Block).toBeVisible();
346
+ await expect.soft(createApplicationPage.FourZeroOneKAmount_Block).toBeVisible();
347
+ await expect.soft(createApplicationPage.FourZeroOneKAmount_Txtbox).toBeVisible();
348
+ //Enable the Social Security Retirement chkbox
349
+ await createApplicationPage.clickSocialSecurityRetirementChkbox();
350
+ await expect.soft(createApplicationPage.SocialSecurityRetirement_Block).toBeVisible();
351
+ await expect.soft(createApplicationPage.SocialSecurityRetirementAmount_Block).toBeVisible();
352
+ await expect.soft(createApplicationPage.SocialSecurityRetirementAmount_Txtbox).toBeVisible();
353
+ //Enable the SSDI chkbox
354
+ await createApplicationPage.clickSSDIChkbox();
355
+ await expect.soft(createApplicationPage.SSDI_Block).toBeVisible();
356
+ await expect.soft(createApplicationPage.SSDIAmount_Block).toBeVisible();
357
+ await expect.soft(createApplicationPage.SSDIAmount_Txtbox).toBeVisible();
358
+ //Enable the Unemployment Compensation chkbox
359
+ await createApplicationPage.clickUnemploymentCompensationChkbox();
360
+ await expect.soft(createApplicationPage.UnemploymentCompensation_Block).toBeVisible();
361
+ await expect.soft(createApplicationPage.UnemploymentCompensationAmount_Block).toBeVisible();
362
+ await expect.soft(createApplicationPage.UnemploymentCompensationAmount_Txtbox).toBeVisible();
363
+ //Enable the Interest Income chkbox
364
+ await createApplicationPage.clickInterestIncomeChkbox();
365
+ await expect.soft(createApplicationPage.InterestIncome_Block).toBeVisible();
366
+ await expect.soft(createApplicationPage.InterestIncomeAmount_Block).toBeVisible();
367
+ await expect.soft(createApplicationPage.InterestIncomeAmount_Txtbox).toBeVisible();
368
+ //Enable the Annuity Payments chkbox
369
+ await createApplicationPage.clickAnnuityPaymentsChkbox();
370
+ await expect.soft(createApplicationPage.AnnuityPayments_Block).toBeVisible();
371
+ await expect.soft(createApplicationPage.AnnuityPaymentsAmount_Block).toBeVisible();
372
+ await expect.soft(createApplicationPage.AnnuityPaymentsAmount_Txtbox).toBeVisible();
373
+ //Enable the Dividends chkbox
374
+ await createApplicationPage.clickDividendsChkbox();
375
+ await expect.soft(createApplicationPage.Dividends_Block).toBeVisible();
376
+ await expect.soft(createApplicationPage.DividendsAmount_Block).toBeVisible();
377
+ await expect.soft(createApplicationPage.DividendsAmount_Txtbox).toBeVisible();
378
+ //Validate all the required messages for the Income Sources are visible
379
+ await createApplicationPage.clickNextButton();
380
+ await createApplicationPage.FirstEmployer_Name_Block.locator('.slds-form-element__help').waitFor({ state: 'visible' });
381
+ expect.soft(await createApplicationPage.FirstEmployer_Name_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.employerNameRequiredError);
382
+ expect.soft(await createApplicationPage.FirstEmployerGMI_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.firstEmployerGrossMonthlyIncomeRequiredError);
383
+ expect.soft(await createApplicationPage.MonthlyPensionAmount_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.monthlyPensionAmountRequiredError);
384
+ expect.soft(await createApplicationPage.RentalIncomeAmount_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.monthlyRentalPropertyAmountRequiredError);
385
+ expect.soft(await createApplicationPage.SSDIAmount_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.monthlySSDIAmountRequiredError);
386
+ expect.soft(await createApplicationPage.FourZeroOneKAmount_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.monthly401KWithdrawalAmountRequiredError);
387
+ expect.soft(await createApplicationPage.SocialSecurityRetirementAmount_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.monthlySocialSecurityRetirementAmountRequiredError);
388
+ expect.soft(await createApplicationPage.UnemploymentCompensationAmount_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.monthlyUnemploymentCompensationAmountRequiredError);
389
+ expect.soft(await createApplicationPage.InterestIncomeAmount_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.monthlyInterestIncomeAmountRequiredError);
390
+ expect.soft(await createApplicationPage.AnnuityPaymentsAmount_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.monthlyAnnuityPaymentsAmountRequiredError);
391
+ expect.soft(await createApplicationPage.DividendsAmount_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.monthlyDividendsAmountRequiredError);
392
+ expect.soft(await createApplicationPage.SelfEmploymentValidation_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.iCanProvideSelfEmploymentValidationByTheFollowingMethodsRequiredError);
393
+ expect.soft(await createApplicationPage.SelfEmploymentName_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.pleaseEnterYourNameToCertifySelfEmploymentRequiredError);
394
+ //expect.soft(await createApplicationPage.DateOfCertificationTodayDate_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.pleaseEnterTheDateOfTheCertificationTodayDateRequiredError);
395
+ expect.soft(await createApplicationPage.SelfEmploymentTypeOfWork_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.whatTypeOfWorkDoYouPerformRequiredError);
396
+ expect.soft(await createApplicationPage.SelfEmployedAmount_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.monthlySelfEmployedAmountRequiredError);
397
+ //Income Section - No
398
+ //Verify the elements are visible
399
+ await createApplicationPage.fillDropdown(createApplicationPage.HaveYouReceivedIncomeInLast30Days_dd, 'No');
400
+ await expect.soft(createApplicationPage.NotWorkingExplaination_Block).toBeVisible();
401
+ await expect.soft(createApplicationPage.NotWorkingExplaination_Txtbox).toBeVisible();
402
+ await expect.soft(createApplicationPage.Explain30DaysExpense_Block).toBeVisible();
403
+ await expect.soft(createApplicationPage.Explain30DaysExpense_Txtbox).toBeVisible();
404
+ await expect.soft(createApplicationPage.ReceiveSupportForNecessities_Block).toBeVisible();
405
+ await expect.soft(createApplicationPage.ReceiveSupportForNecessities_dd).toBeVisible();
406
+
407
+ await expect.soft(createApplicationPage.EngageInFinancialTransactions_Block).toBeVisible();
408
+ await expect.soft(createApplicationPage.EngageInFinancialTransactions_dd).toBeVisible();
409
+ await expect.soft(createApplicationPage.PubicAssitanceChxbox_Block).toBeVisible();
410
+ await expect.soft(createApplicationPage.SSI_ChkBox).toBeVisible();
411
+ await expect.soft(createApplicationPage.VABenefits_ChkBox).toBeVisible();
412
+ await expect.soft(createApplicationPage.SNAPBenefits_ChkBox).toBeVisible();
413
+ await expect.soft(createApplicationPage.SubsidizedHousing_ChkBox).toBeVisible();
414
+ await expect.soft(createApplicationPage.Alimony_ChkBox).toBeVisible();
415
+ await expect.soft(createApplicationPage.ChildSupport_ChkBox).toBeVisible();
416
+ await expect.soft(createApplicationPage.NoneOfTheAbove_ChkBox).toBeVisible();
417
+ //To trigger required messages
418
+ await createApplicationPage.clickNextButton();
419
+ await createApplicationPage.NotWorkingExplaination_Block.locator('.slds-form-element__help').waitFor({ state: 'visible' });
420
+ expect.soft(await createApplicationPage.NotWorkingExplaination_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.pleaseExplainWhyApplicantIsNotWorkingRequiredError);
421
+ expect.soft(await createApplicationPage.Explain30DaysExpense_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.pleaseExplainHowYouHaveManagedForThePast30DaysWithoutIncomeRequiredError);
422
+ expect.soft(await createApplicationPage.ReceiveSupportForNecessities_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.doYouCurrentlyReceiveSupportFromAnyThirdPartiesForBasicNecessitiesSuchAsShelterFoodTransportationOrMedicalCareRequiredError);
423
+ expect.soft(await createApplicationPage.EngageInFinancialTransactions_Block.locator('.slds-form-element__help').textContent()).toContain(createApplicationTextMessagesData.doYouEngageInAnyFinancialTransactionsWithInstitutionsOrPlatformsSuchAsBanksVenmoCashAppOrSimilarServicesRequiredError);
424
+ expect.soft(await createApplicationPage.PubicAssitanceChxbox_Block.locator('.slds-text-color_error').textContent()).toContain(createApplicationTextMessagesData.pleaseSelectAtLeastOneOptionRequiredError);
425
+ //To Enable Third Party Link
426
+ await createApplicationPage.fillDropdown(createApplicationPage.ReceiveSupportForNecessities_dd, 'Yes');
427
+ await webActions.waitForElementAttached(createApplicationPage.ThirdPartySupport_Block);
428
+ await expect.soft(createApplicationPage.ThirdPartySupport_Block).toBeVisible();
429
+ });
430
+
431
+ test('Verify the Monthly Income Sums up to the Total Primary Applicant Income Monthly correctly @auth', async ({ page }) => {
432
+ test.setTimeout(0);
433
+ // Screen 1 — Application Language
434
+ await createApplicationPage.selectRandomPreferredLanguage();
435
+ await createApplicationPage.clickNextButton();
436
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
437
+ // Screen 2 — Application Details
438
+ await createApplicationPage.fillApplicationDetails();
439
+ await createApplicationPage.clickNextButton();
440
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
441
+ await createApplicationPage.fillDropdown(createApplicationPage.HaveYouReceivedIncomeInLast30Days_dd, 'Yes');
442
+ await createApplicationPage.clickAllIncomeSourcesChkboxes();
443
+ const FirstEmployerGMI: number = await createApplicationPage.generateRandomNumbers();
444
+ console.log('FirstEmployerGMI: ', FirstEmployerGMI);
445
+ await createApplicationPage.FirstEmployerGMI_Txtbox.fill(FirstEmployerGMI.toString());
446
+ const PensionAmount: number = await createApplicationPage.generateRandomNumbers();
447
+ console.log('PensionAmount: ', PensionAmount);
448
+ await createApplicationPage.MonthlyPensionAmount_Txtbox.fill(PensionAmount.toString());
449
+ const RentalIncomeAmount: number = await createApplicationPage.generateRandomNumbers();
450
+ console.log('RentalIncomeAmount: ', RentalIncomeAmount);
451
+ await createApplicationPage.RentalIncomeAmount_Txtbox.fill(RentalIncomeAmount.toString());
452
+ const SelfEmployedAmount: number = await createApplicationPage.generateRandomNumbers();
453
+ console.log('SelfEmployedAmount: ', SelfEmployedAmount);
454
+ await createApplicationPage.SelfEmployedAmount_Txtbox.fill(SelfEmployedAmount.toString());
455
+ const SSDIAmount: number = await createApplicationPage.generateRandomNumbers();
456
+ console.log('SSDIAmount: ', SSDIAmount);
457
+ await createApplicationPage.SSDIAmount_Txtbox.fill(SSDIAmount.toString());
458
+ const FourZeroOneKAmount: number = await createApplicationPage.generateRandomNumbers();
459
+ console.log('FourZeroOneKAmount: ', FourZeroOneKAmount);
460
+ await createApplicationPage.FourZeroOneKAmount_Txtbox.fill(FourZeroOneKAmount.toString());
461
+ const SocialSecurityRetirementAmount: number = await createApplicationPage.generateRandomNumbers();
462
+ console.log('SocialSecurityRetirementAmount: ', SocialSecurityRetirementAmount);
463
+ await createApplicationPage.SocialSecurityRetirementAmount_Txtbox.fill(SocialSecurityRetirementAmount.toString());
464
+ const UnemploymentCompensationAmount: number = await createApplicationPage.generateRandomNumbers();
465
+ console.log('UnemploymentCompensationAmount: ', UnemploymentCompensationAmount);
466
+ await createApplicationPage.UnemploymentCompensationAmount_Txtbox.fill(UnemploymentCompensationAmount.toString());
467
+ const InterestIncomeAmount: number = await createApplicationPage.generateRandomNumbers();
468
+ console.log('InterestIncomeAmount: ', InterestIncomeAmount);
469
+ await createApplicationPage.InterestIncomeAmount_Txtbox.fill(InterestIncomeAmount.toString());
470
+ const AnnuityPaymentsAmount: number = await createApplicationPage.generateRandomNumbers();
471
+ console.log('AnnuityPaymentsAmount: ', AnnuityPaymentsAmount);
472
+ await createApplicationPage.AnnuityPaymentsAmount_Txtbox.fill(AnnuityPaymentsAmount.toString());
473
+ const DividendsAmount: number = await createApplicationPage.generateRandomNumbers();
474
+ console.log('DividendsAmount: ', DividendsAmount);
475
+ await createApplicationPage.DividendsAmount_Txtbox.fill(DividendsAmount.toString());
476
+ await createApplicationPage.TotalPrimaryApplicantIncomeMonthly_Txtbox.click();
477
+ const TotalPrimaryApplicantIncomeMonthly: number = FirstEmployerGMI + PensionAmount + RentalIncomeAmount + SelfEmployedAmount + SSDIAmount + FourZeroOneKAmount + SocialSecurityRetirementAmount + UnemploymentCompensationAmount + InterestIncomeAmount + AnnuityPaymentsAmount + DividendsAmount;
478
+ console.log('TotalPrimaryApplicantIncomeMonthly: ', TotalPrimaryApplicantIncomeMonthly);
479
+ await expect.soft(createApplicationPage.TotalPrimaryApplicantIncomeMonthly_Txtbox).toHaveValue(TotalPrimaryApplicantIncomeMonthly.toString());
480
+ });
481
+
482
+ test('Verify the application details are filled correctly in screen - 1 & 2 - Application Details & Income and the user moves to the next screen - 3 - Household Members @auth', async ({ page }) => {
483
+ // Screen 1 — Application Language
484
+ await createApplicationPage.selectRandomPreferredLanguage();
485
+ await createApplicationPage.clickNextButton();
486
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
487
+ // Screen 2 — Application Details
488
+ await createApplicationPage.fillApplicationDetails();
489
+ await createApplicationPage.clickNextButton();
490
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
491
+ // Screen 3 — Applicant Income
492
+ await createApplicationPage.fillApplicantIncomeScreenRandomly();
493
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
494
+ await expect.soft(createApplicationPage.HouseholdMembersIncomeTitle_Lbl).toBeVisible();
495
+ });
496
+ });
497
+
498
+ test.describe('Screen 4 — Household Members', () => {
499
+ test('Verify all the elements are visible on the Create Application page - Household Members @auth', async ({ page }) => {
500
+ // Screen 1 — Application Language
501
+ await createApplicationPage.selectRandomPreferredLanguage();
502
+ await createApplicationPage.clickNextButton();
503
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
504
+ // Screen 2 — Application Details
505
+ await createApplicationPage.fillApplicationDetails();
506
+ await createApplicationPage.clickNextButton();
507
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
508
+ // Screen 3 — Applicant Income
509
+ await createApplicationPage.fillApplicantIncomeScreenRandomly();
510
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
511
+ await expect.soft(createApplicationPage.Hint_Btn).toBeVisible();
512
+ await createApplicationPage.clickHouseholdHintButton();
513
+ await expect.soft(createApplicationPage.Hint_Text).toBeVisible();
514
+ await expect.soft(createApplicationPage.Edit_Btn).toBeVisible();
515
+ await expect.soft(createApplicationPage.AddHouseholdMember_Btn).toBeVisible();
516
+ await expect.soft(createApplicationPage.TotalNumberOfHouseholdMembers_Lbl).toBeVisible();
517
+ await expect.soft(createApplicationPage.TotalNumberOfHouseholdMembers_Value).toBeVisible();
518
+ await expect.soft(createApplicationPage.TotalMonthlyHouseholdIncome_Lbl).toBeVisible();
519
+ await expect.soft(createApplicationPage.TotalMonthlyHouseholdIncome_Value).toBeVisible();
520
+ await expect.soft(createApplicationPage.FPLPercentage_Lbl).toBeVisible();
521
+ await expect.soft(createApplicationPage.FPLPercentage_Value).toBeVisible();
522
+ });
523
+
524
+ test('Verify all the elements are visible on the Create Application page - Household Members - Edit Primary Applicant & also verify the income amounts entered in the screen 2 is displayed correctly in the Edit Screen @auth', async ({ page }) => {
525
+ test.setTimeout(0);
526
+ // Screen 1 — Application Language
527
+ await createApplicationPage.selectRandomPreferredLanguage();
528
+ await createApplicationPage.clickNextButton();
529
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
530
+ // Screen 2 — Application Details
531
+ await createApplicationPage.fillApplicationDetails();
532
+ await createApplicationPage.clickNextButton();
533
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
534
+ // Screen 3 — Applicant Income
535
+ const incomeStep = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 10 });
536
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
537
+ const incomeStepYes = incomeStep as ApplicantIncomeScreenFillResultYes;
538
+ await expect.soft(createApplicationPage.Edit_Btn).toBeVisible();
539
+ await createApplicationPage.clickEditButton();
540
+ await expect.soft(createApplicationPage.EditPrimaryTitle_Lbl).toBeVisible();
541
+ //First Name is Mandatory
542
+ await expect.soft(createApplicationPage.HouseholdFirstName_Lbl).toBeVisible();
543
+ await expect.soft(createApplicationPage.FirstName_Input).not.toBeEmpty();
544
+ //Middle Name is Optional
545
+ await expect.soft(createApplicationPage.HouseholdMiddleName_Lbl).toBeVisible();
546
+ //Last Name is Mandatory
547
+ await expect.soft(createApplicationPage.HouseholdLastName_Lbl).toBeVisible();
548
+ await expect.soft(createApplicationPage.LastName_Input).not.toBeEmpty();
549
+ //Date Of Birth is Mandatory
550
+ await expect.soft(createApplicationPage.HouseholdDOB_Lbl).toBeVisible();
551
+ await expect.soft(createApplicationPage.DOB_Input).not.toBeEmpty();
552
+ //SSN is Mandatory
553
+ await expect.soft(createApplicationPage.HouseholdSSN_Lbl).toBeVisible();
554
+ await expect.soft(createApplicationPage.HouseholdSSN_Txtbox).not.toBeEmpty();
555
+ //Relationship to Applicant is Mandatory
556
+ await expect.soft(createApplicationPage.RelationshipToApplicant_Block).toBeVisible();
557
+ expect.soft(await createApplicationPage.RelationshipToApplicant_dd.textContent()).toBe('Self');
558
+ //Gender is Mandatory
559
+ await expect.soft(createApplicationPage.HouseholdMemberGender_Block).toBeVisible();
560
+ await expect.soft(createApplicationPage.Gender_dd).not.toBeEmpty();
561
+ //Marital Status is Mandatory
562
+ await expect.soft(createApplicationPage.HouseholdMemberMaritalStatus_Block).toBeVisible();
563
+ await expect.soft(createApplicationPage.MaritalStatus_dd).not.toBeEmpty();
564
+ //Seeking Benefits is Mandatory
565
+ await expect.soft(createApplicationPage.HouseholdMemberSeekingBenefits_Block).toBeVisible();
566
+ expect.soft(await createApplicationPage.HouseholdMemberSeekingBenefits_dd.textContent()).toBe('Yes');
567
+ // Has Income ÔÇö mirrors Applicant Income (step 2); Yes vs No drives which fields appear on Edit Primary Applicant
568
+ await expect.soft(createApplicationPage.HouseholdMemberHasIncome_Block).toBeVisible();
569
+ if (incomeStepYes.receivedIncome === 'Yes') {
570
+ const { amountsBySource } = incomeStepYes;
571
+ const sourceKeys = Object.keys(amountsBySource) as ApplicantIncomeSimpleSource[];
572
+ const locs = createApplicationPage.getHouseholdIncomeLocatorsForEditPrimary();
573
+
574
+ expect.soft(await createApplicationPage.HaveYouReceivedIncomeInLast30Days_dd.textContent()).toContain('Yes');
575
+ await expect.soft(createApplicationPage.HouseholdTotalMonthlyIncome_Lbl).toBeVisible();
576
+
577
+ const sumOfLineItems = sourceKeys.reduce(
578
+ (sum, src) => sum + CreateApplicationPage.parseAmountField(amountsBySource[src]!),
579
+ 0,
580
+ );
581
+ const parsedTotal = CreateApplicationPage.parseAmountField(
582
+ incomeStepYes.totalPrimaryApplicantIncomeMonthly,
583
+ );
584
+ console.log('[Edit Primary — income amounts]', {
585
+ amountsEnteredOnApplicantIncome: { ...amountsBySource },
586
+ totalPrimaryApplicantIncomeMonthlyRaw: incomeStepYes.totalPrimaryApplicantIncomeMonthly,
587
+ parsedTotal,
588
+ sumOfLineItems,
589
+ totalMatchesSum: parsedTotal === sumOfLineItems,
590
+ });
591
+
592
+ await expect.soft(parsedTotal).toBe(sumOfLineItems);
593
+
594
+ for (const source of sourceKeys) {
595
+ const { block, spinbox } = locs[source];
596
+ await expect.soft(block).toBeVisible();
597
+ const entered = amountsBySource[source]!;
598
+ const shownRaw = await spinbox.inputValue();
599
+ const enteredNum = CreateApplicationPage.parseAmountField(entered);
600
+ const shownNum = CreateApplicationPage.parseAmountField(shownRaw);
601
+ console.log('[Edit Primary — line vs Applicant Income]', {
602
+ source,
603
+ enteredRaw: entered,
604
+ shownRawOnEditForm: shownRaw,
605
+ enteredParsed: enteredNum,
606
+ shownParsed: shownNum,
607
+ match: enteredNum === shownNum,
608
+ });
609
+ await expect.soft(shownNum).toBe(enteredNum);
610
+ }
611
+ } else {
612
+ expect.soft(await createApplicationPage.HaveYouReceivedIncomeInLast30Days_dd.textContent()).toContain('No');
613
+ await expect.soft(createApplicationPage.HouseholdNotWorkingExplaination_Block).toBeVisible();
614
+ await expect.soft(createApplicationPage.NotWorkingExplaination_Txtbox).not.toBeEmpty();
615
+ await expect.soft(createApplicationPage.HouseholdExplain30DaysExpense_Block).toBeVisible();
616
+ await expect.soft(createApplicationPage.Explain30DaysExpense_Txtbox).not.toBeEmpty();
617
+ await expect.soft(createApplicationPage.HouseholdReceiveSupportForNecessities_Block).toBeVisible();
618
+ await expect.soft(createApplicationPage.ReceiveSupportForNecessities_dd).not.toBeEmpty();
619
+ await expect.soft(createApplicationPage.HouseholdEngageInFinancialTransactions_Block).toBeVisible();
620
+ await expect.soft(createApplicationPage.EngageInFinancialTransactions_dd).not.toBeEmpty();
621
+ await expect.soft(createApplicationPage.HouseholdReceivingAssistance_Lbl).toBeVisible();
622
+ }
623
+ });
624
+
625
+ test('Verify all the elements are visible on the Create Application page - Household Members - Add Household Member @auth', async ({ page }) => {
626
+ test.setTimeout(0);
627
+ // Screen 1 — Application Language
628
+ await createApplicationPage.selectRandomPreferredLanguage();
629
+ await createApplicationPage.clickNextButton();
630
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
631
+ // Screen 2 — Application Details
632
+ await createApplicationPage.fillApplicationDetails();
633
+ await createApplicationPage.clickNextButton();
634
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
635
+ // Screen 3 — Applicant Income
636
+ await createApplicationPage.fillApplicantIncomeScreenRandomly();
637
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
638
+ await expect.soft(createApplicationPage.AddHouseholdMember_Btn).toBeVisible();
639
+ await createApplicationPage.clickAddHouseholdMemberButton();
640
+ await expect.soft(createApplicationPage.HouseholdFirstName_Lbl).toBeVisible();
641
+ await expect.soft(createApplicationPage.FirstName_Input).toBeEmpty();
642
+ await expect.soft(createApplicationPage.HouseholdMiddleName_Lbl).toBeVisible();
643
+ await expect.soft(createApplicationPage.MiddleName_Input).toBeEmpty();
644
+ await expect.soft(createApplicationPage.HouseholdLastName_Lbl).toBeVisible();
645
+ await expect.soft(createApplicationPage.LastName_Input).toBeEmpty();
646
+ await expect.soft(createApplicationPage.HouseholdDOB_Lbl).toBeVisible();
647
+ await expect.soft(createApplicationPage.DOB_Input).toBeEmpty();
648
+ await expect.soft(createApplicationPage.HouseholdSSN_Lbl).toBeVisible();
649
+ await expect.soft(createApplicationPage.HouseholdSSN_Txtbox).toBeEmpty();
650
+ await expect.soft(createApplicationPage.RelationshipToApplicant_Block).toBeVisible();
651
+ await expect.soft(createApplicationPage.HouseholdMemberGender_Block).toBeVisible();
652
+ await expect.soft(await createApplicationPage.Gender_dd.textContent()).toBe('Select an Option');
653
+ await expect.soft(createApplicationPage.HouseholdMemberMaritalStatus_Block).toBeVisible();
654
+ await expect.soft(await createApplicationPage.MaritalStatus_dd.textContent()).toBe('Select an Option');
655
+ await expect.soft(createApplicationPage.HouseholdMemberSeekingBenefits_Block).toBeVisible();
656
+ await expect.soft(await createApplicationPage.HouseholdMemberSeekingBenefits_dd.textContent()).toContain('Yes');
657
+ await expect.soft(createApplicationPage.HouseholdMemberHasIncome_Block).toBeVisible();
658
+ //Validation for Elements if the Household Member has Income
659
+ await createApplicationPage.clickHouseholdMemberHasIncomeDropdown();
660
+ await createApplicationPage.selectDropdownOption(createApplicationPage.HouseholdMemberHasIncome_ddl, 'Yes');
661
+ await expect.soft(createApplicationPage.HouseholdIncomeSource_Lbl).toBeVisible();
662
+ await expect.soft(createApplicationPage.Paycheck_ChkBox).toBeVisible();
663
+ await expect.soft(createApplicationPage.Pension_ChkBox).toBeVisible();
664
+ await expect.soft(createApplicationPage.RentalIncome_ChkBox).toBeVisible();
665
+ await expect.soft(createApplicationPage.SelfEmployed_ChkBox).toBeVisible();
666
+ await expect.soft(createApplicationPage.FourZeroOneK_ChkBox).toBeVisible();
667
+ await expect.soft(createApplicationPage.SocialSecurityRetirement_ChkBox).toBeVisible();
668
+ await expect.soft(createApplicationPage.SSDI_ChkBox).toBeVisible();
669
+ await expect.soft(createApplicationPage.UnemploymentCompensation_ChkBox).toBeVisible();
670
+ await expect.soft(createApplicationPage.InterestIncome_ChkBox).toBeVisible();
671
+ await expect.soft(createApplicationPage.AnnuityPayments_ChkBox).toBeVisible();
672
+ await expect.soft(createApplicationPage.Dividends_ChkBox).toBeVisible();
673
+ await expect.soft(createApplicationPage.HouseholdTotalMonthlyIncome_Lbl).toBeVisible();
674
+ await expect.soft(createApplicationPage.HouseholdTotalMonthlyHouseholdIncome_Value).toBeVisible();
675
+ //Click all the chkboxes
676
+ await createApplicationPage.clickAllIncomeSourcesChkboxes();
677
+ //Validation For Paycheck
678
+ //await expect.soft(createApplicationPage.HouseholdPaycheckMostRecent_Text).toBeVisible();
679
+ await expect.soft(createApplicationPage.HouseholdPaycheckAlternate_Text).toBeVisible();
680
+ await expect.soft(createApplicationPage.HouseholdPaycheck_Block).toBeVisible();
681
+ await expect.soft(createApplicationPage.HouseholdFirstEmployerGMI_Txtbox).toBeVisible();
682
+ //Validation For Pension
683
+ await expect.soft(createApplicationPage.HouseholdPensionAmount_Txtbox).toBeVisible();
684
+ //Validation For Rental Income
685
+ await expect.soft(createApplicationPage.HouseholdRentalPropertyAmount_Txtbox).toBeVisible();
686
+ //Validation For Self Employed
687
+ await expect.soft(createApplicationPage.HouseholdSelfEmployedAmount_Txtbox).toBeVisible();
688
+ //Validation For Four Zero One K
689
+ await expect.soft(createApplicationPage.HouseholdFourZeroOneKAmount_Txtbox).toBeVisible();
690
+ //Validation For Social Security Retirement
691
+ await expect.soft(createApplicationPage.HouseholdSocialSecurityRetirementAmount_Txtbox).toBeVisible();
692
+ //Validation For SSDI
693
+ await expect.soft(createApplicationPage.HouseholdSSDIAmount_Txtbox).toBeVisible();
694
+ //Validation For Unemployment Compensation
695
+ await expect.soft(createApplicationPage.HouseholdUnemploymentCompensationAmount_Txtbox).toBeVisible();
696
+ //Validation For Interest Income
697
+ await expect.soft(createApplicationPage.HouseholdInterestIncomeAmount_Txtbox).toBeVisible();
698
+ //Validation For Annuity Payments
699
+ await expect.soft(createApplicationPage.HouseholdAnnuityPaymentsAmount_Txtbox).toBeVisible();
700
+ //Validation For Dividends
701
+ await expect.soft(createApplicationPage.HouseholdDividendsAmount_Txtbox).toBeVisible();
702
+
703
+ //Validation for Elements if the Household Member has No Income
704
+ await createApplicationPage.clickHouseholdMemberHasIncomeDropdown();
705
+ await createApplicationPage.selectDropdownOption(createApplicationPage.HouseholdMemberHasIncome_ddl, 'No');
706
+ await expect.soft(createApplicationPage.HouseholdNotWorkingExplaination_Block).toBeVisible();
707
+ await expect.soft(createApplicationPage.HouseholdExplain30DaysExpense_Block).toBeVisible();
708
+ await expect.soft(createApplicationPage.HouseholdReceiveSupportForNecessities_Block).toBeVisible();
709
+ await expect.soft(createApplicationPage.HouseholdEngageInFinancialTransactions_Block).toBeVisible();
710
+ await expect.soft(createApplicationPage.HouseholdReceivingAssistance_Lbl).toBeVisible();
711
+ });
712
+
713
+ test('Verify the total monthly household income is getting displayed correctly in the Household Members screen @auth', async ({ page }) => {
714
+ test.setTimeout(0);
715
+ // Screen 1 — Application Language
716
+ await createApplicationPage.selectRandomPreferredLanguage();
717
+ await createApplicationPage.clickNextButton();
718
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
719
+ // Screen 2 — Application Details
720
+ await createApplicationPage.fillApplicationDetails();
721
+ await createApplicationPage.clickNextButton();
722
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
723
+ // Screen 3 — Applicant Income
724
+ const incomeStep = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 3 });
725
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
726
+ const incomeStepYes = incomeStep as ApplicantIncomeScreenFillResultYes;
727
+ // Household total should match step-2 total field; toHaveValue expects a string (not amountsBySource).
728
+ await webActions.waitForElementAttached(createApplicationPage.Edit_Btn);
729
+ await expect
730
+ .soft(await createApplicationPage.TotalMonthlyHouseholdIncome_Value.textContent())
731
+ .toContain(incomeStepYes.totalPrimaryApplicantIncomeMonthly.toString());
732
+ });
733
+
734
+ test('Verify the total monthly household income is getting displayed correctly in the Household Members screen after a new household member is added & Verify the delete functionality @auth', async ({ page }) => {
735
+ test.setTimeout(0);
736
+ // Screen 1 — Application Language
737
+ await createApplicationPage.selectRandomPreferredLanguage();
738
+ await createApplicationPage.clickNextButton();
739
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
740
+ // Screen 2 — Application Details
741
+ await createApplicationPage.fillApplicationDetails();
742
+ await createApplicationPage.clickNextButton();
743
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
744
+ // Screen 3 — Applicant Income
745
+ const incomeStep = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 3 });
746
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
747
+ const incomeStepYes = incomeStep as ApplicantIncomeScreenFillResultYes;
748
+ await expect.soft(createApplicationPage.AddHouseholdMember_Btn).toBeVisible();
749
+ const newHouseholdMember = await createApplicationPage.addHouseholdMember({incomeSourceCount: 11});
750
+ if (!newHouseholdMember) {
751
+ throw new Error('Expected addHouseholdMember to return income totals (fillRandomIncome default).');
752
+ }
753
+ const sum =
754
+ CreateApplicationPage.parseAmountField(incomeStepYes.totalPrimaryApplicantIncomeMonthly) +
755
+ CreateApplicationPage.parseAmountField(newHouseholdMember.totalPrimaryApplicantIncomeMonthly);
756
+ const displayed = CreateApplicationPage.parseAmountField(
757
+ (await createApplicationPage.TotalMonthlyHouseholdIncome_Value.textContent()) ?? '',
758
+ );
759
+ expect.soft(displayed).toBe(sum);
760
+ await expect.soft(createApplicationPage.Delete_Btn).toBeVisible();
761
+ await createApplicationPage.clickHouseholdMemberDeleteButton();
762
+ await expect.soft(createApplicationPage.DeleteHouseholdMember_Popup).toBeVisible();
763
+ await expect.soft(createApplicationPage.DeletePopup_Heading).toBeVisible();
764
+ await expect.soft(createApplicationPage.DeletePopup_Message2).toBeVisible();
765
+ await expect.soft(createApplicationPage.DeletePopup_MessagePoint1).toBeVisible();
766
+ await expect.soft(createApplicationPage.DeletePopup_MessagePoint2).toBeVisible();
767
+ await expect.soft(createApplicationPage.DeletePopup_MessagePoint3).toBeVisible();
768
+ await expect.soft(createApplicationPage.Cancel_Btn).toBeVisible();
769
+ await expect.soft(createApplicationPage.Delete_Btn.last()).toBeVisible();
770
+ await createApplicationPage.clickCancelButton();
771
+ await expect.soft(createApplicationPage.DeleteHouseholdMember_Popup).not.toBeVisible();
772
+ //Clicks Delete Button in the list
773
+ await createApplicationPage.clickHouseholdMemberDeleteButton();
774
+ //Clicks Delete Button in the popup
775
+ await createApplicationPage.clickHouseholdDeletePopupConfirmButton();
776
+ await expect.soft(createApplicationPage.DeleteSuccess_Message).toBeVisible();
777
+ });
778
+
779
+ test('Verify the user is able to edit the household member details and the total monthly household income is getting displayed correctly in the Household Members screen @auth', async ({ page }) => {
780
+ test.setTimeout(0);
781
+ // Screen 1 — Application Language
782
+ await createApplicationPage.selectRandomPreferredLanguage();
783
+ await createApplicationPage.clickNextButton();
784
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
785
+ // Screen 2 — Application Details
786
+ await createApplicationPage.fillApplicationDetails();
787
+ await createApplicationPage.clickNextButton();
788
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
789
+ // Screen 3 — Applicant Income
790
+ const incomeStep1 = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 3 });
791
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
792
+ const incomeStep1Yes = incomeStep1 as ApplicantIncomeScreenFillResultYes;
793
+ await createApplicationPage.clickEditButton();
794
+ await expect.soft(createApplicationPage.EditPrimaryTitle_Lbl).toBeVisible();
795
+ const incomeStep2 = await createApplicationPage.fillHouseholdMemberIncomeRandomly({
796
+ incomeSourceCount: 1,
797
+ excludeSources: Object.keys(incomeStep1Yes.amountsBySource) as ApplicantIncomeSimpleSource[],
798
+ });
799
+ const step2AmountStr = Object.values(incomeStep2.amountsBySource).find((v) => v != null) ?? '0';
800
+ const sumOfIncome =
801
+ CreateApplicationPage.parseAmountField(incomeStep1Yes.totalPrimaryApplicantIncomeMonthly) +
802
+ CreateApplicationPage.parseAmountField(step2AmountStr);
803
+ console.log('sumOfIncome: ', sumOfIncome);
804
+ console.log('incomeStep2.totalPrimaryApplicantIncomeMonthly: ', incomeStep2.totalPrimaryApplicantIncomeMonthly);
805
+ console.log('await createApplicationPage.HouseholdTotalMonthlyHouseholdIncome_Value: ', CreateApplicationPage.parseAmountField(await createApplicationPage.HouseholdTotalMonthlyHouseholdIncome_Value.textContent() ?? ''));
806
+ await expect.soft(CreateApplicationPage.parseAmountField(await createApplicationPage.HouseholdTotalMonthlyHouseholdIncome_Value.textContent() ?? '')).toBe(sumOfIncome);
807
+ });
808
+
809
+ test('Verify the application details are filled correctly in screen - 1, 2 & 3 - Application Details & Income and the user moves to the next screen - 4 - Document Upload @auth', async ({ page }) => {
810
+ test.setTimeout(0);
811
+ // Screen 1 — Application Language
812
+ await createApplicationPage.selectRandomPreferredLanguage();
813
+ await createApplicationPage.clickNextButton();
814
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
815
+ // Screen 2 — Application Details
816
+ await createApplicationPage.fillApplicationDetails();
817
+ await createApplicationPage.clickNextButton();
818
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
819
+ // Screen 3 — Applicant Income
820
+ const incomeStep = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 1 });
821
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
822
+ // Screen 4 — Household Members
823
+ await createApplicationPage.clickNextButton();
824
+ await webActions.waitForElementAttached(createApplicationPage.DocumentsTitle_Lbl);
825
+ await expect.soft(createApplicationPage.DocumentsTitle_Lbl).toBeVisible();
826
+ });
827
+ });
828
+
829
+ test.describe('Screen 5 — Document Upload', () => {
830
+ test('Verify the elements are visible on the Document Upload screen @auth', async ({ page }) => {
831
+ test.setTimeout(0);
832
+ // Screen 1 — Application Language
833
+ await createApplicationPage.selectRandomPreferredLanguage();
834
+ await createApplicationPage.clickNextButton();
835
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
836
+ // Screen 2 — Application Details
837
+ await createApplicationPage.fillApplicationDetails();
838
+ await createApplicationPage.clickNextButton();
839
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
840
+ // Screen 3 — Applicant Income
841
+ const incomeStep = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 10 });
842
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
843
+ // Screen 4 — Household Members
844
+ await createApplicationPage.clickNextButton();
845
+ await webActions.waitForElementAttached(createApplicationPage.DocumentsTitle_Lbl);
846
+ const incomeStepYes = incomeStep as ApplicantIncomeScreenFillResultYes;
847
+ expect(incomeStepYes.receivedIncome).toBe('Yes');
848
+ const incomeSources = Object.keys(incomeStepYes.amountsBySource) as ApplicantIncomeSimpleSource[];
849
+ expect.soft(incomeSources.length).toBeGreaterThan(0);
850
+
851
+ await expect.soft(createApplicationPage.DocumentsNotify_Lbl).toBeVisible();
852
+ await expect.soft(createApplicationPage.DocumentsInstructions_Text).toBeVisible();
853
+ await expect.soft(createApplicationPage.MemberwiseDocuments_Block).toBeVisible();
854
+ await expect.soft(createApplicationPage.MemberwiseName_Lbl).toBeVisible();
855
+
856
+ for (const source of incomeSources) {
857
+ const upload = createApplicationPage.getDocumentUploadLocatorForIncomeSource(source);
858
+ await expect.soft(upload).toBeVisible();
859
+ }
860
+ });
861
+
862
+ test('Verify the files are getting uploaded or not on the Document Upload screen @auth', async ({ page }) => {
863
+ test.setTimeout(0);
864
+ // Screen 1 — Application Language
865
+ await createApplicationPage.selectRandomPreferredLanguage();
866
+ await createApplicationPage.clickNextButton();
867
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
868
+ // Screen 2 — Application Details
869
+ await createApplicationPage.fillApplicationDetails();
870
+ await createApplicationPage.clickNextButton();
871
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
872
+ // Screen 3 — Applicant Income
873
+ const incomeStep = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 11 });
874
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
875
+ // Screen 4 — Household Members
876
+ await createApplicationPage.clickNextButton();
877
+ await webActions.waitForElementAttached(createApplicationPage.DocumentsTitle_Lbl);
878
+ const incomeStepYes = incomeStep as ApplicantIncomeScreenFillResultYes;
879
+ expect(incomeStepYes.receivedIncome).toBe('Yes');
880
+ const incomeSources = Object.keys(incomeStepYes.amountsBySource) as ApplicantIncomeSimpleSource[];
881
+ expect.soft(incomeSources.length).toBeGreaterThan(0);
882
+
883
+ const uploadedIdentificationCard = await createApplicationPage.uploadIdentificationCardIfPresent();
884
+ for (const source of incomeSources) {
885
+ const upload = createApplicationPage.getDocumentUploadLocatorForIncomeSource(source);
886
+ await expect.soft(upload).toBeAttached();
887
+ await upload.setInputFiles('test-data/Sample.png');
888
+ //await webActions.waitForElementAttached(createApplicationPage.DocumentUpload_Dialog);
889
+ await webActions.waitForElementAttached(createApplicationPage.DocumentUploadSuccess_Icon);
890
+ await createApplicationPage.clickDoneButton();
891
+ //const fileCount = await upload.evaluate((el: HTMLInputElement) => el.files?.length ?? 0);
892
+ //expect.soft(fileCount).toBe(1);
893
+ }
894
+ await webActions.waitForElementAttached(createApplicationPage.UploadedDocuments_Table);
895
+ await expect.soft(createApplicationPage.UploadedDocument_Lbl).toBeVisible();
896
+ await expect.soft(createApplicationPage.UploadedDocuments_Table).toBeVisible();
897
+ const uploadedDocuments = await createApplicationPage.UploadedDocuments_Table.locator('tbody tr');
898
+ const uploadedDocumentCount = await uploadedDocuments.count();
899
+ expect.soft(uploadedDocumentCount).toBeGreaterThan(0);
900
+ const expectedUploadedDocuments = uploadedIdentificationCard
901
+ ? ['Government Issued ID', ...createApplicationFormData.uploadedDocumentsReferences]
902
+ : createApplicationFormData.uploadedDocumentsReferences;
903
+ for (let i = 0; i < uploadedDocumentCount; i++) {
904
+ const documentName = await uploadedDocuments.nth(i).locator('td:nth-child(2)').textContent();
905
+ console.log('documentName: ', documentName);
906
+ expect.soft(documentName).toContain(expectedUploadedDocuments[i]);
907
+ }
908
+ });
909
+
910
+ test('Verify the user is able to view or delete the uploaded document on the Document Upload screen @auth', async ({ page }) => {
911
+ test.setTimeout(0);
912
+ // Screen 1 — Application Language
913
+ await createApplicationPage.selectRandomPreferredLanguage();
914
+ await createApplicationPage.clickNextButton();
915
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
916
+ // Screen 2 — Application Details
917
+ await createApplicationPage.fillApplicationDetails();
918
+ await createApplicationPage.clickNextButton();
919
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
920
+ // Screen 3 — Applicant Income
921
+ const incomeStep = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 1 });
922
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
923
+ // Screen 4 — Household Members
924
+ await createApplicationPage.clickNextButton();
925
+ await webActions.waitForElementAttached(createApplicationPage.DocumentsTitle_Lbl);
926
+ const incomeStepYes = incomeStep as ApplicantIncomeScreenFillResultYes;
927
+ const incomeSources = Object.keys(incomeStepYes.amountsBySource) as ApplicantIncomeSimpleSource[];
928
+ const uploadedIdentificationCard = await createApplicationPage.uploadIdentificationCardIfPresent();
929
+ for (const source of incomeSources) {
930
+ const upload = createApplicationPage.getDocumentUploadLocatorForIncomeSource(source);
931
+ await expect.soft(upload).toBeAttached();
932
+ await upload.setInputFiles('test-data/Sample.png');
933
+ await webActions.waitForElementAttached(createApplicationPage.DocumentUploadSuccess_Icon);
934
+ await createApplicationPage.clickDoneButton();
935
+ }
936
+ await webActions.waitForElementAttached(createApplicationPage.UploadedDocuments_Table);
937
+ const uploadedRows = createApplicationPage.UploadedDocuments_Table.locator('tbody tr');
938
+ const expectedRowCount = incomeSources.length + (uploadedIdentificationCard ? 1 : 0);
939
+ await expect(uploadedRows).toHaveCount(expectedRowCount, { timeout: 30_000 });
940
+ await expect.soft(createApplicationPage.DocumentView_Btn).toBeVisible();
941
+ await expect.soft(createApplicationPage.DocumentDelete_Btn).toBeVisible();
942
+
943
+ const viewResultPromise = Promise.race([
944
+ page.waitForEvent('download').then((download) => ({ type: 'download' as const, download })),
945
+ page.waitForEvent('popup').then((popup) => ({ type: 'popup' as const, popup })),
946
+ ]);
947
+ await createApplicationPage.clickViewButton();
948
+ const viewResult = await viewResultPromise;
949
+ if (viewResult.type === 'download') {
950
+ await expect.soft(viewResult.download.suggestedFilename()).toContain('Sample');
951
+ } else {
952
+ await viewResult.popup.close();
953
+ }
954
+
955
+ const cancelDialog = await createApplicationPage.clickDeleteButtonAndHandleConfirm('dismiss');
956
+ expect.soft(cancelDialog.type()).toBe('confirm');
957
+ expect.soft(cancelDialog.message()).toMatch(/delete this document/i);
958
+ await expect.soft(uploadedRows).toHaveCount(expectedRowCount);
959
+
960
+ const acceptDialog = await createApplicationPage.clickDeleteButtonAndHandleConfirm('accept');
961
+ expect.soft(acceptDialog.type()).toBe('confirm');
962
+ expect.soft(acceptDialog.message()).toMatch(/delete this document/i);
963
+ await expect.soft(uploadedRows).toHaveCount(expectedRowCount - 1);
964
+ });
965
+ });
966
+
967
+ test.describe('Screen 6 — Enrollment Acknowledgement', () => {
968
+ test('Verify the application details are filled correctly in screen - 1, 2, 3 & 4 - the user moves to the next screen - 5 - Enrollment Acknowledgement @auth', async ({ page }) => {
969
+ test.setTimeout(0);
970
+ // Screen 1 — Application Language
971
+ await createApplicationPage.selectRandomPreferredLanguage();
972
+ await createApplicationPage.clickNextButton();
973
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
974
+ // Screen 2 — Application Details
975
+ await createApplicationPage.fillApplicationDetails();
976
+ await createApplicationPage.clickNextButton();
977
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
978
+ // Screen 3 — Applicant Income
979
+ const incomeStep = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 1 });
980
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
981
+ // Screen 4 — Household Members
982
+ await createApplicationPage.clickNextButton();
983
+ await webActions.waitForElementAttached(createApplicationPage.DocumentsTitle_Lbl);
984
+ // Screen 5 — Document Upload
985
+ await createApplicationPage.uploadDocumentsForIncomeStep(incomeStep as ApplicantIncomeScreenFillResultYes);
986
+ await createApplicationPage.clickNextButton();
987
+ await webActions.waitForElementAttached(createApplicationPage.EnrollmentAcknowledgement_Block);
988
+ await webActions.waitForElementAttached(createApplicationPage.EnrollmentAcknowledgement_Block);
989
+ await expect.soft(createApplicationPage.EnrollmentAcknowledgement_Block).toBeVisible();
990
+ });
991
+
992
+ test('Verify the elements are visible on the Enrollment Acknowledgement screen @auth', async ({ page }) => {
993
+ test.setTimeout(0);
994
+ // Screen 1 — Application Language
995
+ await createApplicationPage.selectRandomPreferredLanguage();
996
+ await createApplicationPage.clickNextButton();
997
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
998
+ // Screen 2 — Application Details
999
+ await createApplicationPage.fillApplicationDetails();
1000
+ await createApplicationPage.clickNextButton();
1001
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
1002
+ // Screen 3 — Applicant Income
1003
+ const incomeStep = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 1 });
1004
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
1005
+ // Screen 4 — Household Members
1006
+ await createApplicationPage.clickNextButton();
1007
+ await webActions.waitForElementAttached(createApplicationPage.DocumentsTitle_Lbl);
1008
+ // Screen 5 — Document Upload
1009
+ await createApplicationPage.uploadDocumentsForIncomeStep(incomeStep as ApplicantIncomeScreenFillResultYes);
1010
+ await createApplicationPage.clickNextButton();
1011
+ await webActions.waitForElementAttached(createApplicationPage.EnrollmentAcknowledgement_Block);
1012
+ await expect.soft(createApplicationPage.EnrollmentAcknowledgementTitle_Lbl).toBeVisible();
1013
+ await expect.soft(createApplicationPage.EnrollmentAcknowledgementText1_Block).toBeVisible();
1014
+ expect.soft(await createApplicationPage.EnrollmentAcknowledgementText1_Block.textContent()).toContain(createApplicationFormData.enrollmentAcknowledgementText1);
1015
+ await expect.soft(createApplicationPage.EnrollmentAcknowledgementText2_Block).toBeVisible();
1016
+ expect.soft(createApplicationPage.normalizeText(await createApplicationPage.EnrollmentAcknowledgementText2_Block.textContent())).toContain(createApplicationFormData.enrollmentAcknowledgementText2);
1017
+ await expect.soft(createApplicationPage.EnrollmentAcknowledgementMemberHandbook_Lnk).toBeVisible();
1018
+ const link =await createApplicationPage.EnrollmentAcknowledgementMemberHandbook_Lnk.getAttribute('href');
1019
+ console.log('link: ', link);
1020
+ expect.soft(link).toContain('https://polkhealthcareplan.net/getting-started/plan-rights-and-privacy/');
1021
+ await expect.soft(createApplicationPage.EnrollmentAcknowledgementText3_Block).toBeVisible();
1022
+ expect.soft(await createApplicationPage.EnrollmentAcknowledgementText3_Block.textContent()).toContain(createApplicationFormData.enrollmentAcknowledgementText3);
1023
+ await expect.soft(createApplicationPage.EnrollmentAcknowledgementText4_Block).toBeVisible();
1024
+ expect.soft(await createApplicationPage.EnrollmentAcknowledgementText4_Block.textContent()).toContain(createApplicationFormData.enrollmentAcknowledgementText4);
1025
+ });
1026
+ });
1027
+
1028
+ test.describe('Screen 7 — Additional Information & Attestation', () => {
1029
+ test('Verify the application details are filled correctly in screen - 1, 2, 3, 4 & 5- the user moves to the next screen - 6 - Additional Information & Attestation @auth', async ({ page }) => {
1030
+ test.setTimeout(0);
1031
+ // Screen 1 — Application Language
1032
+ await createApplicationPage.selectRandomPreferredLanguage();
1033
+ await createApplicationPage.clickNextButton();
1034
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
1035
+ // Screen 2 — Application Details
1036
+ await createApplicationPage.fillApplicationDetails();
1037
+ await createApplicationPage.clickNextButton();
1038
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
1039
+ // Screen 3 — Applicant Income
1040
+ const incomeStep = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 1 });
1041
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
1042
+ // Screen 4 — Household Members
1043
+ await createApplicationPage.clickNextButton();
1044
+ await webActions.waitForElementAttached(createApplicationPage.DocumentsTitle_Lbl);
1045
+ // Screen 5 — Document Upload
1046
+ await createApplicationPage.uploadDocumentsForIncomeStep(incomeStep as ApplicantIncomeScreenFillResultYes);
1047
+ await createApplicationPage.clickNextButton();
1048
+ await webActions.waitForElementAttached(createApplicationPage.EnrollmentAcknowledgement_Block);
1049
+ // Screen 6 — Enrollment Acknowledgement
1050
+ await createApplicationPage.clickEnrollmentAcknowledgementChkbox();
1051
+ await createApplicationPage.clickNextButton();
1052
+ await webActions.waitForElementAttached(createApplicationPage.PrimaryCareProvider_Block);
1053
+ await expect.soft(createApplicationPage.AdditionalInformation_Block).toBeVisible();
1054
+ });
1055
+
1056
+ test('Verify the elements are visible on the Additional Information & Attestation screen @auth', async ({ page }) => {
1057
+ test.setTimeout(0);
1058
+ // Screen 1 — Application Language
1059
+ await createApplicationPage.selectRandomPreferredLanguage();
1060
+ await createApplicationPage.clickNextButton();
1061
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
1062
+ // Screen 2 — Application Details
1063
+ await createApplicationPage.fillApplicationDetails();
1064
+ await createApplicationPage.clickNextButton();
1065
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
1066
+ // Screen 3 — Applicant Income
1067
+ const incomeStep = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 1 });
1068
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
1069
+ // Screen 4 — Household Members
1070
+ await createApplicationPage.clickNextButton();
1071
+ await webActions.waitForElementAttached(createApplicationPage.DocumentsTitle_Lbl);
1072
+ // Screen 5 — Document Upload
1073
+ await createApplicationPage.uploadDocumentsForIncomeStep(incomeStep as ApplicantIncomeScreenFillResultYes);
1074
+ await createApplicationPage.clickNextButton();
1075
+ await webActions.waitForElementAttached(createApplicationPage.EnrollmentAcknowledgement_Block);
1076
+ // Screen 6 — Enrollment Acknowledgement
1077
+ await createApplicationPage.clickEnrollmentAcknowledgementChkbox();
1078
+ await createApplicationPage.clickNextButton();
1079
+ await webActions.waitForElementAttached(createApplicationPage.PrimaryCareProvider_Block);
1080
+ await expect.soft(createApplicationPage.PrimaryCareProvider_Block).toBeVisible();
1081
+ await expect.soft(createApplicationPage.PrimaryCareProvider_dd).toBeVisible();
1082
+ await expect.soft(createApplicationPage.ApplicationModeOfUpdates_Block).toBeVisible();
1083
+ await expect.soft(createApplicationPage.ApplicationModeOfUpdates_Email_ChkBox).toBeVisible();
1084
+ await expect.soft(createApplicationPage.ApplicationModeOfUpdates_TextMessage_ChkBox).toBeVisible();
1085
+ await expect.soft(createApplicationPage.ApplicationModeOfUpdates_Telephone_ChkBox).toBeVisible();
1086
+ await expect.soft(createApplicationPage.PlanModeOfUpdates_Block).toBeVisible();
1087
+ await expect.soft(createApplicationPage.PlanModeOfUpdates_Email_ChkBox).toBeVisible();
1088
+ await expect.soft(createApplicationPage.PlanModeOfUpdates_TextMessage_ChkBox).toBeVisible();
1089
+ await expect.soft(createApplicationPage.PlanModeOfUpdates_Telephone_ChkBox).toBeVisible();
1090
+ await expect.soft(createApplicationPage.PlanModeOfUpdates_NoContact_ChkBox).toBeVisible();
1091
+ await expect.soft(createApplicationPage.SMSPrivacyDisclosure_Block).toBeVisible();
1092
+ await expect.soft(createApplicationPage.PreviewApplication_Lnk).toBeVisible();
1093
+ const [previewPage] = await Promise.all([
1094
+ page.waitForEvent('popup'),
1095
+ createApplicationPage.PreviewApplication_Lnk.click(),
1096
+ ]);
1097
+ await webActions.waitForElementAttached(previewPage.locator('iframe:visible'));
1098
+ await expect.soft(previewPage.locator('iframe:visible')).toBeVisible();
1099
+ await previewPage.close();
1100
+
1101
+ await expect.soft(createApplicationPage.ICertifyThat_Lbl).toBeVisible();
1102
+ await expect.soft(createApplicationPage.TypeLegalName_Textbox).toBeVisible();
1103
+ await expect.soft(createApplicationPage.TodayDate_Textbox).toBeVisible();
1104
+ const today = new Date();
1105
+ const expectedToday = [
1106
+ String(today.getDate()).padStart(2, '0'),
1107
+ String(today.getMonth() + 1).padStart(2, '0'),
1108
+ today.getFullYear(),
1109
+ ].join('-');
1110
+ await expect.soft(createApplicationPage.TodayDate_Textbox).toHaveValue(expectedToday);
1111
+ await expect.soft(createApplicationPage.Disclaimer_Lbl).toBeVisible();
1112
+ });
1113
+ });
1114
+
1115
+ test.describe('Screen 8 — Sign Consent Form', () => {
1116
+ test('Verify the application details are filled correctly in screen - 1, 2, 3, 4, 5 & 6- the user moves to the next screen - 7 - Sign Consent Form @auth', async ({ page }) => {
1117
+ test.setTimeout(0);
1118
+ // Screen 1 — Application Language
1119
+ await createApplicationPage.selectRandomPreferredLanguage();
1120
+ await createApplicationPage.clickNextButton();
1121
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
1122
+ // Screen 2 — Application Details
1123
+ await createApplicationPage.fillApplicationDetails();
1124
+ await createApplicationPage.clickNextButton();
1125
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
1126
+ // Screen 3 — Applicant Income
1127
+ const incomeStep = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 1 });
1128
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
1129
+ // Screen 4 — Household Members
1130
+ await createApplicationPage.clickNextButton();
1131
+ await webActions.waitForElementAttached(createApplicationPage.DocumentsTitle_Lbl);
1132
+ // Screen 5 — Document Upload
1133
+ await createApplicationPage.uploadDocumentsForIncomeStep(incomeStep as ApplicantIncomeScreenFillResultYes);
1134
+ await createApplicationPage.clickNextButton();
1135
+ await webActions.waitForElementAttached(createApplicationPage.EnrollmentAcknowledgement_Block);
1136
+ // Screen 6 — Enrollment Acknowledgement
1137
+ await createApplicationPage.clickEnrollmentAcknowledgementChkbox();
1138
+ await createApplicationPage.clickNextButton();
1139
+ await webActions.waitForElementAttached(createApplicationPage.PrimaryCareProvider_Block);
1140
+ // Screen 7 — Additional Information & Attestation
1141
+ await createApplicationPage.fillAdditionalInformationScreenRandomly();
1142
+ await createApplicationPage.clickNextButton();
1143
+ await webActions.waitForElementAttached(createApplicationPage.SignConsentFormTitle_Lbl);
1144
+ await expect.soft(createApplicationPage.SignConsentFormTitle_Lbl).toBeVisible();
1145
+ });
1146
+
1147
+ test('Verify the elements are visible on the Sign Consent Form screen @auth', async ({ page }) => {
1148
+ test.setTimeout(0);
1149
+ // Screen 1 — Application Language
1150
+ await createApplicationPage.selectRandomPreferredLanguage();
1151
+ await createApplicationPage.clickNextButton();
1152
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
1153
+ // Screen 2 — Application Details
1154
+ await createApplicationPage.fillApplicationDetails();
1155
+ await createApplicationPage.clickNextButton();
1156
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
1157
+ // Screen 3 — Applicant Income
1158
+ const incomeStep = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 1 });
1159
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
1160
+ // Screen 4 — Household Members
1161
+ await createApplicationPage.clickNextButton();
1162
+ await webActions.waitForElementAttached(createApplicationPage.DocumentsTitle_Lbl);
1163
+ // Screen 5 — Document Upload
1164
+ await createApplicationPage.uploadDocumentsForIncomeStep(incomeStep as ApplicantIncomeScreenFillResultYes);
1165
+ await createApplicationPage.clickNextButton();
1166
+ await webActions.waitForElementAttached(createApplicationPage.EnrollmentAcknowledgement_Block);
1167
+ // Screen 6 — Enrollment Acknowledgement
1168
+ await createApplicationPage.clickEnrollmentAcknowledgementChkbox();
1169
+ await createApplicationPage.clickNextButton();
1170
+ await webActions.waitForElementAttached(createApplicationPage.PrimaryCareProvider_Block);
1171
+ // Screen 7 — Additional Information & Attestation
1172
+ await createApplicationPage.fillAdditionalInformationScreenRandomly();
1173
+ await createApplicationPage.clickNextButton();
1174
+ await webActions.waitForElementAttached(createApplicationPage.SignConsentFormTitle_Lbl);
1175
+ await expect.soft(createApplicationPage.SignConsentFormTitle_Lbl).toBeVisible();
1176
+ //await webActions.waitForElementAttached(createApplicationPage.Next_Btn);
1177
+ if(await createApplicationPage.SignConsentForm_Header.isVisible()) {
1178
+ await expect.soft(createApplicationPage.SignConsentForm_Header).toBeVisible();
1179
+ await expect.soft(createApplicationPage.NameAndInformation_Block).toBeVisible();
1180
+ await expect.soft(createApplicationPage.UseAndDislosure_Block).toBeVisible();
1181
+ await expect.soft(createApplicationPage.UseAndDislosure_Text).toBeVisible();
1182
+ await expect.soft(createApplicationPage.ConsentInformation_ChkBox).toBeVisible();
1183
+ await expect.soft(createApplicationPage.Signature_Block).toBeVisible();
1184
+ await expect.soft(createApplicationPage.Signature_Canvas).toBeVisible();
1185
+ await expect.soft(createApplicationPage.SignatureHint_Lbl).toBeVisible();
1186
+ await expect.soft(createApplicationPage.AcceptSignature_Button).toBeVisible();
1187
+ await expect.soft(createApplicationPage.Clear_Button).toBeVisible();
1188
+ await expect.soft(createApplicationPage.AgreeAndConsent_Button).toBeVisible();
1189
+ } else {
1190
+ await expect.soft(createApplicationPage.ConsentFormAlreadySubmitted_Block).toBeVisible();
1191
+ await expect.soft(createApplicationPage.SubmitApplication_Button).toBeVisible();
1192
+ }
1193
+ });
1194
+
1195
+ test('Verify the user clears and signs the consent form @auth', async ({ page }) => {
1196
+ test.setTimeout(0);
1197
+ // Screen 1 — Application Language
1198
+ await createApplicationPage.selectRandomPreferredLanguage();
1199
+ await createApplicationPage.clickNextButton();
1200
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
1201
+ // Screen 2 — Application Details
1202
+ await createApplicationPage.fillApplicationDetails();
1203
+ await createApplicationPage.clickNextButton();
1204
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
1205
+ // Screen 3 — Applicant Income
1206
+ const incomeStep = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 1 });
1207
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
1208
+ // Screen 4 — Household Members
1209
+ await createApplicationPage.clickNextButton();
1210
+ await webActions.waitForElementAttached(createApplicationPage.DocumentsTitle_Lbl);
1211
+ // Screen 5 — Document Upload
1212
+ await createApplicationPage.uploadDocumentsForIncomeStep(incomeStep as ApplicantIncomeScreenFillResultYes);
1213
+ await createApplicationPage.clickNextButton();
1214
+ await webActions.waitForElementAttached(createApplicationPage.EnrollmentAcknowledgement_Block);
1215
+ // Screen 6 — Enrollment Acknowledgement
1216
+ await createApplicationPage.clickEnrollmentAcknowledgementChkbox();
1217
+ await createApplicationPage.clickNextButton();
1218
+ await webActions.waitForElementAttached(createApplicationPage.PrimaryCareProvider_Block);
1219
+ // Screen 7 — Additional Information & Attestation
1220
+ await createApplicationPage.fillAdditionalInformationScreenRandomly();
1221
+ await createApplicationPage.clickNextButton();
1222
+ await webActions.waitForElementAttached(createApplicationPage.SignConsentFormTitle_Lbl);
1223
+ if(await createApplicationPage.isSignConsentFormVisible()) {
1224
+ await createApplicationPage.clickConsentInformationCheckbox();
1225
+ await createApplicationPage.signConsentFormRandomly();
1226
+ await createApplicationPage.clickClearButton();
1227
+ let isCanvasEmpty = await createApplicationPage.isSignatureCanvasEmpty();
1228
+ await expect.soft(isCanvasEmpty).toBe(true); // empty
1229
+ await createApplicationPage.signConsentFormRandomly();
1230
+ isCanvasEmpty = await createApplicationPage.isSignatureCanvasEmpty();
1231
+ await expect.soft(isCanvasEmpty).toBe(false); // not empty
1232
+ await createApplicationPage.clickAcceptSignatureButton();
1233
+ await createApplicationPage.clickAgreeAndConsentButton();
1234
+ await expect.soft(createApplicationPage.ThanksSubmitApplication_Block).toBeVisible();
1235
+ await console.log('ThanksSubmitApplication_Block: ', await createApplicationPage.ThanksSubmitApplication_Block.textContent());
1236
+ await expect.soft(createApplicationPage.SubmitApplication_Button).toBeVisible();
1237
+ await createApplicationPage.clickSubmitApplicationButton();
1238
+ await console.log('ThanksSubmitApplication_Block: ', await createApplicationPage.ThanksSubmitApplication_Block.textContent());
1239
+ } else {
1240
+ test.skip(true, 'Consent form already submitted');
1241
+ }
1242
+ });
1243
+ });
1244
+
1245
+ test.describe('Screen 9 — Social Services Assessment', () => {
1246
+ test('Verify the application details are filled correctly in screen - 1, 2, 3, 4, 5, 6 & 7 - the user moves to the next screen - 8 - Social Services Assessment @auth', async ({ page }) => {
1247
+ test.setTimeout(0);
1248
+ // Screen 1 — Application Language
1249
+ await createApplicationPage.selectRandomPreferredLanguage();
1250
+ await createApplicationPage.clickNextButton();
1251
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
1252
+ // Screen 2 — Application Details
1253
+ await createApplicationPage.fillApplicationDetails();
1254
+ await createApplicationPage.clickNextButton();
1255
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
1256
+ // Screen 3 — Applicant Income
1257
+ const incomeStep = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 1 });
1258
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
1259
+ // Screen 4 — Household Members
1260
+ await createApplicationPage.clickNextButton();
1261
+ await webActions.waitForElementAttached(createApplicationPage.DocumentsTitle_Lbl);
1262
+ // Screen 5 — Document Upload
1263
+ await createApplicationPage.uploadDocumentsForIncomeStep(incomeStep as ApplicantIncomeScreenFillResultYes);
1264
+ await createApplicationPage.clickNextButton();
1265
+ await webActions.waitForElementAttached(createApplicationPage.EnrollmentAcknowledgement_Block);
1266
+ // Screen 6 — Enrollment Acknowledgement
1267
+ await createApplicationPage.clickEnrollmentAcknowledgementChkbox();
1268
+ await createApplicationPage.clickNextButton();
1269
+ await webActions.waitForElementAttached(createApplicationPage.PrimaryCareProvider_Block);
1270
+ // Screen 7 — Additional Information & Attestation
1271
+ await createApplicationPage.fillAdditionalInformationScreenRandomly();
1272
+ await createApplicationPage.clickNextButton();
1273
+ await webActions.waitForElementAttached(createApplicationPage.SignConsentFormTitle_Lbl);
1274
+ // Screen 8 — Sign Consent Form
1275
+ await createApplicationPage.fillConsentForm();
1276
+ if (await createApplicationPage.ClickNextToSocialServicesAssesment_Lbl.isVisible().catch(() => false)) {
1277
+ await createApplicationPage.clickNextButton();
1278
+ }
1279
+ await webActions.waitForElementAttached(createApplicationPage.ClientNeedsAssessment_Block);
1280
+ await expect.soft(createApplicationPage.ClientNeedsAssessment_Block).toBeVisible();
1281
+ });
1282
+
1283
+ test('Verify the elements are visible on the Social Services Assessment screen @auth', async ({ page }) => {
1284
+ test.setTimeout(0);
1285
+ // Screen 1 — Application Language
1286
+ await createApplicationPage.selectRandomPreferredLanguage();
1287
+ await createApplicationPage.clickNextButton();
1288
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
1289
+ // Screen 2 — Application Details
1290
+ await createApplicationPage.fillApplicationDetails();
1291
+ await createApplicationPage.clickNextButton();
1292
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
1293
+ // Screen 3 — Applicant Income
1294
+ const incomeStep = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 1 });
1295
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
1296
+ // Screen 4 — Household Members
1297
+ await createApplicationPage.clickNextButton();
1298
+ await webActions.waitForElementAttached(createApplicationPage.DocumentsTitle_Lbl);
1299
+ // Screen 5 — Document Upload
1300
+ await createApplicationPage.uploadDocumentsForIncomeStep(incomeStep as ApplicantIncomeScreenFillResultYes);
1301
+ await createApplicationPage.clickNextButton();
1302
+ await webActions.waitForElementAttached(createApplicationPage.EnrollmentAcknowledgement_Block);
1303
+ // Screen 6 — Enrollment Acknowledgement
1304
+ await createApplicationPage.clickEnrollmentAcknowledgementChkbox();
1305
+ await createApplicationPage.clickNextButton();
1306
+ await webActions.waitForElementAttached(createApplicationPage.PrimaryCareProvider_Block);
1307
+ // Screen 7 — Additional Information & Attestation
1308
+ await createApplicationPage.fillAdditionalInformationScreenRandomly();
1309
+ await createApplicationPage.clickNextButton();
1310
+ await webActions.waitForElementAttached(createApplicationPage.SignConsentFormTitle_Lbl);
1311
+ // Screen 8 — Sign Consent Form
1312
+ await createApplicationPage.fillConsentForm();
1313
+ if (await createApplicationPage.ClickNextToSocialServicesAssesment_Lbl.isVisible().catch(() => false)) {
1314
+ await createApplicationPage.clickNextButton();
1315
+ }
1316
+ await webActions.waitForElementAttached(createApplicationPage.ClientNeedsAssessment_Block);
1317
+ await expect.soft(createApplicationPage.IChoose_RadioButton).toBeVisible();
1318
+ await expect.soft(createApplicationPage.IDecline_RadioButton).toBeVisible();
1319
+ await createApplicationPage.clickIChooseRadioButton();
1320
+ await expect.soft(createApplicationPage.Housing_Block).toBeVisible();
1321
+ await expect.soft(createApplicationPage.HousingQuestion_dd).toBeVisible();
1322
+ await expect.soft(createApplicationPage.Environment_Block).toBeVisible();
1323
+ await expect.soft(createApplicationPage.EnvironmentQuestion_dd).toBeVisible();
1324
+ await expect.soft(createApplicationPage.SubstanceAbuse_Block).toBeVisible();
1325
+ await expect.soft(createApplicationPage.SubstanceAbuseQuestion_dd).toBeVisible();
1326
+ await expect.soft(createApplicationPage.MentalHealth_Block).toBeVisible();
1327
+ await expect.soft(createApplicationPage.MentalHealthQuestion_dd).toBeVisible();
1328
+ await expect.soft(createApplicationPage.Disability_Block).toBeVisible();
1329
+ await expect.soft(createApplicationPage.DisabilityQuestion1_dd).toBeVisible();
1330
+ await expect.soft(createApplicationPage.DisabilityQuestion2_dd).toBeVisible();
1331
+ await createApplicationPage.clickIDeclineRadioButton();
1332
+ await expect.soft(createApplicationPage.Housing_Block).not.toBeVisible();
1333
+ await expect.soft(createApplicationPage.Environment_Block).not.toBeVisible();
1334
+ await expect.soft(createApplicationPage.SubstanceAbuse_Block).not.toBeVisible();
1335
+ await expect.soft(createApplicationPage.MentalHealth_Block).not.toBeVisible();
1336
+ await expect.soft(createApplicationPage.Disability_Block).not.toBeVisible();
1337
+ });
1338
+
1339
+ test('Verify the dropdown values are populated with the correct values on the Social Services Assessment screen @auth', async ({ page }) => {
1340
+ test.setTimeout(0);
1341
+ // Screen 1 — Application Language
1342
+ await createApplicationPage.selectRandomPreferredLanguage();
1343
+ await createApplicationPage.clickNextButton();
1344
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
1345
+ // Screen 2 — Application Details
1346
+ await createApplicationPage.fillApplicationDetails();
1347
+ await createApplicationPage.clickNextButton();
1348
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
1349
+ // Screen 3 — Applicant Income
1350
+ const incomeStep = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 1 });
1351
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
1352
+ // Screen 4 — Household Members
1353
+ await createApplicationPage.clickNextButton();
1354
+ await webActions.waitForElementAttached(createApplicationPage.DocumentsTitle_Lbl);
1355
+ // Screen 5 — Document Upload
1356
+ await createApplicationPage.uploadDocumentsForIncomeStep(incomeStep as ApplicantIncomeScreenFillResultYes);
1357
+ await createApplicationPage.clickNextButton();
1358
+ await webActions.waitForElementAttached(createApplicationPage.EnrollmentAcknowledgement_Block);
1359
+ // Screen 6 — Enrollment Acknowledgement
1360
+ await createApplicationPage.clickEnrollmentAcknowledgementChkbox();
1361
+ await createApplicationPage.clickNextButton();
1362
+ await webActions.waitForElementAttached(createApplicationPage.PrimaryCareProvider_Block);
1363
+ // Screen 7 — Additional Information & Attestation
1364
+ await createApplicationPage.fillAdditionalInformationScreenRandomly();
1365
+ await createApplicationPage.clickNextButton();
1366
+ await webActions.waitForElementAttached(createApplicationPage.SignConsentFormTitle_Lbl);
1367
+ // Screen 8 — Sign Consent Form
1368
+ await createApplicationPage.fillConsentForm();
1369
+ if (await createApplicationPage.ClickNextToSocialServicesAssesment_Lbl.isVisible().catch(() => false)) {
1370
+ await createApplicationPage.clickNextButton();
1371
+ }
1372
+ await webActions.waitForElementAttached(createApplicationPage.ClientNeedsAssessment_Block);
1373
+ await createApplicationPage.clickIChooseRadioButton();
1374
+ /** Open order matches Social Services Assessment layout (not JSON key order). */
1375
+ const dropdownFieldOrder = [
1376
+ 'HousingQuestion',
1377
+ 'EnvironmentQuestion',
1378
+ 'SubstanceAbuseQuestion',
1379
+ 'MentalHealthQuestion',
1380
+ 'DisabilityQuestion1',
1381
+ 'DisabilityQuestion2',
1382
+ ] as const satisfies readonly (keyof typeof createApplicationFormData.dropdowns)[];
1383
+
1384
+ const dropdownByField: Record<(typeof dropdownFieldOrder)[number], Locator> = {
1385
+ HousingQuestion: createApplicationPage.HousingQuestion_dd,
1386
+ EnvironmentQuestion: createApplicationPage.EnvironmentQuestion_dd,
1387
+ SubstanceAbuseQuestion: createApplicationPage.SubstanceAbuseQuestion_dd,
1388
+ MentalHealthQuestion: createApplicationPage.MentalHealthQuestion_dd,
1389
+ DisabilityQuestion1: createApplicationPage.DisabilityQuestion1_dd,
1390
+ DisabilityQuestion2: createApplicationPage.DisabilityQuestion2_dd,
1391
+ };
1392
+
1393
+ for (const field of dropdownFieldOrder) {
1394
+
1395
+ const expectedOptions = createApplicationFormData.dropdowns[field];
1396
+ const dropdown = dropdownByField[field];
1397
+ await expect(dropdown).toBeVisible();
1398
+ const actualOptions = await createApplicationPage.getDropdownOptions(dropdown, 8);
1399
+
1400
+ for (const expected of expectedOptions) {
1401
+ expect.soft(actualOptions, `Dropdown "${String(field)}" should list "${expected}"`).toContain(expected);
1402
+ }
1403
+ await createApplicationPage.closeDropdown(dropdown);
1404
+ }
1405
+ });
1406
+
1407
+ test('Verify the user is able to submit the application and get a success message @auth', async ({ page }) => {
1408
+ test.setTimeout(0);
1409
+ // Screen 1 — Application Language
1410
+ await createApplicationPage.selectRandomPreferredLanguage();
1411
+ await createApplicationPage.clickNextButton();
1412
+ await webActions.waitForElementAttached(createApplicationPage.ApplicationDetailsTitle_Lbl);
1413
+ // Screen 2 — Application Details
1414
+ await createApplicationPage.fillApplicationDetails();
1415
+ await createApplicationPage.clickNextButton();
1416
+ await webActions.waitForElementAttached(createApplicationPage.ApplicantIncomeTitle_Lbl);
1417
+ // Screen 3 — Applicant Income
1418
+ const incomeStep = await createApplicationPage.fillApplicantIncomeScreenRandomly({ receivedIncome: 'Yes', incomeSourceCount: 1 });
1419
+ await webActions.waitForElementAttached(createApplicationPage.HouseholdMembersIncomeTitle_Lbl);
1420
+ // Screen 4 — Household Members
1421
+ await createApplicationPage.clickNextButton();
1422
+ await webActions.waitForElementAttached(createApplicationPage.DocumentsTitle_Lbl);
1423
+ // Screen 5 — Document Upload
1424
+ await createApplicationPage.uploadDocumentsForIncomeStep(incomeStep as ApplicantIncomeScreenFillResultYes);
1425
+ await createApplicationPage.clickNextButton();
1426
+ await webActions.waitForElementAttached(createApplicationPage.EnrollmentAcknowledgement_Block);
1427
+ // Screen 6 — Enrollment Acknowledgement
1428
+ await createApplicationPage.clickEnrollmentAcknowledgementChkbox();
1429
+ await createApplicationPage.clickNextButton();
1430
+ await webActions.waitForElementAttached(createApplicationPage.PrimaryCareProvider_Block);
1431
+ // Screen 7 — Additional Information & Attestation
1432
+ await createApplicationPage.fillAdditionalInformationScreenRandomly();
1433
+ await createApplicationPage.clickNextButton();
1434
+ await webActions.waitForElementAttached(createApplicationPage.SignConsentFormTitle_Lbl);
1435
+ // Screen 8 — Sign Consent Form
1436
+ await createApplicationPage.fillConsentForm();
1437
+ if (await createApplicationPage.ClickNextToSocialServicesAssesment_Lbl.isVisible().catch(() => false)) {
1438
+ await createApplicationPage.clickNextButton();
1439
+ }
1440
+ await webActions.waitForElementAttached(createApplicationPage.ClientNeedsAssessment_Block);
1441
+ await createApplicationPage.clickIDeclineRadioButton();
1442
+ await createApplicationPage.clickSubmitAssesmentButton();
1443
+ await expect.soft(createApplicationPage.ThankYouMessage_Lbl).toBeVisible();
1444
+ await console.log('ThankYouMessage_Lbl: ', await createApplicationPage.ThankYouMessage_Lbl.textContent());
1445
+ await expect.soft(await createApplicationPage.ThankYouMessage_Lbl.textContent()).toBe(createApplicationFormData.thankYouMessage);
1446
+ await createApplicationPage.clickNextButton();
1447
+ await webActions.waitForElementAttached(applicantPage.ApplicationDetailsTab);
1448
+ await expect.soft(applicantPage.ApplicationDetailsTab).toBeVisible();
1449
+ });
1450
+ });
1451
+
1452
+ });