Skip to content

Commit

Permalink
Merge branch 'main' into 918-rwd-menu
Browse files Browse the repository at this point in the history
  • Loading branch information
meissadia committed Oct 29, 2024
2 parents 2f5c034 + ce7802d commit 3225e64
Show file tree
Hide file tree
Showing 55 changed files with 796 additions and 453 deletions.
18 changes: 7 additions & 11 deletions e2e/example.spec.demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,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 } from './utils/navigation.utils';

test('proof of concept', async ({ page }) => {
test.slow();
const minorDelay = 500;

await test.step('Unauthenticated homepage: navigate to Authenticated homepage', async () => {
await page.goto('/');
await expect(page.locator('h1')).toContainText(
Expand Down Expand Up @@ -55,9 +53,7 @@ test('proof of concept', async ({ page }) => {
});

await test.step('Upload file: navigate to Resolve errors (syntax) with no errors after upload', async () => {
await page.waitForSelector('#nav-next');
await page.waitForTimeout(minorDelay);
await page.getByRole('button', { name: 'Continue' }).click();
await clickContinue(test, page);
await expect(page.locator('h1')).toContainText('Resolve errors (syntax)');
});

Expand All @@ -72,14 +68,14 @@ test('proof of concept', async ({ page }) => {
await expect(page.locator('h1')).toContainText('Review warnings');
});

await test.step('Review warnings: navigate to Provide point of contact', async () => {
await test.step('Review warnings: navigate to Provide filing details', async () => {
await page.getByText('I verify the accuracy of').click();
await page.getByRole('button', { name: 'Continue to next step' }).click();
await expect(page.locator('h1')).toContainText('Provide point of contact');
await expect(page.locator('h1')).toContainText('Provide filing details');
});

await test.step('Provide point of contact: navigate to Sign and submit', async () => {
await test.step('Provide point of contact: fill out form', async () => {
await test.step('Provide filing details: navigate to Sign and submit', async () => {
await test.step('Provide filing details: fill out form', async () => {
await page.getByLabel('First name').fill(pointOfContactJson.first_name);
await page.getByLabel('Last name').fill(pointOfContactJson.last_name);
await page
Expand Down Expand Up @@ -111,7 +107,7 @@ test('proof of concept', async ({ page }) => {
.getByLabel('ZIP codeZIP code must be in')
.fill(pointOfContactJson.hq_address_zip);
});
await test.step('Provide point of contact: continue to next step', async () => {
await test.step('Provide filing details: continue to next step', async () => {
await page.getByRole('button', { name: 'Continue to next step' }).click();
await expect(page.locator('h1')).toContainText('Sign and submit');
});
Expand Down
82 changes: 43 additions & 39 deletions e2e/fixtures/testFixture.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import type { Page } from '@playwright/test';
import type {
Page,
PlaywrightTestArgs,
PlaywrightTestOptions,
PlaywrightWorkerArgs,
PlaywrightWorkerOptions,
TestType,
} from '@playwright/test';
import { test as baseTest, expect } from '@playwright/test';
import pointOfContactJson from '../test-data/point-of-contact/point-of-contact-data-1.json';
import createDomainAssociation from '../utils/createDomainAssociation';
Expand All @@ -12,6 +19,26 @@ import {
getTestDataObject,
} from '../utils/testFixture.utils';
import { ResultUploadMessage, uploadFile } from '../utils/uploadFile';
import { clickContinue, clickContinueNext } from '../utils/navigation.utils';

export type SBLPlaywrightTest = TestType<
PlaywrightTestArgs &
PlaywrightTestOptions & {
isNonAssociatedUser: boolean; // Skips creating a domain association and creating a financial institution
account: Account;
authHook: void;
navigateToAuthenticatedHomePage: Page;
navigateToFilingHome: Page;
navigateToProvideTypeOfFinancialInstitution: Page;
navigateToUploadFile: Page;
navigateToReviewWarningsAfterOnlyWarningsUpload: Page;
navigateToSyntaxErrorsAfterSyntaxErrorsUpload: Page;
navigateToLogicErrorsAfterLogicErrorsUpload: Page;
navigateToProvidePointOfContact: Page;
navigateToSignAndSubmit: Page;
},
PlaywrightWorkerArgs & PlaywrightWorkerOptions
>;

export const test = baseTest.extend<{
isNonAssociatedUser: boolean; // Skips creating a domain association and creating a financial institution
Expand Down Expand Up @@ -100,7 +127,6 @@ export const test = baseTest.extend<{
await page.getByRole('button', { name: 'Sign In' }).click();
await expect(page.locator('h1')).toContainText(
'Complete your user profile',
{ timeout: 30_000 },
);

// Two versions of Complete User Profile - with and without associations
Expand Down Expand Up @@ -183,11 +209,8 @@ export const test = baseTest.extend<{
exact: true,
});
await page.getByText('Bank or savings association').click();
await page.getByRole('button', { name: 'Continue' }).click();

await expect(page.locator('h1')).toContainText('Upload file', {
timeout: 30_000,
});
await clickContinue(test, page);
await expect(page.locator('h1')).toContainText('Upload file');
await use(page);
});
},
Expand All @@ -210,11 +233,7 @@ export const test = baseTest.extend<{
});

await test.step('Upload file: navigate to Resolve errors (syntax) with no errors after upload', async () => {
await page.waitForSelector('#nav-next');
await page.waitForTimeout(500);
await page
.getByRole('button', { name: 'Continue to next step' })
.click();
await clickContinueNext(test, page);
await expect(page.locator('h1')).toContainText(
'Resolve errors (syntax)',
);
Expand Down Expand Up @@ -242,18 +261,14 @@ export const test = baseTest.extend<{
});

await test.step('Upload file: navigate to Resolve errors (syntax) with no errors after upload', async () => {
await page.waitForSelector('#nav-next');
await page.waitForTimeout(500);
await page
.getByRole('button', { name: 'Continue to next step' })
.click();
await clickContinueNext(test, page);
await expect(page.locator('h1')).toContainText(
'Resolve errors (syntax)',
);
});

await test.step('Resolve errors (logic): navigate to Resolve errors (logic) with errors after upload', async () => {
await page.getByRole('button', { name: 'Continue' }).click();
await clickContinue(test, page);
await expect(page.locator('h1')).toContainText(
'Resolve errors (logic)',
);
Expand Down Expand Up @@ -281,27 +296,21 @@ export const test = baseTest.extend<{
});

await test.step('Upload file: navigate to Resolve errors (syntax) with no errors after upload', async () => {
await page.waitForSelector('#nav-next');
await page.waitForTimeout(500);
await page
.getByRole('button', { name: 'Continue to next step' })
.click();
await clickContinueNext(test, page);
await expect(page.locator('h1')).toContainText(
'Resolve errors (syntax)',
);
});

await test.step('Resolve errors (syntax): navigate to Resolve errors (logic) with no errors after upload', async () => {
await page.getByRole('button', { name: 'Continue' }).click();
await clickContinue(test, page);
await expect(page.locator('h1')).toContainText(
'Resolve errors (logic)',
);
});

await test.step('Resolve errors (logic): navigate to Review warnings', async () => {
await page
.getByRole('button', { name: 'Continue to next step' })
.click();
await clickContinueNext(test, page);
await expect(page.locator('h1')).toContainText('Review warnings');
});
await use(page);
Expand All @@ -313,13 +322,10 @@ export const test = baseTest.extend<{
use,
) => {
navigateToReviewWarningsAfterOnlyWarningsUpload;
await test.step('Review warnings: navigate to Provide point of contact', async () => {
await test.step('Review warnings: navigate to Provide filing details', async () => {
await page.getByText('I verify the accuracy of').click();
await page.getByRole('button', { name: 'Continue to next step' }).click();
await expect(page.locator('h1')).toContainText(
'Provide point of contact',
{ timeout: 30_000 },
);
await clickContinueNext(test, page);
await expect(page.locator('h1')).toContainText('Provide filing details');
});
await use(page);
},
Expand All @@ -329,8 +335,8 @@ export const test = baseTest.extend<{
use,
) => {
navigateToProvidePointOfContact;
await test.step('Provide point of contact: navigate to Sign and submit', async () => {
await test.step('Provide point of contact: fill out form', async () => {
await test.step('Provide filing details: navigate to Sign and submit', async () => {
await test.step('Provide filing details: fill out form', async () => {
await page.getByLabel('First name').fill(pointOfContactJson.first_name);
await page.getByLabel('Last name').fill(pointOfContactJson.last_name);
await page
Expand Down Expand Up @@ -362,10 +368,8 @@ export const test = baseTest.extend<{
.getByLabel('ZIP codeZIP code must be in')
.fill(pointOfContactJson.hq_address_zip);
});
await test.step('Provide point of contact: continue to next step', async () => {
await page
.getByRole('button', { name: 'Continue to next step' })
.click();
await test.step('Provide filing details: continue to next step', async () => {
await clickContinueNext(test, page);
await expect(page.locator('h1')).toContainText('Sign and submit');
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ import { controlUnicode } from '../../../utils/unicodeConstants';
test('Complete the User Profile: Checking for form errors based on user input', async ({
page,
}) => {
test.slow();

await test.step('Complete the User Profile: Check that the error header render when no input is filled', async () => {
await page.getByLabel('Submit User Profile').click();
await expect(page.locator('#step1FormErrorHeader div').first()).toBeVisible(
{
timeout: 30_000,
},
);
await expect(
page.locator('#step1FormErrorHeader div').first(),
).toBeVisible();
});

await test.step('Complete the User Profile: Check the first and last names for invalid input', async () => {
Expand All @@ -40,15 +36,11 @@ test('Complete the User Profile: Checking for form errors based on user input',
test('Complete the User Profile: Checking for input length restriction', async ({
page,
}) => {
test.slow();

await test.step('Complete the User Profile: Check that the error header render when no input is filled', async () => {
await page.getByLabel('Submit User Profile').click();
await expect(page.locator('#step1FormErrorHeader div').first()).toBeVisible(
{
timeout: 30_000,
},
);
await expect(
page.locator('#step1FormErrorHeader div').first(),
).toBeVisible();
});

await test.step('Complete the User Profile: Check the first and last names for invalid input', async () => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/pages/filing-app/filing-step-routing/_shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const verifyRedirects = async ({
for (const futureStep of userShouldNotAccess) {
await test.step(`${testLabel}: Verify user cannot access ${futureStep}`, async () => {
await page.goto(baseURL + futureStep);
await expect(page).toHaveURL(afterRedirectURL, { timeout: 10_000 });
await expect(page).toHaveURL(afterRedirectURL);
await expect(page.locator('h1')).toContainText(afterRedirectHeading);
});
}
Expand Down
2 changes: 0 additions & 2 deletions e2e/pages/filing-app/filing-step-routing/errorsLogic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ const afterRedirectURL = /.*errors\/errors-syntax$/;
test(
testLabel,
async ({ page, navigateToLogicErrorsAfterLogicErrorsUpload }) => {
test.slow();

navigateToLogicErrorsAfterLogicErrorsUpload;

await verifyRedirects({
Expand Down
2 changes: 0 additions & 2 deletions e2e/pages/filing-app/filing-step-routing/errorsSyntax.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ const afterRedirectURL = /.*errors\/errors-syntax$/;
test(
testLabel,
async ({ page, navigateToSyntaxErrorsAfterSyntaxErrorsUpload }) => {
test.slow();

navigateToSyntaxErrorsAfterSyntaxErrorsUpload;

await verifyRedirects({
Expand Down
2 changes: 0 additions & 2 deletions e2e/pages/filing-app/filing-step-routing/noUpload.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ const afterRedirectHeading = 'Upload file';
const afterRedirectURL = /.*\/upload$/;

test(testLabel, async ({ page, navigateToUploadFile }) => {
test.slow();

navigateToUploadFile;

await verifyRedirects({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ const currentStepPath = '/contact';

const userShouldNotAccess = ['/submit'];

const afterRedirectHeading = 'Provide point of contact';
const afterRedirectHeading = 'Provide filing details';
const afterRedirectURL = /.*\/contact$/;

test(testLabel, async ({ page, navigateToProvidePointOfContact }) => {
test.slow();

navigateToProvidePointOfContact;

await verifyRedirects({
Expand Down
2 changes: 0 additions & 2 deletions e2e/pages/filing-app/filing-step-routing/warnings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ const afterRedirectURL = /.*\/warnings$/;
test(
testLabel,
async ({ page, navigateToReviewWarningsAfterOnlyWarningsUpload }) => {
test.slow();

navigateToReviewWarningsAfterOnlyWarningsUpload;

await verifyRedirects({
Expand Down
Loading

0 comments on commit 3225e64

Please sign in to comment.