@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,117 @@
1
+ // spec: specs/Applicant Resources Page Test Plan.md
2
+ // seed: seed.spec.ts
3
+
4
+ import { test, expect } from '@playwright/test';
5
+ import { ApplicantPage } from '@pages/ApplicantPage';
6
+ import { WebActions } from '@lib/WebActions';
7
+ import { expectApplicantAuthenticatedHeaderFooterVisible } from '@lib/ApplicantPortalAssertions';
8
+
9
+
10
+ test.describe('Applicant Resources Page Tests', () => {
11
+ let applicantPage: ApplicantPage;
12
+ let webActions: WebActions;
13
+ test.beforeEach(async ({ page }) => {
14
+ applicantPage = new ApplicantPage(page);
15
+ webActions = new WebActions(page, page.context());
16
+ await applicantPage.gotoURL('/polkphpapplicant/s/?language=en_US');
17
+ await webActions.waitForElementAttached(applicantPage.Logout_Btn);
18
+
19
+ //Click on the Resources link in the header
20
+ await applicantPage.clickResourcesLink();
21
+ await webActions.waitForElementAttached(applicantPage.ResourcesTitle_Text);
22
+ });
23
+
24
+ test('Verify the header & footer sections are visible on the resources page @auth', async ({ page }) => {
25
+ //Verify the resources page elements are visible
26
+ await expectApplicantAuthenticatedHeaderFooterVisible(applicantPage);
27
+ //Verify the resources page elements are visible
28
+ await expect.soft(applicantPage.ResourcesTitle_Text).toBeVisible();
29
+ });
30
+
31
+ test('Verify the resources page elements are visible @auth', async ({ page }) => {
32
+ //Verify the resources page elements are visible
33
+ await webActions.waitForElementAttached(applicantPage.PolkHealthCarePlanMemberHandbook_Lnk);
34
+ await expect.soft(applicantPage.PolkHealthCarePlanMemberHandbook_Lnk).toBeVisible();
35
+ await expect.soft(applicantPage.UniversalHouseholdAuthorizationForm_Lnk).toBeVisible();
36
+ await expect.soft(applicantPage.UniversalSharedDataInformationSystem_Lnk).toBeVisible();
37
+ await expect.soft(applicantPage.EligibilityIncomeVerificationStatement_Lnk).toBeVisible();
38
+ await expect.soft(applicantPage.ThirdPartySupport_Lnk).toBeVisible();
39
+ });
40
+
41
+ test('Verify the links open successfully in a new tab @auth', async ({ page }) => {
42
+ //Click on the Polk HealthCare Plan Member Handbook link
43
+ let href = await applicantPage.PolkHealthCarePlanMemberHandbook_Lnk.getAttribute('href');
44
+ console.log(`Href: ${href}`);
45
+ const [newPage1] = await Promise.all([
46
+ page.context().waitForEvent('page'), // wait for new tab
47
+ applicantPage.PolkHealthCarePlanMemberHandbook_Lnk.click() // action that opens it
48
+ ]);
49
+ await newPage1.waitForLoadState("domcontentloaded");
50
+ if (!href) throw new Error('Missing href');
51
+ let response = await page.request.get(href);
52
+ expect.soft(response.status()).toBe(200);
53
+ expect.soft(response.headers()['content-type']).toContain('application/pdf');
54
+ expect.soft(newPage1.url()).toContain(href);
55
+ await newPage1.close();
56
+
57
+ //Click on the Universal Household Authorization Form link
58
+ href = await applicantPage.UniversalHouseholdAuthorizationForm_Lnk.getAttribute('href');
59
+ console.log(`Href: ${href}`);
60
+ const [newPage2] = await Promise.all([
61
+ page.context().waitForEvent('page'), // wait for new tab
62
+ applicantPage.UniversalHouseholdAuthorizationForm_Lnk.click() // action that opens it
63
+ ]);
64
+ await newPage2.waitForLoadState("domcontentloaded");
65
+ if (!href) throw new Error('Missing href');
66
+ response = await page.request.get(href);
67
+ expect.soft(response.status()).toBe(200);
68
+ expect.soft(response.headers()['content-type']).toContain('application/pdf');
69
+ expect.soft(newPage2.url()).toContain(href);
70
+ await newPage2.close();
71
+
72
+ //Click on the Universal Shared Data Information System link
73
+ href = await applicantPage.UniversalSharedDataInformationSystem_Lnk.getAttribute('href');
74
+ console.log(`Href: ${href}`);
75
+ const [newPage3] = await Promise.all([
76
+ page.context().waitForEvent('page'), // wait for new tab
77
+ applicantPage.UniversalSharedDataInformationSystem_Lnk.click() // action that opens it
78
+ ]);
79
+ await newPage3.waitForLoadState("domcontentloaded");
80
+ if (!href) throw new Error('Missing href');
81
+ response = await page.request.get(href);
82
+ expect.soft(response.status()).toBe(200);
83
+ expect.soft(response.headers()['content-type']).toContain('application/pdf');
84
+ expect.soft(newPage3.url()).toContain(href);
85
+ await newPage3.close();
86
+
87
+ //Click on the Eligibility Income Verification Statement link
88
+ href = await applicantPage.EligibilityIncomeVerificationStatement_Lnk.getAttribute('href');
89
+ console.log(`Href: ${href}`);
90
+ const [newPage4] = await Promise.all([
91
+ page.context().waitForEvent('page'), // wait for new tab
92
+ applicantPage.EligibilityIncomeVerificationStatement_Lnk.click() // action that opens it
93
+ ]);
94
+ await newPage4.waitForLoadState("domcontentloaded");
95
+ if (!href) throw new Error('Missing href');
96
+ response = await page.request.get(href);
97
+ expect.soft(response.status()).toBe(200);
98
+ expect.soft(response.headers()['content-type']).toContain('application/pdf');
99
+ expect.soft(newPage4.url()).toContain(href);
100
+ await newPage4.close();
101
+
102
+ //Click on the Third Party Support link
103
+ href = await applicantPage.ThirdPartySupport_Lnk.getAttribute('href');
104
+ console.log(`Href: ${href}`);
105
+ const [newPage5] = await Promise.all([
106
+ page.context().waitForEvent('page'), // wait for new tab
107
+ applicantPage.ThirdPartySupport_Lnk.click() // action that opens it
108
+ ]);
109
+ await newPage5.waitForLoadState("domcontentloaded");
110
+ if (!href) throw new Error('Missing href');
111
+ response = await page.request.get(href);
112
+ expect.soft(response.status()).toBe(200);
113
+ expect.soft(response.headers()['content-type']).toContain('application/pdf');
114
+ expect.soft(newPage5.url()).toContain(href);
115
+ await newPage5.close();
116
+ });
117
+ });
@@ -0,0 +1,254 @@
1
+ // spec: specs/Applicant Self Register Page Test Plan.md
2
+ // seed: seed.spec.ts
3
+
4
+ import { test, expect } from '@playwright/test';
5
+ import { ApplicantPage } from '@pages/ApplicantPage';
6
+ import { WebActions } from '@lib/WebActions';
7
+ import selfRegisterTextData from '../test-data/selfRegister/textMessages.json';
8
+ import suffixData from '../test-data/selfRegister/suffix.json';
9
+ import mailingAddressStatesData from '../test-data/selfRegister/mailingAddressStates.json';
10
+ import registrationFieldData from '../test-data/selfRegister/registrationFieldData.json';
11
+
12
+ test.describe('Applicant Self Register Page Tests', () => {
13
+ let applicantPage: ApplicantPage;
14
+ let webActions: WebActions;
15
+ test.beforeEach(async ({ page }) => {
16
+ applicantPage = new ApplicantPage(page);
17
+ webActions = new WebActions(page, page.context());
18
+ await applicantPage.gotoURL('/polkphpapplicant/s/?language=en_US');
19
+ await applicantPage.clickLoginButton();
20
+ await applicantPage.clickSignUpLink();
21
+ await webActions.waitForElementAttached(applicantPage.PhysicalAddress_AddressField);
22
+ });
23
+
24
+ test('1. Verify all the elements of the self register page are visible @no-auth', async ({ page }) => {
25
+ //Verify the self register page elements are visible
26
+ await expect.soft(applicantPage.SelfRegisterFormTitle_Text).toBeVisible();
27
+ await expect.soft(applicantPage.FirstNameField_Lbl).toBeVisible();
28
+ await expect.soft(applicantPage.FirstNameField_Input).toBeVisible();
29
+ await expect.soft(applicantPage.MiddleNameField_Lbl).toBeVisible();
30
+ await expect.soft(applicantPage.MiddleNameField_Input).toBeVisible();
31
+ await expect.soft(applicantPage.LastNameField_Lbl).toBeVisible();
32
+ await expect.soft(applicantPage.LastNameField_Input).toBeVisible();
33
+ await expect.soft(applicantPage.SuffixField_Lbl).toBeVisible();
34
+
35
+ await expect.soft(applicantPage.SuffixField_dd).toBeVisible();
36
+ await applicantPage.clickSuffixField();
37
+ await expect.soft(applicantPage.SuffixField_ddl).toBeVisible();
38
+ await expect.soft(applicantPage.DOBField_Lbl).toBeVisible();
39
+ await expect.soft(applicantPage.DOBField_Input).toBeVisible();
40
+ await applicantPage.clickDOBField();
41
+ await expect.soft(applicantPage.DOBField_DatePicker).toBeVisible();
42
+ await expect.soft(applicantPage.EmailField_Lbl).toBeVisible();
43
+ await expect.soft(applicantPage.EmailField_Input).toBeVisible();
44
+
45
+ await expect.soft(applicantPage.PhysicalAddress_Section).toBeVisible();
46
+ await expect.soft(applicantPage.PhysicalAddress_Title).toBeVisible();
47
+ await expect.soft(applicantPage.PhysicalAddress_AddressField).toBeVisible();
48
+ await expect.soft(applicantPage.PhysicalAddress_CountryField_Lbl).toBeVisible();
49
+ await expect.soft(applicantPage.PhysicalAddress_CountryField_dd).toBeVisible();
50
+ await applicantPage.clickPhysicalAddressCountryField();
51
+ await expect.soft(applicantPage.PhysicalAddress_CountryField_ddl).toBeVisible();
52
+ await expect.soft(applicantPage.PhysicalAddress_StreetField_Lbl).toBeVisible();
53
+ await expect.soft(applicantPage.PhysicalAddress_StreetField_Input).toBeVisible();
54
+ await expect.soft(applicantPage.PhysicalAddress_CityField_Lbl).toBeVisible();
55
+ await expect.soft(applicantPage.PhysicalAddress_CityField_Input).toBeVisible();
56
+ await expect.soft(applicantPage.PhysicalAddress_StateField_Lbl).toBeVisible();
57
+ await expect.soft(applicantPage.PhysicalAddress_StateField_dd).toBeVisible();
58
+ await applicantPage.clickPhysicalAddressStateField();
59
+ await expect.soft(applicantPage.PhysicalAddress_StateField_ddl).toBeVisible();
60
+ await expect.soft(applicantPage.PhysicalAddress_Zip_Lbl).toBeVisible();
61
+ await expect.soft(applicantPage.PhysicalAddress_Zip_Input).toBeVisible();
62
+
63
+ await expect.soft(applicantPage.MailingAddress_Section).toBeVisible();
64
+ await expect.soft(applicantPage.MailingAddress_Title).toBeVisible();
65
+ await expect.soft(applicantPage.MailingAddress_SameAsPhysical_Toggle).toBeVisible();
66
+ await expect.soft(applicantPage.MailingAddress_AddressField).toBeVisible();
67
+ await expect.soft(applicantPage.MailingAddress_CountryField_Lbl).toBeVisible();
68
+ await expect.soft(applicantPage.MailingAddress_CountryField_dd).toBeVisible();
69
+ await applicantPage.clickMailingAddressCountryField();
70
+ await expect.soft(applicantPage.MailingAddress_CountryField_ddl).toBeVisible();
71
+ await expect.soft(applicantPage.MailingAddress_StreetField_Lbl).toBeVisible();
72
+ await expect.soft(applicantPage.MailingAddress_StreetField_Input).toBeVisible();
73
+ await expect.soft(applicantPage.MailingAddress_CityField_Lbl).toBeVisible();
74
+ await expect.soft(applicantPage.MailingAddress_CityField_Input).toBeVisible();
75
+ await expect.soft(applicantPage.MailingAddress_StateField_Lbl).toBeVisible();
76
+ await expect.soft(applicantPage.MailingAddress_StateField_dd).toBeVisible();
77
+ await applicantPage.clickMailingAddressStateField();
78
+ await expect.soft(applicantPage.MailingAddress_StateField_ddl).toBeVisible();
79
+ await expect.soft(applicantPage.MailingAddress_Zip_Lbl).toBeVisible();
80
+ await expect.soft(applicantPage.MailingAddress_Zip_Input).toBeVisible();
81
+ });
82
+
83
+ test('2.Verify agreement / informational copy is present @no-auth', async ({ page }) => {
84
+ await expect.soft(applicantPage.Agreement_Text).toBeVisible();
85
+ expect.soft(await applicantPage.Agreement_Text.textContent()).toContain(selfRegisterTextData.agreementText);
86
+ });
87
+
88
+ test('3.Verify required-field validation on submit @no-auth', async ({ page }) => {
89
+ //Scroll to the register button and click it
90
+ await applicantPage.Register_Btn.scrollIntoViewIfNeeded();
91
+ await applicantPage.clickRegisterButton();
92
+ //Scroll to the top of the page to see the error messages
93
+ await applicantPage.SelfRegisterFormTitle_Text.scrollIntoViewIfNeeded();
94
+ //Verify the first name field has the error class & error message is displayed
95
+ await expect.soft(applicantPage.FirstNameField_Lbl).toContainClass('slds-has-error');
96
+ expect.soft(await applicantPage.FirstNameField_Lbl.textContent()).toContain(selfRegisterTextData.requiredFieldError);
97
+ //Verify the last name field has the error class & error message is displayed
98
+ await expect.soft(applicantPage.LastNameField_Lbl).toContainClass('slds-has-error');
99
+ expect.soft(await applicantPage.LastNameField_Lbl.textContent()).toContain(selfRegisterTextData.requiredFieldError);
100
+ //Verify the email field has the error class & error message is displayed
101
+ await expect.soft(applicantPage.EmailField_Lbl).toContainClass('slds-has-error');
102
+ expect.soft(await applicantPage.EmailField_Lbl.textContent()).toContain(selfRegisterTextData.requiredFieldError);
103
+ await applicantPage.FirstNameField_Input.fill(registrationFieldData.firstName);
104
+ await applicantPage.LastNameField_Input.fill(registrationFieldData.lastName);
105
+ await applicantPage.EmailField_Input.fill(registrationFieldData.validEmail);
106
+ await applicantPage.clickRegisterButton();
107
+ await expect.soft(applicantPage.PhysicalAddress_FieldError_Text).toBeVisible();
108
+ expect.soft(await applicantPage.PhysicalAddress_FieldError_Text.textContent()).toContain(selfRegisterTextData.physicalAddressFieldError);
109
+ await expect.soft(applicantPage.MailingAddress_FieldError_Text).toBeVisible();
110
+ expect.soft(await applicantPage.MailingAddress_FieldError_Text.textContent()).toContain(selfRegisterTextData.mailingAddressFieldError);
111
+ });
112
+
113
+ test('4. Verify invalid email format @no-auth', async ({ page }) => {
114
+ await applicantPage.fillMandatoryFields(registrationFieldData.firstName, registrationFieldData.lastName, registrationFieldData.errorEmail, registrationFieldData.physicalAddress, registrationFieldData.mailingAddress);
115
+ await applicantPage.clickRegisterButton();
116
+ await applicantPage.EmailField_Lbl.scrollIntoViewIfNeeded();
117
+ await expect.soft(applicantPage.EmailField_Lbl).toContainClass('slds-has-error');
118
+ expect.soft(await applicantPage.EmailField_Lbl.textContent()).toContain(selfRegisterTextData.invalidEmailError);
119
+ });
120
+
121
+ test('5.Verify date of birth constraints @no-auth', async ({ page }) => {
122
+ //Use current date and a random number to generate a unique name and email
123
+ const currentDate = await applicantPage.getCurrentDate();
124
+ const number = await applicantPage.generateRandomNumber();
125
+
126
+ await applicantPage.fillMandatoryFields(registrationFieldData.firstName + currentDate + number, registrationFieldData.lastName + currentDate + number, registrationFieldData.validEmail + currentDate + number + '@gmail.com', registrationFieldData.physicalAddress, registrationFieldData.mailingAddress);
127
+ await applicantPage.clickDOBField();
128
+ //Get the tomorrow's date in the format of MMM DD, YYYY
129
+ const tomorrowDate = await applicantPage.getTomorrowDateWithFormat();
130
+ await applicantPage.DOBField_Input.fill(tomorrowDate);
131
+ await applicantPage.clickRegisterButton();
132
+ expect.soft(page.url()).not.toContain('successpage');
133
+ });
134
+
135
+ test('6. Verify Physical Address should only be in State of Florida @no-auth', async ({ page }) => {
136
+ await applicantPage.fillMandatoryFields(registrationFieldData.firstName, registrationFieldData.lastName, registrationFieldData.validEmail, registrationFieldData.errorStateAddress,'');
137
+ await expect.soft(applicantPage.PhysicalAddress_FieldError_Text).toBeVisible();
138
+ expect.soft(await applicantPage.PhysicalAddress_FieldError_Text.textContent()).toContain(selfRegisterTextData.physicalAddressStateError);
139
+ });
140
+
141
+ test('7a. Verify Mailing Address should only be in Mailing must be in Florida @no-auth', async ({ page }) => {
142
+ //Error Message for Mailing Address should only be in Florida, US.
143
+ await applicantPage.fillMandatoryFields(registrationFieldData.firstName, registrationFieldData.lastName, registrationFieldData.validEmail, '', registrationFieldData.errorStateAddress);
144
+ await expect.soft(applicantPage.MailingAddress_FieldError_Text).toBeVisible();
145
+ expect.soft(await applicantPage.MailingAddress_FieldError_Text.textContent()).toContain(selfRegisterTextData.mailingAddressStateError);
146
+ });
147
+
148
+ test('7b. Verify Mailing Address should only be ZIP must be in the approved Polk list @no-auth', async ({ page }) => {
149
+ //Error Message for Mailing Address should only be in Approved Zip Codes of Business Rules
150
+ await applicantPage.fillMandatoryFields(registrationFieldData.firstName, registrationFieldData.lastName, registrationFieldData.validEmail, registrationFieldData.physicalAddress, registrationFieldData.errorZIPAddress);
151
+ await expect.soft(applicantPage.MailingAddress_FieldError_Text).toBeVisible();
152
+ expect.soft(await applicantPage.MailingAddress_FieldError_Text.textContent()).toContain(selfRegisterTextData.mailingAddressZIPError);
153
+ });
154
+
155
+ test('8. Verify **Same as Physical** toggle on Mailing Address @no-auth', async ({ page }) => {
156
+
157
+ await applicantPage.fillMandatoryFields(registrationFieldData.firstName, registrationFieldData.lastName, registrationFieldData.validEmail, registrationFieldData.physicalAddress, '');
158
+ await applicantPage.clickSameAsPhysicalToggle();
159
+ //To Check if the toggle is checked
160
+ await expect.soft(applicantPage.MailingAddress_SameAsPhysical_Toggle).toHaveAttribute('checked');
161
+ //To check if the physical address are filled in the mailing address fields
162
+ const physicalAddress_Country = await applicantPage.PhysicalAddress_CountryField_dd.inputValue();
163
+ console.log(physicalAddress_Country);
164
+ const physicalAddress_Street = await applicantPage.PhysicalAddress_StreetField_Input.inputValue();
165
+ console.log(physicalAddress_Street);
166
+ const physicalAddress_City = await applicantPage.PhysicalAddress_CityField_Input.inputValue();
167
+ console.log(physicalAddress_City);
168
+ const physicalAddress_State = await applicantPage.PhysicalAddress_StateField_dd.inputValue();
169
+ console.log(physicalAddress_State);
170
+ const physicalAddress_Zip = await applicantPage.PhysicalAddress_Zip_Input.inputValue();
171
+ console.log(physicalAddress_Zip);
172
+ expect.soft(await applicantPage.MailingAddress_CountryField_dd.inputValue()).toBe(physicalAddress_Country);
173
+ expect.soft(await applicantPage.MailingAddress_StreetField_Input.inputValue()).toBe(physicalAddress_Street);
174
+ expect.soft(await applicantPage.MailingAddress_CityField_Input.inputValue()).toBe(physicalAddress_City);
175
+ expect.soft(await applicantPage.MailingAddress_StateField_dd.inputValue()).toBe(physicalAddress_State);
176
+ expect.soft(await applicantPage.MailingAddress_Zip_Input.inputValue()).toBe(physicalAddress_Zip);
177
+ //To Check if the mailing address fields are disabled
178
+ await expect.soft(applicantPage.MailingAddress_AddressField).toBeDisabled();
179
+ await expect.soft(applicantPage.MailingAddress_CountryField_dd).toBeDisabled();
180
+ await expect.soft(applicantPage.MailingAddress_StreetField_Input).toBeDisabled();
181
+ await expect.soft(applicantPage.MailingAddress_CityField_Input).toBeDisabled();
182
+ await expect.soft(applicantPage.MailingAddress_StateField_dd).toBeDisabled();
183
+ await expect.soft(applicantPage.MailingAddress_Zip_Input).toBeDisabled();
184
+ });
185
+
186
+ test('9. Verify physical vs mailing address independence when **Same as Physical** is off @no-auth', async ({ page }) => {
187
+ await applicantPage.fillMandatoryFields(registrationFieldData.firstName, registrationFieldData.lastName, registrationFieldData.validEmail, registrationFieldData.physicalAddress, registrationFieldData.mailingAddress);
188
+ await expect.soft(applicantPage.MailingAddress_SameAsPhysical_Toggle).not.toHaveAttribute('checked');
189
+ //Only the Street, City and Zip will be different in the address fields
190
+ const physicalAddress_Street = await applicantPage.PhysicalAddress_StreetField_Input.inputValue();
191
+ console.log(physicalAddress_Street);
192
+ const physicalAddress_City = await applicantPage.PhysicalAddress_CityField_Input.inputValue();
193
+ console.log(physicalAddress_City);
194
+ const physicalAddress_Zip = await applicantPage.PhysicalAddress_Zip_Input.inputValue();
195
+ console.log(physicalAddress_Zip);
196
+ const mailingAddress_Street = await applicantPage.MailingAddress_StreetField_Input.inputValue();
197
+ console.log(mailingAddress_Street);
198
+ const mailingAddress_City = await applicantPage.MailingAddress_CityField_Input.inputValue();
199
+ console.log(mailingAddress_City);
200
+ const mailingAddress_Zip = await applicantPage.MailingAddress_Zip_Input.inputValue();
201
+ console.log(mailingAddress_Zip);
202
+ //To check if the physical address is different from the mailing address
203
+ expect.soft(mailingAddress_Street).not.toBe(physicalAddress_Street);
204
+ expect.soft(mailingAddress_City).not.toBe(physicalAddress_City);
205
+ expect.soft(mailingAddress_Zip).not.toBe(physicalAddress_Zip);
206
+ });
207
+
208
+ test('10. Successful self-registration (happy path) @no-auth', async ({ page }) => {
209
+ //Use current date, a random number, and random text to generate a unique name and email
210
+ const currentDate = await applicantPage.getCurrentDate();
211
+ const number = await applicantPage.generateRandomNumber();
212
+ const randomText = await applicantPage.generateRandomText(3);
213
+
214
+ await applicantPage.fillMandatoryFields(registrationFieldData.firstName + randomText, registrationFieldData.lastName + randomText, registrationFieldData.firstName + currentDate + number + '@gmail.com', registrationFieldData.physicalAddress, registrationFieldData.mailingAddress);
215
+ await applicantPage.clickRegisterButton();
216
+ await webActions.waitForElementAttached(applicantPage.SuccessPage_Text);
217
+ await expect.soft(page.url()).toContain('successpage');
218
+ await expect.soft(applicantPage.SuccessPage_Text).toBeVisible();
219
+ expect.soft(await applicantPage.SuccessPage_Text.textContent()).toContain(selfRegisterTextData.successMessage);
220
+ });
221
+
222
+ test('11. Registering with the Same Name & Email (Duplicate Registration) @no-auth', async ({ page }) => {
223
+ //Error Message for Duplicate Registration
224
+ await applicantPage.fillMandatoryFields(registrationFieldData.firstName, registrationFieldData.lastName, registrationFieldData.validEmail, registrationFieldData.physicalAddress, registrationFieldData.mailingAddress);
225
+ await applicantPage.clickRegisterButton();
226
+ await expect.soft(applicantPage.ErrorMessage_Text).toBeVisible();
227
+ expect.soft(await applicantPage.ErrorMessage_Text.textContent()).toContain(selfRegisterTextData.duplicateRegistrationError);
228
+ });
229
+
230
+ test('12. Registering with the Long Names @no-auth', async ({ page }) => {
231
+ //Error Message for Long Names
232
+ await applicantPage.fillMandatoryFields(registrationFieldData.longFirstName, registrationFieldData.longLastName, registrationFieldData.longEmail, registrationFieldData.physicalAddress, registrationFieldData.mailingAddress);
233
+ await applicantPage.clickRegisterButton();
234
+ await expect.soft(applicantPage.ErrorMessage_Text).toBeVisible();
235
+ expect.soft(await applicantPage.ErrorMessage_Text.textContent()).toContain(selfRegisterTextData.longNamesError);
236
+ });
237
+
238
+ test('15. Validating the values present in Suffix Dropdown @no-auth', async ({ page }) => {
239
+ await applicantPage.clickSuffixField();
240
+ const options = await applicantPage.SuffixField_ddl.locator(page.getByRole('option')).allInnerTexts();
241
+ console.log(options);
242
+ const suffix = suffixData.suffixOptions;
243
+ await expect.soft(options).toEqual(suffix);
244
+ });
245
+
246
+ test('16. Validating the values present in Mailing Address - State Dropdown @no-auth', async ({ page }) => {
247
+ await applicantPage.clickMailingAddressStateField();
248
+ const options = await applicantPage.MailingAddress_StateField_ddl.locator(page.getByRole('option')).allInnerTexts();
249
+ console.log(options);
250
+ const states = mailingAddressStatesData.mailingAddressStateOptions;
251
+ await expect.soft(options).toEqual(states);
252
+ });
253
+
254
+ });
@@ -0,0 +1,42 @@
1
+ import { test as setup , expect } from '@playwright/test';
2
+ import { ApplicantPage } from '@pages/ApplicantPage';
3
+ import dotenv from 'dotenv';
4
+ import { testConfig } from 'testConfig';
5
+ import { authFile, saveAuthState } from './authState';
6
+
7
+ let applicantPage: ApplicantPage;
8
+ const ENV = process.env.ENV || process.env.npm_config_ENV || 'qa';
9
+ console.log(`Authentication file path: ${authFile}`);
10
+ dotenv.config();
11
+
12
+ setup('authenticate @auth', async ({ page }) => {
13
+ // Perform authentication steps. Replace these actions with your own.
14
+ applicantPage = new ApplicantPage(page);
15
+
16
+ if (!testConfig.login || !testConfig.password) {
17
+ throw new Error('LOGIN and PASSWORD must be set before running auth.setup.ts');
18
+ }
19
+
20
+ await applicantPage.gotoURL(`${testConfig[ENV]}/polkphpapplicant/s/loginpage?language=en_US`, {
21
+ handleConsentUpdate: false,
22
+ });
23
+ await applicantPage.UsernameField_Input.waitFor({ state: 'attached' })
24
+ await applicantPage.UsernameField_Input.fill(testConfig.login);
25
+ await applicantPage.PasswordField_Input.fill(testConfig.password);
26
+ await applicantPage.LoginSubmit_Btn.click();
27
+
28
+ await applicantPage.completeConsentFormUpdateIfRequired();
29
+
30
+ // Wait until the page receives the cookies.
31
+ //
32
+ // Sometimes login flow sets cookies in the process of several redirects.
33
+ // Wait for the final URL to ensure that the cookies are actually set.
34
+ await applicantPage.Home_Lnk.waitFor({ state: 'attached' });
35
+ // Alternatively, you can wait until the page reaches a state where all cookies are set.
36
+ await expect(applicantPage.Logout_Btn).toBeVisible();
37
+
38
+ // End of authentication steps.
39
+
40
+ await saveAuthState(page.context());
41
+ });
42
+
@@ -0,0 +1,15 @@
1
+ import type { BrowserContext } from '@playwright/test';
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+
5
+ export const authFile = path.resolve(__dirname, '../playwright/.auth/user.json');
6
+
7
+ export async function saveAuthState(context: BrowserContext): Promise<void> {
8
+ const authDir = path.dirname(authFile);
9
+ fs.mkdirSync(authDir, { recursive: true });
10
+
11
+ const state = await context.storageState();
12
+ const tempFile = path.join(authDir, `user.${process.pid}.${Date.now()}.tmp.json`);
13
+ fs.writeFileSync(tempFile, `${JSON.stringify(state, null, 2)}\n`);
14
+ fs.renameSync(tempFile, authFile);
15
+ }
@@ -0,0 +1,18 @@
1
+ import { test, expect } from '@playwright/test';
2
+
3
+ test('has title', async ({ page }) => {
4
+ await page.goto('https://playwright.dev/');
5
+
6
+ // Expect a title "to contain" a substring.
7
+ await expect(page).toHaveTitle(/Playwright/);
8
+ });
9
+
10
+ test('get started link', async ({ page }) => {
11
+ await page.goto('https://playwright.dev/');
12
+
13
+ // Click the get started link.
14
+ await page.getByRole('link', { name: 'Get started' }).click();
15
+
16
+ // Expects page to have a heading with the name of Installation.
17
+ await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible();
18
+ });
@@ -0,0 +1,7 @@
1
+ import { test, expect } from '@playwright/test';
2
+
3
+ test.describe('Test group', () => {
4
+ test('seed', async ({ page }) => {
5
+ // generate code here.
6
+ });
7
+ });