Skip to content

Commit

Permalink
10455-story: adding validation to ScanBatchPreview uploader and updat…
Browse files Browse the repository at this point in the history
…ing tests
  • Loading branch information
Mwindo committed Sep 5, 2024
1 parent d264534 commit f268df6
Show file tree
Hide file tree
Showing 28 changed files with 163 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export function createAndServePaperFiling(
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#primaryDocumentFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});

cy.get('[data-testid="save-and-serve"]').click();
Expand Down
8 changes: 4 additions & 4 deletions cypress/helpers/file/upload-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ export function uploadFile(testId: string) {
}

export function attachFile({
awaitSuccess = true,
filePath,
selector,
selectorToAwaitOnSuccess = '[data-testid^="upload-file-success"]',
}: {
selector: string;
filePath: string;
awaitSuccess?: boolean;
selectorToAwaitOnSuccess?: string;
}) {
cy.get(selector).attachFile(filePath);
if (awaitSuccess) {
cy.get('[data-testid^="upload-file-success"]').should('exist');
if (selectorToAwaitOnSuccess) {
cy.get(selectorToAwaitOnSuccess).should('exist');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export function createAndServePaperPetitionMultipleParties(
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: '#petitionFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
cy.get('#tabButton-requestForPlaceOfTrialFile > .button-text').click();
cy.get('#scan-mode-radios').click();
Expand All @@ -70,6 +71,7 @@ export function createAndServePaperPetitionMultipleParties(
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: '#requestForPlaceOfTrialFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
cy.get('[data-testid="submit-paper-petition"]').click();
return cy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function createAndServePaperPetition(
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: '#petitionFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
cy.get('#tabButton-requestForPlaceOfTrialFile > .button-text').click();
cy.get('#scan-mode-radios').click();
Expand All @@ -55,20 +56,23 @@ export function createAndServePaperPetition(
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: '#requestForPlaceOfTrialFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});

cy.get('[data-testid="tabButton-stinFile"]').click();
cy.get('[data-testid="upload-pdf-button"]').click();
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#stinFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});

cy.get('[data-testid="tabButton-attachmentToPetitionFile"]').click();
cy.get('[data-testid="upload-pdf-button"]').click();
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#attachmentToPetitionFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
cy.get('[data-testid="remove-pdf"]');

Expand All @@ -77,6 +81,7 @@ export function createAndServePaperPetition(
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#corporateDisclosureFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});

cy.get(
Expand All @@ -86,6 +91,7 @@ export function createAndServePaperPetition(
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#applicationForWaiverOfFilingFeeFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});

cy.get('[data-testid="submit-paper-petition"]').click();
Expand Down Expand Up @@ -191,20 +197,23 @@ export function createAndServePaperPetitionMyselfAndSpouse() {
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: '#petitionFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});

cy.get('#tabButton-requestForPlaceOfTrialFile > .button-text').click();
cy.get('#upload-mode-upload').click();
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: '#requestForPlaceOfTrialFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});

cy.get('[data-testid="tabButton-stinFile"]').click();
cy.get('[data-testid="upload-pdf-button"]').click();
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#stinFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});

cy.get('[data-testid="submit-paper-petition"]').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ export function petitionerAttemptsToUploadCorruptPdfUpdated() {
cy.get('[data-testid="step-4-next-button"]').click();

attachFile({
awaitSuccess: false,
filePath: '../../helpers/file/corrupt-pdf.pdf',
selector: '[data-testid="stin-file"]',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ export function petitionerAttemptsToUploadCorruptPdfOld() {
cy.get('[data-testid="file-a-petition"]').click();
cy.get('[data-testid="go-to-step-1"]').click();
attachFile({
awaitSuccess: false,
filePath: '../../helpers/file/corrupt-pdf.pdf',
selector: '[data-testid="stin-file"]',
});
Expand Down
4 changes: 4 additions & 0 deletions cypress/local-only/support/pages/create-paper-petition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const fillInCreateCaseFromPaperForm = (testData?: {
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#petitionFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
cy.get('[data-testid="remove-pdf"]');

Expand All @@ -101,6 +102,7 @@ export const fillInCreateCaseFromPaperForm = (testData?: {
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#stinFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
cy.get('[data-testid="remove-pdf"]');

Expand All @@ -110,6 +112,7 @@ export const fillInCreateCaseFromPaperForm = (testData?: {
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#requestForPlaceOfTrialFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
cy.get('[data-testid="remove-pdf"]');
cy.get('[data-testid="icon-requestForPlaceOfTrialFile"]').should(
Expand All @@ -122,6 +125,7 @@ export const fillInCreateCaseFromPaperForm = (testData?: {
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#attachmentToPetitionFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});

cy.get('[data-testid="remove-pdf"]');
Expand Down
1 change: 1 addition & 0 deletions cypress/local-only/support/pages/document-qc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const uploadCourtIssuedDocumentAndEditViaDocumentQC = () => {
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#primary-document-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
cy.get('[data-testid="upload-file-success"]');
cy.get('#save-uploaded-pdf-button').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ describe('Docket clerk views consolidated case', function () {
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#primaryDocumentFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
cy.get('[data-testid="remove-pdf"]');
cy.get('button#upload-correspondence').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ describe('Judge`s chambers stamps an order', () => {
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#primaryDocumentFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
cy.get('[data-testid="remove-pdf"]');
cy.get('[data-testid="save-and-serve"]').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe('Filing an Answer', function () {
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: '#primary-document',
selectorToAwaitOnSuccess: '[data-testid^="upload-file-success"]',
});
cy.get('label#primary-document-label').should('have.class', 'validated');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe(
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: '[data-testid="primary-document"]',
selectorToAwaitOnSuccess: '[data-testid^="upload-file-success"]',
});
cy.get('[data-testid=primaryDocument-objections-No]').click();
cy.get('#submit-document').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ describe('Private Practitioner requests to represent a party to a case', () => {
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#primaryDocumentFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});

cy.get('[data-testid="save-for-later"]').click();
Expand Down Expand Up @@ -100,6 +101,7 @@ describe('Petitioner files motion to lift stay of proceedings', () => {
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: '[data-testid="primary-document"]',
selectorToAwaitOnSuccess: '[data-testid^="upload-file-success"]',
});
cy.get('[data-testid=primaryDocument-objections-No]').click();
cy.get('#submit-document').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ describe('Docket clerk QC-ing a paper filing', () => {
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#primaryDocumentFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});

cy.get('[data-testid="save-for-later"]').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ describe('File a Petition', () => {
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#stin-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
cy.get('label#stin-file-label').should('have.class', 'validated');
});
Expand All @@ -82,6 +83,7 @@ describe('File a Petition', () => {
attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#petition-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});

cy.get('label#petition-file-label').should('have.class', 'validated');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ describe('File a petition - Corrupted Files', () => {

cy.get('[data-testid="upload-a-petition-label"').click();
attachFile({
awaitSuccess: false,
filePath: CORRUPTED_FILE,
selector: '#petition-file',
});
Expand All @@ -38,7 +37,6 @@ describe('File a petition - Corrupted Files', () => {

cy.get('[data-testid="irs-notice-Yes"]').click();
attachFile({
awaitSuccess: false,
filePath: CORRUPTED_FILE,
selector: '[data-testid="irs-notice-upload-0"]',
});
Expand All @@ -57,7 +55,6 @@ describe('File a petition - Corrupted Files', () => {
fillCaseProcedureInformation();

attachFile({
awaitSuccess: false,
filePath: CORRUPTED_FILE,
selector: '[data-testid="stin-file"]',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
attachFile({
filePath: uploadFile,
selector: `[data-testid="${input}"]`,
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
}
});
Expand Down Expand Up @@ -190,6 +191,7 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
attachFile({
filePath: uploadFile,
selector: `[data-testid="${input}"]`,
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
}
});
Expand Down Expand Up @@ -285,6 +287,7 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
attachFile({
filePath: uploadFile,
selector: `[data-testid="${input}"]`,
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
}
});
Expand Down Expand Up @@ -349,6 +352,7 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
attachFile({
filePath: uploadFile,
selector: `[data-testid="${input}"]`,
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
attachFile({
filePath: uploadFile,
selector: `[data-testid="${input}"]`,
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
}
});
Expand Down Expand Up @@ -206,6 +207,7 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
attachFile({
filePath: uploadFile,
selector: `[data-testid="${input}"]`,
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
}
});
Expand Down Expand Up @@ -310,6 +312,7 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
attachFile({
filePath: uploadFile,
selector: `[data-testid="${input}"]`,
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
}
});
Expand Down Expand Up @@ -381,6 +384,7 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
attachFile({
filePath: uploadFile,
selector: `[data-testid="${input}"]`,
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
attachFile({
filePath: uploadFile,
selector: `[data-testid="${input}"]`,
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
}
});
Expand Down Expand Up @@ -201,6 +202,7 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
attachFile({
filePath: uploadFile,
selector: `[data-testid="${input}"]`,
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
}
});
Expand Down Expand Up @@ -302,6 +304,7 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
attachFile({
filePath: uploadFile,
selector: `[data-testid="${input}"]`,
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
}
});
Expand Down Expand Up @@ -371,6 +374,7 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
attachFile({
filePath: uploadFile,
selector: `[data-testid="${input}"]`,
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
attachFile({
filePath: uploadFile,
selector: `[data-testid="${input}"]`,
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
}
});
Expand Down Expand Up @@ -201,6 +202,7 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
attachFile({
filePath: uploadFile,
selector: `[data-testid="${input}"]`,
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
}
});
Expand Down Expand Up @@ -302,6 +304,7 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
attachFile({
filePath: uploadFile,
selector: `[data-testid="${input}"]`,
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
}
});
Expand Down Expand Up @@ -372,6 +375,7 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
attachFile({
filePath: uploadFile,
selector: `[data-testid="${input}"]`,
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
}
});
Expand Down
Loading

0 comments on commit f268df6

Please sign in to comment.