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

[Snapshot testing - Part 3] Shared lending platform #1087

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2e13c5f
feat: [Playwright] Support running of snapshot tests via environment …
meissadia Dec 4, 2024
9353393
task: [Playwright] Centralize check for running/skipping snapshot tes…
meissadia Dec 4, 2024
86716bb
task: [Snapshot test] Complete user profile form
meissadia Dec 4, 2024
035db97
feat: [Playwright] Support running of snapshot tests via environment …
meissadia Dec 4, 2024
22cd9bc
task: [Playwright] Centralize check for running/skipping snapshot tes…
meissadia Dec 4, 2024
4481f39
task: [Snapshot test] Complete user profile form
meissadia Dec 4, 2024
60bf075
Merge branch 'main' into 1062-snapshot__complete-user-profile
meissadia Dec 4, 2024
5b9118c
task: Update Vite environment with new ENV variable for snapshot testing
meissadia Dec 4, 2024
5fb6a2a
task: Snapshot testing - adjust default maxDiffPixels
meissadia Dec 6, 2024
ef07a8d
task: Snapshot testing - Use a more generalized masking approach (add…
meissadia Dec 6, 2024
f861537
Merge branch 'main' into 1062-snapshot__complete-user-profile
meissadia Dec 6, 2024
2e7206b
task: [Snapshot test] Filing details
meissadia Dec 6, 2024
8e2ca8f
Merge branch 'main' into 1062-snapshot__filing-details
meissadia Dec 9, 2024
3cb6713
task: [Github] Add new environment variable - SBL_ENABLE_PLAYWRIGHT_S…
meissadia Dec 9, 2024
7ad6de8
task: [Snapshot test] Filing step routing
meissadia Dec 6, 2024
d9d0b0f
task: [Snapshot test] Filing - Sign and submit
meissadia Dec 6, 2024
268d387
task: [Snapshot test - Part 5] Filing - Upload file
meissadia Dec 9, 2024
b882c9b
task: [Snapshot test - Part 6] Filing - Form alerts
meissadia Dec 9, 2024
34722c1
task: [Snapshot test - Part 7] Filing - Unavailable APIs
meissadia Dec 9, 2024
40787ae
task: [Snapshot test - Part 8] Shared Lending Platform - User Profile
meissadia Dec 9, 2024
cf4c71f
task: [Snapshot test - Part 9] Shared Lending Platform - Institution …
meissadia Dec 9, 2024
3ec943d
Merge branch 'main' into 1062-snapshot__filing-details
meissadia Dec 10, 2024
93349a6
Merge branch 'main' into 1062-snapshot__filing-details
meissadia Dec 11, 2024
d0b600d
Merge branch '1062-snapshot__3-filing-step-routing' into 1062-snapsho…
meissadia Dec 11, 2024
828aa30
Merge branch '1062-snapshot__4-sign-and-submit' into 1062-snapshot__f…
meissadia Dec 11, 2024
f29a124
Merge branch '1062-snapshot__5-upload-file' into 1062-snapshot__filin…
meissadia Dec 11, 2024
7de93c0
Merge branch '1062-snapshot__6-formAlerts' into 1062-snapshot__filing…
meissadia Dec 11, 2024
91c436c
Merge branch '1062-snapshot__7-blocked-apis' into 1062-snapshot__fili…
meissadia Dec 11, 2024
5cff835
Merge branch '1062-snapshot__8-user-profile' into 1062-snapshot__shar…
meissadia Dec 11, 2024
45a7f7e
Merge branch '1062-snapshot__9-institution-profile' into 1062-snapsho…
meissadia Dec 11, 2024
1ce0432
task: [Snapshot test - Part 10] Shared Lending Platform - Navigation
meissadia Dec 11, 2024
eb0d081
task: [Snapshot test - Part 11] Shared Lending Platform - Non-associa…
meissadia Dec 11, 2024
da5cb75
task: [Snapshot test - Part 12] Shared Lending Platform - Unauthentic…
meissadia Dec 11, 2024
9d45947
task: [Snapshot test - Part 13] Shared Lending Platform - Update inst…
meissadia Dec 11, 2024
233074b
feat: [Snapshot testing] Script to easily update snapshots
meissadia Dec 12, 2024
4e819c1
Merge branch 'main' into 1062-snapshot__shared-lending-platform
meissadia Dec 12, 2024
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ If you'll be using VS Code, be sure to:
- `yarn test:ci` - run all unit and integration tests in CI mode
- `yarn test:e2e` - run all e2e tests with Playwright UI mode.
- `yarn test:e2e:headless` - run all e2e tests headlessly.
- `yarn test:e2e:snapshot` - run all e2e tests with snapshot testing.
- `yarn test:e2e:snapshot-update` - update all snapshots.
- `yarn test:e2e:snapshot-update <TEST_PATH>` - update snapshots for specific tests. Example: `yarn test:e2e:snapshot-update e2e/pages/shared-lending-platform/UserProfile*`
- `yarn format` - format all files with Prettier.
- `yarn lint` - runs TypeScript, ESLint and Stylelint.
- `yarn validate` - runs `lint`, `test:ci` and `test:e2e`.
Expand Down
19 changes: 12 additions & 7 deletions e2e/pages/filing-app/filing-details/checkPocFormErrors.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { expect } from '@playwright/test';
import { test } from '../../../fixtures/testFixture';
import { controlUnicode } from '../../../utils/unicodeConstants';
import {
assertTextInput,
assertSelectInput,
} from '../../../utils/inputValidators';
import {
DefaultInputCharLimit,
PhoneInputCharLimit,
EmailInputCharLimit,
PhoneInputCharLimit,
ZipInputCharLimit,
} from 'utils/constants';
import { test } from '../../../fixtures/testFixture';
import {
assertSelectInput,
assertTextInput,
} from '../../../utils/inputValidators';
import { clickContinueNext } from '../../../utils/navigation.utils';
import { checkSnapshot } from '../../../utils/snapshotTesting';
import { controlUnicode } from '../../../utils/unicodeConstants';

test('Point of Contact: Checking for form errors based on user input', async ({
page,
Expand All @@ -24,6 +25,7 @@ test('Point of Contact: Checking for form errors based on user input', async ({
await expect(
page.locator('#FilingDetailsFormErrors div').first(),
).toBeVisible();
await checkSnapshot(page);
});

await test.step('Point of Contact: Check the first and last names for invalid input', async () => {
Expand All @@ -45,6 +47,7 @@ test('Point of Contact: Checking for form errors based on user input', async ({
await expect(page.locator('#FilingDetailsFormErrors')).toContainText(
'The last name must not contain invalid characters',
);
await checkSnapshot(page);
});
});

Expand All @@ -59,6 +62,7 @@ test('Point of Contact: Checking for unicode tolerance based on user input', asy
await expect(
page.locator('#FilingDetailsFormErrors div').first(),
).toBeVisible();
await checkSnapshot(page);
});

await test.step('Point of Contact: Check the first and last names for invalid input', async () => {
Expand Down Expand Up @@ -173,5 +177,6 @@ test('Point of Contact: Checking for unicode tolerance based on user input', asy
await expect(page.locator('form')).toContainText(
'You must enter a valid ZIP code.',
);
await checkSnapshot(page);
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { test } from '../../../fixtures/testFixture';
import { checkSnapshot } from '../../../utils/snapshotTesting';
import { verifyRedirects } from './_shared';

const testLabel = 'Filing step routing (Errors: Logic)';
Expand All @@ -24,5 +25,6 @@ test(
testLabel,
userShouldNotAccess,
});
await checkSnapshot(page);
},
);
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { test } from '../../../fixtures/testFixture';
import { checkSnapshot } from '../../../utils/snapshotTesting';
import { verifyRedirects } from './_shared';

const testLabel = 'Filing step routing (Errors: Syntax)';
Expand Down Expand Up @@ -29,5 +30,6 @@ test(
testLabel,
userShouldNotAccess,
});
await checkSnapshot(page);
},
);
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions e2e/pages/filing-app/filing-step-routing/noUpload.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { test } from '../../../fixtures/testFixture';
import { checkSnapshot } from '../../../utils/snapshotTesting';
import { verifyRedirects } from './_shared';

const testLabel = 'Filing step routing (Upload)';
Expand All @@ -22,4 +23,5 @@ test(testLabel, async ({ page, navigateToUploadFile }) => {
testLabel,
userShouldNotAccess,
});
await checkSnapshot(page);
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { test } from '../../../fixtures/testFixture';
import { checkSnapshot } from '../../../utils/snapshotTesting';
import { verifyRedirects } from './_shared';

const testLabel = 'Filing step routing (Point of Contact)';
Expand All @@ -22,4 +23,5 @@ test(testLabel, async ({ page, navigateToProvideFilingDetails }) => {
page,
test,
});
await checkSnapshot(page);
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions e2e/pages/filing-app/filing-step-routing/warnings.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { test } from '../../../fixtures/testFixture';
import { checkSnapshot } from '../../../utils/snapshotTesting';
import { verifyRedirects } from './_shared';

const testLabel = 'Filing step routing (Warnings)';
Expand All @@ -24,5 +25,6 @@ test(
testLabel,
userShouldNotAccess,
});
await checkSnapshot(page);
},
);
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 19 additions & 1 deletion e2e/pages/filing-app/formAlerts.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { expect } from '@playwright/test';
import { test } from '../../fixtures/testFixture';
import pointOfContactJson from '../../test-data/point-of-contact/point-of-contact-data-1.json';
import { ResultUploadMessage, uploadFile } from '../../utils/uploadFile';
import { clickContinue, clickContinueNext } from '../../utils/navigation.utils';
import { checkSnapshot } from '../../utils/snapshotTesting';
import { ResultUploadMessage, uploadFile } from '../../utils/uploadFile';

