diff --git a/README.md b/README.md index 8d7f1c9ae..0ba800d65 100644 --- a/README.md +++ b/README.md @@ -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 ` - 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`. diff --git a/e2e/pages/shared-lending-platform/InstitutionProfile.spec.ts b/e2e/pages/shared-lending-platform/InstitutionProfile.spec.ts index 855365b72..7c6648a03 100644 --- a/e2e/pages/shared-lending-platform/InstitutionProfile.spec.ts +++ b/e2e/pages/shared-lending-platform/InstitutionProfile.spec.ts @@ -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 @@ -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 diff --git a/e2e/pages/shared-lending-platform/InstitutionProfile.spec.ts-snapshots/Institution-Profile-Page-1-chromium-darwin.png b/e2e/pages/shared-lending-platform/InstitutionProfile.spec.ts-snapshots/Institution-Profile-Page-1-chromium-darwin.png new file mode 100644 index 000000000..4eea51d3e Binary files /dev/null and b/e2e/pages/shared-lending-platform/InstitutionProfile.spec.ts-snapshots/Institution-Profile-Page-1-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/Navigation.spec.ts b/e2e/pages/shared-lending-platform/Navigation.spec.ts index 07fea734e..db063f69b 100644 --- a/e2e/pages/shared-lending-platform/Navigation.spec.ts +++ b/e2e/pages/shared-lending-platform/Navigation.spec.ts @@ -1,6 +1,9 @@ import { expect } from '@playwright/test'; import { test } from '../../fixtures/testFixture'; import { clickLinkWithRetry } from '../../utils/clickExternalLinkWithRetry'; +import { checkSnapshot } from '../../utils/snapshotTesting'; + +// Note: Skipped snapshot tests for pages outside of the SBL site test('Navigation', async ({ page, navigateToFilingHome }) => { navigateToFilingHome; @@ -14,6 +17,7 @@ test('Navigation', async ({ page, navigateToFilingHome }) => { await expect(page.locator('h1')).toContainText( 'File your small business lending data', ); + await checkSnapshot(page); // Test Home Link await page @@ -21,6 +25,7 @@ test('Navigation', async ({ page, navigateToFilingHome }) => { .getByRole('link', { name: 'Home', exact: false }) .click(); await expect(page.locator('h1')).toContainText('File your lending data'); + await checkSnapshot(page); // Test Profile Link await page @@ -28,6 +33,7 @@ test('Navigation', async ({ page, navigateToFilingHome }) => { .getByRole('link', { name: 'Playwright Test User' }) .click(); await expect(page.locator('h1')).toContainText('View your user profile'); + await checkSnapshot(page); }); await test.step('Breadcrumb Navigation', async () => { @@ -38,6 +44,7 @@ test('Navigation', async ({ page, navigateToFilingHome }) => { await expect(page.locator('h1')).toContainText( 'View your financial institution profile', ); + await checkSnapshot(page); await page .getByRole('link', { name: 'Update your financial institution profile', @@ -47,6 +54,7 @@ test('Navigation', async ({ page, navigateToFilingHome }) => { await expect(page.locator('h1')).toContainText( 'Update your financial institution profile', ); + await checkSnapshot(page); await page .getByRole('link', { name: 'View your financial institution profile' }) .click(); @@ -244,6 +252,7 @@ test('Navigation', async ({ page, navigateToFilingHome }) => { 'Get started filing your lending data', ); await expect(page.locator('.navbar .nav-items')).toHaveCount(0); + await checkSnapshot(page); // Test CFPB Logo Link await clickLinkWithRetry({ page, target: page.getByLabel('Home') }); diff --git a/e2e/pages/shared-lending-platform/Navigation.spec.ts-snapshots/Navigation-1-chromium-darwin.png b/e2e/pages/shared-lending-platform/Navigation.spec.ts-snapshots/Navigation-1-chromium-darwin.png new file mode 100644 index 000000000..2e0ac7017 Binary files /dev/null and b/e2e/pages/shared-lending-platform/Navigation.spec.ts-snapshots/Navigation-1-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/Navigation.spec.ts-snapshots/Navigation-2-chromium-darwin.png b/e2e/pages/shared-lending-platform/Navigation.spec.ts-snapshots/Navigation-2-chromium-darwin.png new file mode 100644 index 000000000..a9426523e Binary files /dev/null and b/e2e/pages/shared-lending-platform/Navigation.spec.ts-snapshots/Navigation-2-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/Navigation.spec.ts-snapshots/Navigation-3-chromium-darwin.png b/e2e/pages/shared-lending-platform/Navigation.spec.ts-snapshots/Navigation-3-chromium-darwin.png new file mode 100644 index 000000000..69d17126b Binary files /dev/null and b/e2e/pages/shared-lending-platform/Navigation.spec.ts-snapshots/Navigation-3-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/Navigation.spec.ts-snapshots/Navigation-4-chromium-darwin.png b/e2e/pages/shared-lending-platform/Navigation.spec.ts-snapshots/Navigation-4-chromium-darwin.png new file mode 100644 index 000000000..4eea51d3e Binary files /dev/null and b/e2e/pages/shared-lending-platform/Navigation.spec.ts-snapshots/Navigation-4-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/Navigation.spec.ts-snapshots/Navigation-5-chromium-darwin.png b/e2e/pages/shared-lending-platform/Navigation.spec.ts-snapshots/Navigation-5-chromium-darwin.png new file mode 100644 index 000000000..8f24efd65 Binary files /dev/null and b/e2e/pages/shared-lending-platform/Navigation.spec.ts-snapshots/Navigation-5-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/Navigation.spec.ts-snapshots/Navigation-6-chromium-darwin.png b/e2e/pages/shared-lending-platform/Navigation.spec.ts-snapshots/Navigation-6-chromium-darwin.png new file mode 100644 index 000000000..4bb5dfc26 Binary files /dev/null and b/e2e/pages/shared-lending-platform/Navigation.spec.ts-snapshots/Navigation-6-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/NonAssociatedUserProfile.spec.ts b/e2e/pages/shared-lending-platform/NonAssociatedUserProfile.spec.ts index 9afe6dd4a..8346cfca9 100644 --- a/e2e/pages/shared-lending-platform/NonAssociatedUserProfile.spec.ts +++ b/e2e/pages/shared-lending-platform/NonAssociatedUserProfile.spec.ts @@ -1,8 +1,9 @@ import { expect } from '@playwright/test'; +import { DefaultInputCharLimit, LeiInputCharLimit } from 'utils/constants'; import { test } from '../../fixtures/testFixture'; -import { controlUnicode } from '../../utils/unicodeConstants'; import { assertTextInput } from '../../utils/inputValidators'; -import { DefaultInputCharLimit, LeiInputCharLimit } from 'utils/constants'; +import { checkSnapshot } from '../../utils/snapshotTesting'; +import { controlUnicode } from '../../utils/unicodeConstants'; const expectedNoAssociationsSummaryUrl = /\/profile\/complete\/summary\/submitted$/; @@ -38,11 +39,13 @@ test('Complete User Profile -- No Associations -- process', async ({ await page .getByLabel('Legal Entity Identifier (LEI)') .fill('12345678901234567890'); + await checkSnapshot(page); await page.getByLabel('Submit User Profile').click(); // redirected to the summary page await expect(page).toHaveURL(expectedNoAssociationsSummaryUrl); await expect(page.locator('#Summary div').first()).toBeVisible(); + await checkSnapshot(page); }); }); @@ -83,5 +86,6 @@ test('Complete User Profile with Bad Unicode -- No Associations -- process', asy expected: expectedValues.leiField, unexpected: unexpectedValues.leiField, }); + await checkSnapshot(page); }); }); diff --git a/e2e/pages/shared-lending-platform/NonAssociatedUserProfile.spec.ts-snapshots/Complete-User-Profile----No-Associations----process-1-chromium-darwin.png b/e2e/pages/shared-lending-platform/NonAssociatedUserProfile.spec.ts-snapshots/Complete-User-Profile----No-Associations----process-1-chromium-darwin.png new file mode 100644 index 000000000..e282fefa3 Binary files /dev/null and b/e2e/pages/shared-lending-platform/NonAssociatedUserProfile.spec.ts-snapshots/Complete-User-Profile----No-Associations----process-1-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/NonAssociatedUserProfile.spec.ts-snapshots/Complete-User-Profile----No-Associations----process-2-chromium-darwin.png b/e2e/pages/shared-lending-platform/NonAssociatedUserProfile.spec.ts-snapshots/Complete-User-Profile----No-Associations----process-2-chromium-darwin.png new file mode 100644 index 000000000..983a53178 Binary files /dev/null and b/e2e/pages/shared-lending-platform/NonAssociatedUserProfile.spec.ts-snapshots/Complete-User-Profile----No-Associations----process-2-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/NonAssociatedUserProfile.spec.ts-snapshots/Complete-User-Profile-with-Bad-Unicode----No-Associations----process-1-chromium-darwin.png b/e2e/pages/shared-lending-platform/NonAssociatedUserProfile.spec.ts-snapshots/Complete-User-Profile-with-Bad-Unicode----No-Associations----process-1-chromium-darwin.png new file mode 100644 index 000000000..5960d89ae Binary files /dev/null and b/e2e/pages/shared-lending-platform/NonAssociatedUserProfile.spec.ts-snapshots/Complete-User-Profile-with-Bad-Unicode----No-Associations----process-1-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts b/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts index 20526e822..eed29514f 100644 --- a/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts +++ b/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts @@ -1,7 +1,8 @@ import { expect } from '@playwright/test'; -import { test } from '../../fixtures/testFixture'; import { DefaultInputCharLimit } from 'utils/constants'; +import { test } from '../../fixtures/testFixture'; import { assertTextInput } from '../../utils/inputValidators'; +import { checkSnapshot } from '../../utils/snapshotTesting'; import { controlUnicode } from '../../utils/unicodeConstants'; test('Update Institution Profile Page', async ({ @@ -20,6 +21,7 @@ test('Update Institution Profile Page', async ({ .getByRole('link', { name: 'RegTech Regional Reserve - ' }) .click(); }); + await checkSnapshot(page); }); // Institution Profile page @@ -35,6 +37,7 @@ test('Update Institution Profile Page', async ({ .first() .click(); }); + await checkSnapshot(page); }); // Update Institution Profile page @@ -151,6 +154,8 @@ test('Update Institution Profile Page', async ({ page.locator('#top_holder_rssd_id'), 'Top-Holder RSSD is editable', ).toBeEditable(); + + await checkSnapshot(page); }); // Reset Form @@ -160,6 +165,8 @@ test('Update Institution Profile Page', async ({ page.getByLabel('You must enter a type of'), 'Other field reset', ).not.toBeEnabled(); + + await checkSnapshot(page); }); // Add Other (again) @@ -190,6 +197,8 @@ test('Update Institution Profile Page', async ({ 'mailto:SBLHelp@cfpb.gov?subject=[BETA] Update your financial institution profile: Questions after submitting form', ); }); + + await checkSnapshot(page); }); }); @@ -295,5 +304,7 @@ test('Update Institution Profile Page: Check Character Limits', async ({ expected: expectedValues.topRssdField, unexpected: unexpectedValues.topRssdField, }); + + await checkSnapshot(page); }); }); diff --git a/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts-snapshots/Update-Institution-Profile-Page-1-chromium-darwin.png b/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts-snapshots/Update-Institution-Profile-Page-1-chromium-darwin.png new file mode 100644 index 000000000..4eea51d3e Binary files /dev/null and b/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts-snapshots/Update-Institution-Profile-Page-1-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts-snapshots/Update-Institution-Profile-Page-2-chromium-darwin.png b/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts-snapshots/Update-Institution-Profile-Page-2-chromium-darwin.png new file mode 100644 index 000000000..8f24efd65 Binary files /dev/null and b/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts-snapshots/Update-Institution-Profile-Page-2-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts-snapshots/Update-Institution-Profile-Page-3-chromium-darwin.png b/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts-snapshots/Update-Institution-Profile-Page-3-chromium-darwin.png new file mode 100644 index 000000000..090e383aa Binary files /dev/null and b/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts-snapshots/Update-Institution-Profile-Page-3-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts-snapshots/Update-Institution-Profile-Page-4-chromium-darwin.png b/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts-snapshots/Update-Institution-Profile-Page-4-chromium-darwin.png new file mode 100644 index 000000000..af3107f66 Binary files /dev/null and b/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts-snapshots/Update-Institution-Profile-Page-4-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts-snapshots/Update-Institution-Profile-Page-5-chromium-darwin.png b/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts-snapshots/Update-Institution-Profile-Page-5-chromium-darwin.png new file mode 100644 index 000000000..c57ec24c9 Binary files /dev/null and b/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts-snapshots/Update-Institution-Profile-Page-5-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts-snapshots/Update-Institution-Profile-Page-Check-Character-Limits-1-chromium-darwin.png b/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts-snapshots/Update-Institution-Profile-Page-Check-Character-Limits-1-chromium-darwin.png new file mode 100644 index 000000000..4fe350663 Binary files /dev/null and b/e2e/pages/shared-lending-platform/UpdateInstitutionProfile.spec.ts-snapshots/Update-Institution-Profile-Page-Check-Character-Limits-1-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/UserProfile.spec.ts b/e2e/pages/shared-lending-platform/UserProfile.spec.ts index 62921b65b..ef8da2fc5 100644 --- a/e2e/pages/shared-lending-platform/UserProfile.spec.ts +++ b/e2e/pages/shared-lending-platform/UserProfile.spec.ts @@ -1,5 +1,6 @@ import { expect } from '@playwright/test'; import { test } from '../../fixtures/testFixture'; +import { checkSnapshot } from '../../utils/snapshotTesting'; test('User Profile Page', async ({ page, navigateToFilingHome }) => { // Go to Profile page @@ -7,6 +8,7 @@ test('User Profile Page', async ({ page, navigateToFilingHome }) => { navigateToFilingHome; await page.goto('/profile/view'); await expect(page.locator('h1')).toContainText('View your user profile'); + await checkSnapshot(page); }); await test.step('Verify nav options', async () => { diff --git a/e2e/pages/shared-lending-platform/UserProfile.spec.ts-snapshots/User-Profile-Page-1-chromium-darwin.png b/e2e/pages/shared-lending-platform/UserProfile.spec.ts-snapshots/User-Profile-Page-1-chromium-darwin.png new file mode 100644 index 000000000..61f8bc108 Binary files /dev/null and b/e2e/pages/shared-lending-platform/UserProfile.spec.ts-snapshots/User-Profile-Page-1-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/unauthenticated-homepage/DeniedDomain.spec.ts b/e2e/pages/shared-lending-platform/unauthenticated-homepage/DeniedDomain.spec.ts index 2eaaa6315..bdc4f30c7 100644 --- a/e2e/pages/shared-lending-platform/unauthenticated-homepage/DeniedDomain.spec.ts +++ b/e2e/pages/shared-lending-platform/unauthenticated-homepage/DeniedDomain.spec.ts @@ -1,5 +1,6 @@ import { expect, test } from '@playwright/test'; import { webcrypto } from 'node:crypto'; +import { checkSnapshot } from '../../../utils/snapshotTesting'; // this is just an example test (e2e tests should be way longer than this) test('Unauthenticated homepage: Registering with an invalid email domain', async ({ @@ -37,6 +38,7 @@ test('Unauthenticated homepage: Registering with an invalid email domain', async await expect(page.getByRole('heading')).toContainText( 'Your email domain is not authorized', ); + await checkSnapshot(page); await expect(page.locator('#Summary div').first()).toBeVisible(); }); }); diff --git a/e2e/pages/shared-lending-platform/unauthenticated-homepage/DeniedDomain.spec.ts-snapshots/Unauthenticated-homepage-Registering-with-an-invalid-email-domain-1-chromium-darwin.png b/e2e/pages/shared-lending-platform/unauthenticated-homepage/DeniedDomain.spec.ts-snapshots/Unauthenticated-homepage-Registering-with-an-invalid-email-domain-1-chromium-darwin.png new file mode 100644 index 000000000..80ffa9b85 Binary files /dev/null and b/e2e/pages/shared-lending-platform/unauthenticated-homepage/DeniedDomain.spec.ts-snapshots/Unauthenticated-homepage-Registering-with-an-invalid-email-domain-1-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/unauthenticated-homepage/paperworkReductionAct.spec.ts b/e2e/pages/shared-lending-platform/unauthenticated-homepage/paperworkReductionAct.spec.ts index cd54f4955..74a8604f7 100644 --- a/e2e/pages/shared-lending-platform/unauthenticated-homepage/paperworkReductionAct.spec.ts +++ b/e2e/pages/shared-lending-platform/unauthenticated-homepage/paperworkReductionAct.spec.ts @@ -1,4 +1,5 @@ import { expect, test } from '@playwright/test'; +import { checkSnapshot } from '../../../utils/snapshotTesting'; import { expectedPaperworkReductionActUrl } from '../../../utils/testFixture.utils'; test('Unauthenticated homepage: Paperwork Reduction Act', async ({ page }) => { @@ -10,6 +11,7 @@ test('Unauthenticated homepage: Paperwork Reduction Act', async ({ page }) => { await expect( page.getByRole('link', { name: 'View Paperwork Reduction Act' }), ).toBeVisible(); + await checkSnapshot(page); }); await test.step('Navigates to the Paperwork Reduction Act summary', async () => { diff --git a/e2e/pages/shared-lending-platform/unauthenticated-homepage/paperworkReductionAct.spec.ts-snapshots/Unauthenticated-homepage-Paperwork-Reduction-Act-1-chromium-darwin.png b/e2e/pages/shared-lending-platform/unauthenticated-homepage/paperworkReductionAct.spec.ts-snapshots/Unauthenticated-homepage-Paperwork-Reduction-Act-1-chromium-darwin.png new file mode 100644 index 000000000..4bb5dfc26 Binary files /dev/null and b/e2e/pages/shared-lending-platform/unauthenticated-homepage/paperworkReductionAct.spec.ts-snapshots/Unauthenticated-homepage-Paperwork-Reduction-Act-1-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/unauthenticated-homepage/privacyNotice.spec.ts b/e2e/pages/shared-lending-platform/unauthenticated-homepage/privacyNotice.spec.ts index 3e6b835e5..b7d222627 100644 --- a/e2e/pages/shared-lending-platform/unauthenticated-homepage/privacyNotice.spec.ts +++ b/e2e/pages/shared-lending-platform/unauthenticated-homepage/privacyNotice.spec.ts @@ -1,4 +1,5 @@ import { expect, test } from '@playwright/test'; +import { checkSnapshot } from '../../../utils/snapshotTesting'; import { expectedPrivacyNoticeUrl } from '../../../utils/testFixture.utils'; test('Unauthenticated homepage: Privacy Notice', async ({ page }) => { @@ -8,6 +9,7 @@ test('Unauthenticated homepage: Privacy Notice', async ({ page }) => { await expect( page.getByRole('link', { name: 'View Privacy Notice' }), ).toBeVisible(); + await checkSnapshot(page); }); await test.step('Navigates to the Privacy Notice summary', async () => { @@ -15,5 +17,6 @@ test('Unauthenticated homepage: Privacy Notice', async ({ page }) => { await expect(page).toHaveURL(expectedPrivacyNoticeUrl); await expect(page.getByText('/Home')).toBeVisible(); await expect(page.getByRole('heading')).toContainText('Privacy Notice'); + await checkSnapshot(page); }); }); diff --git a/e2e/pages/shared-lending-platform/unauthenticated-homepage/privacyNotice.spec.ts-snapshots/Unauthenticated-homepage-Privacy-Notice-1-chromium-darwin.png b/e2e/pages/shared-lending-platform/unauthenticated-homepage/privacyNotice.spec.ts-snapshots/Unauthenticated-homepage-Privacy-Notice-1-chromium-darwin.png new file mode 100644 index 000000000..4bb5dfc26 Binary files /dev/null and b/e2e/pages/shared-lending-platform/unauthenticated-homepage/privacyNotice.spec.ts-snapshots/Unauthenticated-homepage-Privacy-Notice-1-chromium-darwin.png differ diff --git a/e2e/pages/shared-lending-platform/unauthenticated-homepage/privacyNotice.spec.ts-snapshots/Unauthenticated-homepage-Privacy-Notice-2-chromium-darwin.png b/e2e/pages/shared-lending-platform/unauthenticated-homepage/privacyNotice.spec.ts-snapshots/Unauthenticated-homepage-Privacy-Notice-2-chromium-darwin.png new file mode 100644 index 000000000..d17c69371 Binary files /dev/null and b/e2e/pages/shared-lending-platform/unauthenticated-homepage/privacyNotice.spec.ts-snapshots/Unauthenticated-homepage-Privacy-Notice-2-chromium-darwin.png differ diff --git a/package.json b/package.json index ab5702d99..bc01e1863 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "test:ci": "vitest run", "test:e2e": "chmod +x ./run-playwright.sh && sh ./run-playwright.sh", "test:e2e:snapshot": "chmod +x ./run-playwright.sh && SBL_ENABLE_PLAYWRIGHT_SNAPSHOT_TESTING=true sh ./run-playwright.sh", + "test:e2e:snapshot-update": "SBL_ENABLE_PLAYWRIGHT_SNAPSHOT_TESTING=true yarn playwright test --update-snapshots", "format": "prettier -uw --cache .", "run-tsc": "tsc", "run-eslint": "eslint --cache --fix --ignore-path .gitignore --ignore-path .eslintignore --ext .ts,.tsx .", diff --git a/src/components/AssociatedInstitution.tsx b/src/components/AssociatedInstitution.tsx index ec0f869c3..80b7002cd 100644 --- a/src/components/AssociatedInstitution.tsx +++ b/src/components/AssociatedInstitution.tsx @@ -1,7 +1,7 @@ /* eslint-disable react/require-default-props */ import { ListLink } from 'components/Link'; -import { formatPipeSeparatedString } from 'utils/formatting'; import type { InstitutionDetailsApiType } from 'types/formTypes'; +import { formatPipeSeparatedString } from 'utils/formatting'; export function AssociatedInstitution({ name, @@ -17,7 +17,7 @@ export function AssociatedInstitution({ } return ( - + {text} ); diff --git a/src/components/__tests__/AdditionalResources.test.tsx b/src/components/__tests__/AdditionalResources.test.tsx new file mode 100644 index 000000000..b0d41932b --- /dev/null +++ b/src/components/__tests__/AdditionalResources.test.tsx @@ -0,0 +1,32 @@ +import { render, screen } from '@testing-library/react'; +import AdditionalResources from 'components/AdditionalResources'; +import { ListLink } from 'components/Link'; +import { MemoryRouter } from 'react-router-dom'; + +describe('', () => { + it('Renders expected content', async () => { + render( + + + First link + Second link + + , + ); + + // Heading + expect( + screen.getByText('Additional resources', { selector: 'h4' }), + ).toBeInTheDocument(); + + // Links + for (const link of [ + { name: 'First link', href: '/first-link' }, + { name: 'Second link', href: '/second-link' }, + ]) { + const element = screen.getByRole('link', { name: link.name }); + expect(element).toBeInTheDocument(); + expect(element).toHaveAttribute('href', link.href); + } + }); +}); diff --git a/src/pages/Filing/UpdateFinancialProfile/UpdateIdentifyingInformation.tsx b/src/pages/Filing/UpdateFinancialProfile/UpdateIdentifyingInformation.tsx index 4e75ea500..8d32f16ff 100644 --- a/src/pages/Filing/UpdateFinancialProfile/UpdateIdentifyingInformation.tsx +++ b/src/pages/Filing/UpdateFinancialProfile/UpdateIdentifyingInformation.tsx @@ -83,6 +83,7 @@ function UpdateIdentifyingInformation({ {...register(taxID)} errorMessage={formErrors[taxID]?.message} showError + className='snapshot-ignore' /> diff --git a/src/pages/Filing/ViewInstitutionProfile/FinancialInstitutionDetails.tsx b/src/pages/Filing/ViewInstitutionProfile/FinancialInstitutionDetails.tsx index fe45804ac..6ed27000f 100644 --- a/src/pages/Filing/ViewInstitutionProfile/FinancialInstitutionDetails.tsx +++ b/src/pages/Filing/ViewInstitutionProfile/FinancialInstitutionDetails.tsx @@ -102,6 +102,7 @@ export function FinancialInstitutionDetails({ ) : ( '' diff --git a/src/pages/Filing/ViewUserProfile/UserInformation.tsx b/src/pages/Filing/ViewUserProfile/UserInformation.tsx index ded94f99e..8be66a13d 100644 --- a/src/pages/Filing/ViewUserProfile/UserInformation.tsx +++ b/src/pages/Filing/ViewUserProfile/UserInformation.tsx @@ -28,10 +28,12 @@ export default function UserInformation({ {data.name}} + className='snapshot-ignore' /> {data.email}} + className='snapshot-ignore' />