generated from cfpb/open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:cfpb/sbl-frontend into 943-disable-…
…ufp-rssd-id
- Loading branch information
Showing
54 changed files
with
1,057 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
* @billhimmelsbach @meissadia @shindigira @ojbravo | ||
* @billhimmelsbach @meissadia @shindigira @ojbravo @tanner-ricks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* eslint-disable no-await-in-loop */ | ||
|
||
import type { Page } from '@playwright/test'; | ||
import { expect } from '@playwright/test'; | ||
import type { test } from '../../../fixtures/testFixture'; | ||
|
||
interface VerifyRedirects { | ||
page: Page; | ||
userShouldNotAccess: string[]; // List of paths that a user should not be able to access | ||
afterRedirectURL: RegExp; // RegExp that matches the URL a user should land on after redirect | ||
afterRedirectHeading: string; // H1 text a user should see after redirect | ||
currentStepPath: string; // A string at which to split the URL while preserving the LEI | ||
testLabel: string; // Label displayed in the Playwright logs | ||
test: typeof test; | ||
} | ||
|
||
/** | ||
* Ensure that, from the current Filing step, users cannot inappropriately access future steps. | ||
*/ | ||
export const verifyRedirects = async ({ | ||
page, | ||
test, | ||
userShouldNotAccess, | ||
afterRedirectURL, | ||
afterRedirectHeading, | ||
currentStepPath, | ||
testLabel, | ||
}: VerifyRedirects) => { | ||
const [baseURL] = page.url().split(currentStepPath); | ||
|
||
// Note: Tests failed when using Promise.all in place of this loop approach | ||
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.locator('h1')).toContainText(afterRedirectHeading); | ||
}); | ||
} | ||
}; |
30 changes: 30 additions & 0 deletions
30
e2e/pages/filing-app/filing-step-routing/errorsLogic.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { test } from '../../../fixtures/testFixture'; | ||
import { verifyRedirects } from './_shared'; | ||
|
||
const testLabel = 'Filing step routing (Errors: Logic)'; | ||
|
||
const currentStepPath = '/error'; | ||
|
||
const userShouldNotAccess = ['/warnings', '/contact', '/submit']; | ||
|
||
const afterRedirectHeading = 'Resolve errors (syntax)'; | ||
const afterRedirectURL = /.*errors\/errors-syntax$/; | ||
|
||
test( | ||
testLabel, | ||
async ({ page, navigateToLogicErrorsAfterLogicErrorsUpload }) => { | ||
test.slow(); | ||
|
||
navigateToLogicErrorsAfterLogicErrorsUpload; | ||
|
||
await verifyRedirects({ | ||
afterRedirectHeading, | ||
afterRedirectURL, | ||
currentStepPath, | ||
page, | ||
test, | ||
testLabel, | ||
userShouldNotAccess, | ||
}); | ||
}, | ||
); |
35 changes: 35 additions & 0 deletions
35
e2e/pages/filing-app/filing-step-routing/errorsSyntax.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { test } from '../../../fixtures/testFixture'; | ||
import { verifyRedirects } from './_shared'; | ||
|
||
const testLabel = 'Filing step routing (Errors: Syntax)'; | ||
|
||
const currentStepPath = '/error'; | ||
|
||
const userShouldNotAccess = [ | ||
'/errors/errors-logic', | ||
'/warnings', | ||
'/contact', | ||
'/submit', | ||
]; | ||
|
||
const afterRedirectHeading = 'Resolve errors (syntax)'; | ||
const afterRedirectURL = /.*errors\/errors-syntax$/; | ||
|
||
test( | ||
testLabel, | ||
async ({ page, navigateToSyntaxErrorsAfterSyntaxErrorsUpload }) => { | ||
test.slow(); | ||
|
||
navigateToSyntaxErrorsAfterSyntaxErrorsUpload; | ||
|
||
await verifyRedirects({ | ||
afterRedirectHeading, | ||
afterRedirectURL, | ||
currentStepPath, | ||
page, | ||
test, | ||
testLabel, | ||
userShouldNotAccess, | ||
}); | ||
}, | ||
); |
Oops, something went wrong.