Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add playwright tests for missing scanrios in Form Fields #484

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/e2e/Digv2/FormFields/Email.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ test.describe('E2E test', () => {
requiredEmail.fill('[email protected]');
await expect(page.locator('p.Mui-error.Mui-required')).toBeHidden();

/** Checking 'field label', 'placeholder', and 'helper text' */
const requiredEmailFieldLabel = page.locator('text="Required Email"');
await expect(requiredEmailFieldLabel && requiredEmailFieldLabel.locator('text="*"')).toBeVisible();

const placeholderValue = await requiredEmail.getAttribute('placeholder');
await expect(placeholderValue).toBe('Email Placeholder');

await expect(page.locator('div[id="Assignment"] >> p:has-text("Email Helper Text")')).toBeVisible();

attributes = await common.getAttributes(requiredEmail);
await expect(attributes.includes('required')).toBeTruthy();

Expand Down
10 changes: 10 additions & 0 deletions tests/e2e/Digv2/FormFields/Phone.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ test.describe('E2E test', () => {

/** Required tests */
const requiredPhone = page.locator('div[data-test-id="af983eaa1b85b015a7654702abd0b249"] >> input');

/** Checking 'field label', 'placeholder', and 'helper text' */
const requiredPhoneFieldLabel = page.locator('text="Required Phone"');
await expect(requiredPhoneFieldLabel && requiredPhoneFieldLabel.locator('text="*"')).toBeVisible();

const placeholderValue = await requiredPhone.getAttribute('placeholder');
await expect(placeholderValue).toBe('Phone Placeholder');

await expect(page.locator('div[id="Assignment"] >> p:has-text("Phone Helper Text")')).toBeVisible();

attributes = await common.getAttributes(requiredPhone);
await expect(attributes.includes('required')).toBeTruthy();

Expand Down
5 changes: 5 additions & 0 deletions tests/e2e/Digv2/FormFields/Picklist.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ test.describe('E2E test', () => {
await page.getByRole('option', { name: 'Dropdown' }).click();

const dropdown = page.locator('div[data-test-id="94cb322b7468c7827d336398e525827e"]');
/** Checking 'placeholder' and 'helper text' */
const placeholderValue = await dropdown.locator('input').getAttribute('placeholder');
await expect(placeholderValue).toBe('Select...');

await expect(page.locator('div[id="Assignment"] >> p:has-text("Picklist Helper Text")')).toBeVisible();
await dropdown.click();
await page.getByRole('option', { name: 'Massachusetts' }).click();

Expand Down
Loading