test('Form Alerts', async ({
page,
Expand All @@ -14,6 +15,7 @@ test('Form Alerts', async ({
await expect(page.locator('h1'), 'h1 is correct').toContainText(
'Provide type of financial institution',
);
await checkSnapshot(page);

// Submit Incomplete form
await test.step('Submit Incomplete form', async () => {
Expand All @@ -29,6 +31,7 @@ test('Form Alerts', async ({
'There was a problem updating your type of financial institution',
);
});
await checkSnapshot(page);
});

// Submit Completed Form
Expand All @@ -37,6 +40,7 @@ test('Form Alerts', async ({
await page.getByText('Bank or savings association').check();
});
await clickContinue(test, page);
await checkSnapshot(page);
});
});

Expand All @@ -54,6 +58,7 @@ test('Form Alerts', async ({

// Continue to next page
await clickContinueNext(test, page);
await checkSnapshot(page);
});

// Resolve errors (syntax) page
Expand All @@ -76,6 +81,7 @@ test('Form Alerts', async ({
await test.step('Click: Upload new file', async () => {
await page.getByRole('link', { name: 'Upload a new file' }).click();
});
await checkSnapshot(page);
});

// Upload file with logic errors
Expand All @@ -92,6 +98,7 @@ test('Form Alerts', async ({
});

// Continue to next page
await checkSnapshot(page);
await clickContinueNext(test, page);
});

Expand All @@ -104,6 +111,7 @@ test('Form Alerts', async ({
page.locator('.m-notification__success'),
'Success message is visible',
).toContainText('Your register contains no syntax errors');
await checkSnapshot(page);
await clickContinue(test, page);
});

Expand All @@ -125,6 +133,7 @@ test('Form Alerts', async ({
).toContainText(
'You must resolve all errors to continue to the next step.',
);
await checkSnapshot(page);
await test.step('Click: Upload new file', async () => {
await page.getByRole('link', { name: 'Upload a new file' }).click();
});
Expand All @@ -141,6 +150,7 @@ test('Form Alerts', async ({
filePath: '../test-data/sample-sblar-files/logic-warnings_small.csv',
resultMessage: ResultUploadMessage.warning,
});
await checkSnapshot(page);
await clickContinueNext(test, page);
});

Expand All @@ -153,6 +163,7 @@ test('Form Alerts', async ({
page.locator('.m-notification__success'),
'Success message is visible',
).toContainText('Your register contains no syntax errors');
await checkSnapshot(page);
await clickContinue(test, page);
});

Expand All @@ -165,6 +176,7 @@ test('Form Alerts', async ({
page.locator('.m-notification__success'),
'Success message is visible',
).toContainText('Your register contains no logic errors');
await checkSnapshot(page);
await clickContinueNext(test, page);
});

Expand All @@ -173,6 +185,7 @@ test('Form Alerts', async ({
await expect(page.locator('h1'), 'h1 is correct').toContainText(
'Review warnings',
);
await checkSnapshot(page);
await clickContinueNext(test, page);
await expect(
page.locator('#error-header-alert'),
Expand All @@ -183,6 +196,7 @@ test('Form Alerts', async ({
await test.step('Click: Verify checkbox', async () => {
await page.getByText('I verify the accuracy of').check();
});
await checkSnapshot(page);
await clickContinueNext(test, page);
});

Expand All @@ -191,6 +205,7 @@ test('Form Alerts', async ({
await expect(page.locator('h1'), 'h1 is correct').toContainText(
'Provide filing details',
);
await checkSnapshot(page);

// Submit Incomplete form
await test.step('Submit Incomplete form', async () => {
Expand All @@ -201,6 +216,7 @@ test('Form Alerts', async ({
).toContainText(
'There was a problem updating your filing detailsIndicate your voluntary reporter statusEnter 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',
);
await checkSnapshot(page);
});

// Submit Completed form
Expand All @@ -218,6 +234,7 @@ test('Form Alerts', async ({
await page.getByLabel('City').fill('Utah (U');
await page.selectOption('select#state', 'UT');
await page.getByLabel('Zip code').fill('55555');
await checkSnapshot(page);
});
});

Expand All @@ -230,5 +247,6 @@ test('Form Alerts', async ({
await expect(page.locator('h1'), 'h1 is correct').toContainText(
'Sign and submit',
);
await checkSnapshot(page);
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect } from '@playwright/test';
import { test } from '../../../fixtures/testFixture';
import { checkSnapshot } from '../../../utils/snapshotTesting';

test('Sign and submit: complete filing flow with only warnings', async ({
page,
Expand All @@ -13,5 +14,6 @@ test('Sign and submit: complete filing flow with only warnings', async ({
'Congratulations! You have reached the end of the beta filing process.',
),
).toBeVisible();
await checkSnapshot(page);
});
});
4 changes: 3 additions & 1 deletion e2e/pages/filing-app/unavailableApis.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { expect } from '@playwright/test';
import { test } from '../../fixtures/testFixture';
import { blockApi, verifyApiBlockThenUnblock } from '../../utils/blockApi';
import { ResultUploadMessage, uploadFile } from '../../utils/uploadFile';
import { clickContinue, clickContinueNext } from '../../utils/navigation.utils';
import { checkSnapshot } from '../../utils/snapshotTesting';
import { ResultUploadMessage, uploadFile } from '../../utils/uploadFile';

test('Blocking API Calls - Error Boundaries', async ({
page,
Expand Down Expand Up @@ -91,6 +92,7 @@ test('Blocking API Calls - Error Boundaries', async ({
page.locator('#main .m-notification__error'),
'Error Alert is visible',
).toBeVisible();
await checkSnapshot(page);
});

// Unblock API Call
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { expect } from '@playwright/test';
import { test } from '../../../fixtures/testFixture';
import { ResultUploadMessage, uploadFile } from '../../../utils/uploadFile';
import { verifyDownloadableReport } from '../../../utils/verifyDownloadableReport';
import {
clickContinue,
clickContinueNext,
} from '../../../utils/navigation.utils';
import { checkSnapshot } from '../../../utils/snapshotTesting';
import { ResultUploadMessage, uploadFile } from '../../../utils/uploadFile';
import { verifyDownloadableReport } from '../../../utils/verifyDownloadableReport';

test('Resolve Errors (Logic)', async ({ page, navigateToUploadFile }) => {
navigateToUploadFile;
Expand All @@ -28,6 +29,7 @@ test('Resolve Errors (Logic)', async ({ page, navigateToUploadFile }) => {
await expect(
page.getByText('Your register contains no syntax errors'),
).toBeVisible();
await checkSnapshot(page);
});

await test.step('Verify Resolve Errors (logic) and number of errors', async () => {
Expand All @@ -45,6 +47,7 @@ test('Resolve Errors (Logic)', async ({ page, navigateToUploadFile }) => {
await expect(page.locator('#multi-field-errors')).toContainText(
'Multi-field errors: 52 found',
);
await checkSnapshot(page);
});

await test.step('Verify navigation of paginated (logic) content', async () => {
Expand All @@ -67,6 +70,7 @@ test('Resolve Errors (Logic)', async ({ page, navigateToUploadFile }) => {
await expect(page3row1.getByRole('cell').nth(0)).toHaveText('62');
await expect(page3row1.getByRole('cell').nth(2)).toHaveText('999');
await expect(page3row1.getByRole('cell').nth(3)).toHaveText('1');
await checkSnapshot(page);
};

await test.step('Page 1, Row 1', async () => {
Expand All @@ -86,10 +90,12 @@ test('Resolve Errors (Logic)', async ({ page, navigateToUploadFile }) => {
await expect(page2row1.getByRole('cell').nth(0)).toHaveText('42');
await expect(page2row1.getByRole('cell').nth(2)).toHaveText('999');
await expect(page2row1.getByRole('cell').nth(3)).toHaveText('1');
await checkSnapshot(page);
});

await test.step('Page 3, Row 1', async () => {
await verifyPage3();
await checkSnapshot(page);
});

await test.step('Last page, "Next" disabled', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { expect } from '@playwright/test';
import { test } from '../../../fixtures/testFixture';
import { clickContinueNext } from '../../../utils/navigation.utils';
import { checkSnapshot } from '../../../utils/snapshotTesting';
import { ResultUploadMessage, uploadFile } from '../../../utils/uploadFile';
import { verifyDownloadableReport } from '../../../utils/verifyDownloadableReport';
import { clickContinueNext } from '../../../utils/navigation.utils';

test('Resolve Errors (Syntax)', async ({ page, navigateToUploadFile }) => {
navigateToUploadFile;
Expand All @@ -25,6 +26,7 @@ test('Resolve Errors (Syntax)', async ({ page, navigateToUploadFile }) => {
await expect(page.locator('h2')).toContainText(
'Single-field errors: 136 found',
);
await checkSnapshot(page);
});

await verifyDownloadableReport({ testUsed: test, pageUsed: page });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from '@playwright/test';
import { test } from '../../fixtures/testFixture';
import { clickLinkWithRetry } from '../../utils/clickExternalLinkWithRetry';
import { checkSnapshot } from '../../utils/snapshotTesting';

test('Institution Profile Page', async ({ page, navigateToFilingHome }) => {
// Go to Profile page
Expand All @@ -20,6 +21,7 @@ test('Institution Profile Page', async ({ page, navigateToFilingHome }) => {
await expect(page.locator('h1'), 'h1 is correct').toContainText(
'View your financial institution profile',
);
await checkSnapshot(page);
});

// Check Detail Headings
Expand Down
Loading
Loading