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.
[Review First][e2e] [Upload] Tests for syntax errors, logic errors an…
…d to verify a downloadable report (#938) closes #777 closes #802 closes #937 closes #958 ## Changes - Adds e2e test to check the navigation of when a user uploads a csv that produces syntax errors - Adds e2e test to check the navigation of when a user uploads a csv that produces logic errors - e2e: Verifies - a user can download a validation report after a syntax error has been upload - enhancement: Improves TypeScript handing in `playwright.config.ts` - feat: deletes individual reports in the `e2e/pages/filing-app/uploadFile/downloads` directory after the download report test finishes - chore: updated `uploadFile.ts` to be DRY - feat: Integrate `uploadFile.ts` with completeUploadLogicErrors.spec.ts - feat: Integrate `uploadFile.ts` with completeUploadSyntaxErrors.spec.ts - feat: Update `unavailableApis.spec.ts` with `uploadFile.ts` accordingly ## How to Test - Run `npx playwright test --ui` - Run the `completeSyntaxErrors.spec.ts` test - Run the `completeLogicErrors.spec.ts` test - Run the `unavailableApis.spec.ts` test - **Verify downloaded reports are being <ins>deleted</ins> from `e2e/pages/filing-app/uploadFile/downloads`** ## Screenshot <img width="1392" alt="Screenshot 2024-09-20 at 2 15 50 PM" src="https://github.com/user-attachments/assets/2ea68bc9-e780-4934-8bd6-bca8fd9dc4d4">
- Loading branch information
1 parent
a4aaaac
commit 1ab3869
Showing
10 changed files
with
459 additions
and
74 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
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
57 changes: 57 additions & 0 deletions
57
e2e/pages/filing-app/uploadFile/completeUploadLogicErrors.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,57 @@ | ||
import { expect } from '@playwright/test'; | ||
import { test } from '../../../fixtures/testFixture'; | ||
import { ResultUploadMessage, uploadFile } from '../../../utils/uploadFile'; | ||
import { verifyDownloadableReport } from '../../../utils/verifyDownloadableReport'; | ||
|
||
test('Resolve Errors (Logic)', async ({ page, navigateToUploadFile }) => { | ||
test.slow(); | ||
|
||
navigateToUploadFile; | ||
|
||
await test.step('Upload file: navigate to Resolve Errors (Logic) after upload', async () => { | ||
await uploadFile({ | ||
testUsed: test, | ||
pageUsed: page, | ||
newUpload: true, | ||
testTitle: | ||
'Upload file: upload small file with only warnings (logic-errors_medium.csv)', | ||
filePath: | ||
'../test-data/sample-sblar-files/logic-errors_single&multi_and_warnings.csv', | ||
resultMessage: ResultUploadMessage.logic, | ||
}); | ||
|
||
await test.step('Verify Resolve Errors (syntax) and zero errors', async () => { | ||
await page.getByRole('button', { name: 'Continue to next step' }).click(); | ||
await expect(page.locator('h1')).toContainText( | ||
'Resolve errors (syntax)', | ||
{ | ||
timeout: 30_000, | ||
}, | ||
); | ||
await expect( | ||
page.getByText('Your register contains no syntax errors'), | ||
).toBeVisible({ timeout: 40_000 }); | ||
}); | ||
|
||
await test.step('Verify Resolve Errors (logic) and number of errors', async () => { | ||
await page.getByRole('button', { name: 'Continue' }).click(); | ||
await expect(page.locator('h1')).toContainText('Resolve errors (logic)', { | ||
timeout: 30_000, | ||
}); | ||
await expect(page.locator('#error-header-alert')).toContainText( | ||
'Your register contains logic errors', | ||
); | ||
await expect(page.locator('#single-field-errors')).toContainText( | ||
'Single-field errors: 1 found', | ||
); | ||
await expect(page.locator('#register-level-errors')).toContainText( | ||
'Register-level errors: 2 found', | ||
); | ||
await expect(page.locator('#multi-field-errors')).toContainText( | ||
'Multi-field errors: 52 found', | ||
); | ||
}); | ||
|
||
await verifyDownloadableReport({ testUsed: test, pageUsed: page }); | ||
}); | ||
}); |
43 changes: 43 additions & 0 deletions
43
e2e/pages/filing-app/uploadFile/completeUploadSyntaxErrors.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,43 @@ | ||
import { expect } from '@playwright/test'; | ||
import { test } from '../../../fixtures/testFixture'; | ||
import { ResultUploadMessage, uploadFile } from '../../../utils/uploadFile'; | ||
import { verifyDownloadableReport } from '../../../utils/verifyDownloadableReport'; | ||
|
||
test('Resolve Errors (Syntax)', async ({ page, navigateToUploadFile }) => { | ||
test.slow(); | ||
|
||
navigateToUploadFile; | ||
|
||
await test.step('Upload file: navigate to Resolve Errors (syntax) after upload', async () => { | ||
await uploadFile({ | ||
testUsed: test, | ||
pageUsed: page, | ||
newUpload: true, | ||
testTitle: | ||
'Upload file: upload small file with only warnings (all_syntax_errors.csv)', | ||
filePath: '../test-data/sample-sblar-files/all_syntax_errors.csv', | ||
resultMessage: ResultUploadMessage.syntax, | ||
}); | ||
|
||
await test.step('Verify Resolve Errors (syntax) and number of errors', async () => { | ||
await page.getByRole('button', { name: 'Continue to next step' }).click(); | ||
await expect(page.locator('h1')).toContainText( | ||
'Resolve errors (syntax)', | ||
{ | ||
timeout: 30_000, | ||
}, | ||
); | ||
await expect(page.locator('#error-header-alert')).toBeVisible({ | ||
timeout: 30_000, | ||
}); | ||
await expect(page.locator('h2')).toContainText( | ||
'Single-field errors: 136 found', | ||
{ | ||
timeout: 20_000, | ||
}, | ||
); | ||
}); | ||
|
||
await verifyDownloadableReport({ testUsed: test, pageUsed: page }); | ||
}); | ||
}); |
Oops, something went wrong.