Skip to content

Commit ebaeda0

Browse files
committed
Merge branch 'external-link-icon' of https://github.com/cfpb/sbl-frontend into external-link-icon
2 parents 4626d0f + b214cc9 commit ebaeda0

File tree

15 files changed

+484
-78
lines changed

15 files changed

+484
-78
lines changed

e2e/example.spec.demo.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ test('proof of concept', async ({ page }) => {
8686
.getByLabel('Phone numberPhone number')
8787
.fill(pointOfContactJson.phone_number);
8888
await page
89-
.getByLabel('Extension (optional)Extension')
89+
.getByLabel('Phone extension (optional)')
9090
.fill(pointOfContactJson.phone_ext);
9191
await page
9292
.getByLabel('Email addressEmail address')

e2e/fixtures/testFixture.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ export const test = baseTest.extend<{
337337
.getByLabel('Phone numberPhone number')
338338
.fill(pointOfContactJson.phone_number);
339339
await page
340-
.getByLabel('Extension (optional)Extension')
340+
.getByLabel('Phone Extension (optional)')
341341
.fill(pointOfContactJson.phone_ext);
342342
await page
343343
.getByLabel('Email addressEmail address')

e2e/pages/filing-app/complete-user-profile/checkCupFormErrors.spec.ts

+40
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { expect } from '@playwright/test';
22
import { test } from '../../../fixtures/testFixture';
3+
import { DefaultInputCharLimit } from 'utils/constants';
4+
import { assertTextInput } from '../../../utils/inputValidators';
5+
import { controlUnicode } from '../../../utils/unicodeConstants';
36

47
test('Complete the User Profile: Checking for form errors based on user input', async ({
58
page,
@@ -33,3 +36,40 @@ test('Complete the User Profile: Checking for form errors based on user input',
3336
);
3437
});
3538
});
39+
40+
test('Complete the User Profile: Checking for input length restriction', async ({
41+
page,
42+
}) => {
43+
test.slow();
44+
45+
await test.step('Complete the User Profile: Check that the error header render when no input is filled', async () => {
46+
await page.getByLabel('Submit User Profile').click();
47+
await expect(page.locator('#step1FormErrorHeader div').first()).toBeVisible(
48+
{
49+
timeout: 30_000,
50+
},
51+
);
52+
});
53+
54+
await test.step('Complete the User Profile: Check the first and last names for invalid input', async () => {
55+
const expectedValues = {
56+
firstField: controlUnicode.slice(0, DefaultInputCharLimit),
57+
lastField: controlUnicode.slice(0, DefaultInputCharLimit),
58+
};
59+
const unexpectedValues = {
60+
firstField: controlUnicode,
61+
lastField: controlUnicode,
62+
};
63+
64+
await assertTextInput(page, 'First name', {
65+
fill: controlUnicode,
66+
expected: expectedValues.firstField,
67+
unexpected: unexpectedValues.firstField,
68+
});
69+
await assertTextInput(page, 'Last name', {
70+
fill: controlUnicode,
71+
expected: expectedValues.lastField,
72+
unexpected: unexpectedValues.lastField,
73+
});
74+
});
75+
});

e2e/pages/filing-app/formAlerts.spec.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { expect } from '@playwright/test';
22
import { test } from '../../fixtures/testFixture';
3+
import pointOfContactJson from '../../test-data/point-of-contact/point-of-contact-data-1.json';
34
import { ResultUploadMessage, uploadFile } from '../../utils/uploadFile';
45

56
test('Form Alerts', async ({
@@ -247,7 +248,7 @@ test('Form Alerts', async ({
247248
page.locator('.m-notification__error'),
248249
'Error alert is visible',
249250
).toContainText(
250-
'There was a problem updating your point of contact informationEnter the first name of the point of contactEnter the last name of the point of contactEnter the phone number of the point of contactEnter the email address of the point of contactEnter the street address of the point of contactEnter the city of the point of contactSelect the state or territory of the point of contactEnter the ZIP code of the point of contact',
251+
'There was a problem updating your point of contact informationEnter the first name of the point of contactEnter the last name of the point of contactEnter the phone number of the point of contactEnter a valid phone extensionEnter the email address of the point of contactEnter the street address of the point of contactEnter the city of the point of contactSelect the state or territory of the point of contactEnter the ZIP code of the point of contact',
251252
);
252253
});
253254

@@ -257,6 +258,9 @@ test('Form Alerts', async ({
257258
await page.getByLabel('First name').fill('Playwright');
258259
await page.getByLabel('Last name').fill('Test');
259260
await page.getByLabel('Phone number').fill('555-555-5555');
261+
await page
262+
.getByLabel('Phone extension (optional)')
263+
.fill(pointOfContactJson.phone_ext);
260264
await page.getByLabel('Email address').fill('[email protected]');
261265
await page.getByLabel('Street address line 1').fill('555 Main St.');
262266
await page.getByLabel('City').fill('Utah (U');

e2e/pages/filing-app/point-of-contact/checkPocFormErrors.spec.ts

+141
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
import { expect } from '@playwright/test';
22
import { test } from '../../../fixtures/testFixture';
3+
import { controlUnicode } from '../../../utils/unicodeConstants';
4+
import {
5+
assertTextInput,
6+
assertSelectInput,
7+
} from '../../../utils/inputValidators';
8+
import {
9+
DefaultInputCharLimit,
10+
PhoneInputCharLimit,
11+
EmailInputCharLimit,
12+
ZipInputCharLimit,
13+
} from 'utils/constants';
314

415
test('Point of Contact: Checking for form errors based on user input', async ({
516
page,
@@ -37,3 +48,133 @@ test('Point of Contact: Checking for form errors based on user input', async ({
3748
);
3849
});
3950
});
51+
52+
test('Point of Contact: Checking for unicode tolerance based on user input', async ({
53+
page,
54+
navigateToProvidePointOfContact,
55+
}) => {
56+
test.slow();
57+
58+
navigateToProvidePointOfContact;
59+
60+
await test.step('Point of Contact: Check that the error header render when no input is filled', async () => {
61+
await page.getByRole('button', { name: 'Continue to next step' }).click();
62+
await expect(
63+
page.locator('#PointOfContactFormErrors div').first(),
64+
).toBeVisible();
65+
});
66+
67+
await test.step('Point of Contact: Check the first and last names for invalid input', async () => {
68+
const expectedValues = {
69+
firstField: controlUnicode.slice(0, DefaultInputCharLimit),
70+
lastField: controlUnicode.slice(0, DefaultInputCharLimit),
71+
phoneField: controlUnicode.slice(0, PhoneInputCharLimit),
72+
extensionField: controlUnicode.slice(0, DefaultInputCharLimit),
73+
emailField: controlUnicode.slice(0, EmailInputCharLimit),
74+
addressField1: controlUnicode.slice(0, DefaultInputCharLimit),
75+
addressField2: controlUnicode.slice(0, DefaultInputCharLimit),
76+
addressField3: controlUnicode.slice(0, DefaultInputCharLimit),
77+
addressField4: controlUnicode.slice(0, DefaultInputCharLimit),
78+
cityField: controlUnicode.slice(0, DefaultInputCharLimit),
79+
stateField: 'TX',
80+
zipField: controlUnicode.slice(0, ZipInputCharLimit),
81+
};
82+
const unexpectedValues = {
83+
firstField: controlUnicode,
84+
lastField: controlUnicode,
85+
phoneField: controlUnicode,
86+
extensionField: controlUnicode,
87+
emailField: controlUnicode,
88+
addressField1: controlUnicode,
89+
addressField2: controlUnicode,
90+
addressField3: controlUnicode,
91+
addressField4: controlUnicode,
92+
cityField: controlUnicode,
93+
stateField: '',
94+
zipField: controlUnicode,
95+
};
96+
97+
await assertTextInput(page, 'First name', {
98+
fill: controlUnicode,
99+
expected: expectedValues.firstField,
100+
unexpected: unexpectedValues.firstField,
101+
});
102+
await assertTextInput(page, 'Last name', {
103+
fill: controlUnicode,
104+
expected: expectedValues.lastField,
105+
unexpected: unexpectedValues.lastField,
106+
});
107+
await assertTextInput(page, 'Phone number', {
108+
fill: controlUnicode,
109+
expected: expectedValues.phoneField,
110+
unexpected: unexpectedValues.phoneField,
111+
});
112+
await assertTextInput(page, 'Extension', {
113+
fill: controlUnicode,
114+
expected: expectedValues.extensionField,
115+
unexpected: unexpectedValues.extensionField,
116+
});
117+
await assertTextInput(page, 'Email address', {
118+
fill: controlUnicode,
119+
expected: expectedValues.emailField,
120+
unexpected: unexpectedValues.emailField,
121+
});
122+
await assertTextInput(page, 'Street address line 1', {
123+
fill: controlUnicode,
124+
expected: expectedValues.addressField1,
125+
unexpected: unexpectedValues.addressField1,
126+
});
127+
await assertTextInput(page, 'Street address line 2', {
128+
fill: controlUnicode,
129+
expected: expectedValues.addressField2,
130+
unexpected: unexpectedValues.addressField2,
131+
});
132+
await assertTextInput(page, 'Street address line 3', {
133+
fill: controlUnicode,
134+
expected: expectedValues.addressField3,
135+
unexpected: unexpectedValues.addressField3,
136+
});
137+
await assertTextInput(page, 'Street address line 4', {
138+
fill: controlUnicode,
139+
expected: expectedValues.addressField4,
140+
unexpected: unexpectedValues.addressField4,
141+
});
142+
await assertTextInput(page, 'City', {
143+
fill: controlUnicode,
144+
expected: expectedValues.cityField,
145+
unexpected: unexpectedValues.cityField,
146+
});
147+
await assertSelectInput(page, 'State or territory', {
148+
fill: { label: 'Texas (TX)' },
149+
expected: expectedValues.stateField,
150+
unexpected: unexpectedValues.stateField,
151+
});
152+
await assertTextInput(page, 'Zip code', {
153+
fill: controlUnicode,
154+
expected: expectedValues.zipField,
155+
unexpected: unexpectedValues.zipField,
156+
});
157+
158+
await page.getByRole('button', { name: 'Continue to next step' }).click();
159+
160+
await expect(page.locator('#PointOfContactFormErrors')).toContainText(
161+
'Enter a valid phone number',
162+
);
163+
await expect(page.locator('#PointOfContactFormErrors')).toContainText(
164+
'Enter a valid email address',
165+
);
166+
await expect(page.locator('#PointOfContactFormErrors')).toContainText(
167+
'Enter a valid ZIP code',
168+
);
169+
170+
await expect(page.locator('form')).toContainText(
171+
'You must enter a valid phone number.',
172+
);
173+
await expect(page.locator('form')).toContainText(
174+
'You must enter a valid email address.',
175+
);
176+
await expect(page.locator('form')).toContainText(
177+
'You must enter a valid ZIP code.',
178+
);
179+
});
180+
});
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { expect } from '@playwright/test';
22
import { test } from '../../fixtures/testFixture';
33
import { controlUnicode } from '../../utils/unicodeConstants';
4+
import { assertTextInput } from '../../utils/inputValidators';
5+
import { DefaultInputCharLimit, LeiInputCharLimit } from 'utils/constants';
46

57
const expectedNoAssociationsSummaryUrl =
68
/\/profile\/complete\/summary\/submitted$/;
@@ -40,62 +42,37 @@ test('Complete User Profile with Bad Unicode -- No Associations -- process', asy
4042

4143
await test.step('Fillout Complete User Profile (No Associations) with bad unicode and verify values', async () => {
4244
const expectedValues = {
43-
firstField: controlUnicode.slice(0, 255),
44-
lastField: controlUnicode.slice(0, 255),
45-
// TODO: Update with correct value after char limit in place, see:
46-
// https://github.com/cfpb/sbl-frontend/issues/972
47-
finField: controlUnicode,
48-
// TODO: Update with correct value after char limit in place, see:
49-
// https://github.com/cfpb/sbl-frontend/issues/972
50-
leiField: controlUnicode,
45+
firstField: controlUnicode.slice(0, DefaultInputCharLimit),
46+
lastField: controlUnicode.slice(0, DefaultInputCharLimit),
47+
finField: controlUnicode.slice(0, DefaultInputCharLimit),
48+
leiField: controlUnicode.slice(0, LeiInputCharLimit),
5149
};
5250
const unexpectedValues = {
5351
firstField: controlUnicode,
5452
lastField: controlUnicode,
55-
// TODO: Change to controlUnicode after char limit in place, see:
56-
// https://github.com/cfpb/sbl-frontend/issues/972
57-
finField: '',
58-
// TODO: Change to controlUnicode after char limit in place, see:
59-
// https://github.com/cfpb/sbl-frontend/issues/972
60-
leiField: '',
53+
finField: controlUnicode,
54+
leiField: controlUnicode,
6155
};
6256

63-
await page.getByLabel('First name').click();
64-
await page.getByLabel('First name').fill(controlUnicode);
65-
66-
await page.getByLabel('Last name').click();
67-
await page.getByLabel('Last name').fill(controlUnicode);
68-
69-
await page.getByLabel('Financial institution name').click();
70-
await page.getByLabel('Financial institution name').fill(controlUnicode);
71-
72-
await page.getByLabel('Legal Entity Identifier (LEI)').click();
73-
await page.getByLabel('Legal Entity Identifier (LEI)').fill(controlUnicode);
74-
75-
await expect(page.getByLabel('First name')).not.toHaveValue(
76-
unexpectedValues.firstField,
77-
);
78-
await expect(page.getByLabel('Last name')).not.toHaveValue(
79-
unexpectedValues.lastField,
80-
);
81-
await expect(page.getByLabel('Financial institution name')).not.toHaveValue(
82-
unexpectedValues.finField,
83-
);
84-
await expect(
85-
page.getByLabel('Legal Entity Identifier (LEI)'),
86-
).not.toHaveValue(unexpectedValues.leiField);
87-
88-
await expect(page.getByLabel('First name')).toHaveValue(
89-
expectedValues.firstField,
90-
);
91-
await expect(page.getByLabel('Last name')).toHaveValue(
92-
expectedValues.lastField,
93-
);
94-
await expect(page.getByLabel('Financial institution name')).toHaveValue(
95-
expectedValues.finField,
96-
);
97-
await expect(page.getByLabel('Legal Entity Identifier (LEI)')).toHaveValue(
98-
expectedValues.leiField,
99-
);
57+
await assertTextInput(page, 'First name', {
58+
fill: controlUnicode,
59+
expected: expectedValues.firstField,
60+
unexpected: unexpectedValues.firstField,
61+
});
62+
await assertTextInput(page, 'Last name', {
63+
fill: controlUnicode,
64+
expected: expectedValues.lastField,
65+
unexpected: unexpectedValues.lastField,
66+
});
67+
await assertTextInput(page, 'Financial institution name', {
68+
fill: controlUnicode,
69+
expected: expectedValues.finField,
70+
unexpected: unexpectedValues.finField,
71+
});
72+
await assertTextInput(page, 'Legal Entity Identifier (LEI)', {
73+
fill: controlUnicode,
74+
expected: expectedValues.leiField,
75+
unexpected: unexpectedValues.leiField,
76+
});
10077
});
10178
});

0 commit comments

Comments
 (0)