Skip to content

Commit

Permalink
Merge branch 'staging' of https://github.com/ustaxcourt/ef-cms into 1…
Browse files Browse the repository at this point in the history
…0339-story
  • Loading branch information
nechama-krigsman committed Sep 11, 2024
2 parents d3805d5 + 291d265 commit 1049f50
Show file tree
Hide file tree
Showing 64 changed files with 1,090 additions and 510 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module.exports = {
'no-underscore-dangle': 'off',
'promise/always-return': 'off',
'promise/catch-or-return': 'off',
'promise/no-nesting': 'off',
},
},
{
Expand Down
30 changes: 26 additions & 4 deletions cypress/helpers/fileAPetition/create-and-serve-paper-petition.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
import { ProcedureType } from '../../../shared/src/business/entities/EntityConstants';
import { loginAsPetitionsClerk1 } from '../authentication/login-as-helpers';

export function createAndServePaperPetition(
options = { yearReceived: '2020' },
) {
{
procedureType = 'Regular',
trialLocation = 'Birmingham, Alabama',
yearReceived = '2020',
}: Partial<{
yearReceived: string;
procedureType: ProcedureType;
trialLocation: string;
}> = {
procedureType: 'Regular',
trialLocation: 'Birmingham, Alabama',
yearReceived: '2020',
},
): Cypress.Chainable<{
docketNumber: string;
documentsCreated: {
eventCode: string;
index: number;
servedTo: string;
}[];
name: string;
}> {
const name = 'rick james ' + Date.now();
loginAsPetitionsClerk1();
cy.get('[data-testid="inbox-tab-content"]').should('exist');
Expand All @@ -22,10 +43,11 @@ export function createAndServePaperPetition(
cy.get('[data-testid="phone"]').type('n/a');
cy.get('#tab-case-info > .button-text').click();
cy.get('#date-received-picker').clear();
cy.get('#date-received-picker').type(`01/02/${options.yearReceived}`);
cy.get('#date-received-picker').type(`01/02/${yearReceived}`);
cy.get('#mailing-date').clear();
cy.get('#mailing-date').type('01/02/2019');
cy.get('[data-testid="preferred-trial-city"]').select('Birmingham, Alabama');
cy.get(`[data-testid="procedure-type-${procedureType}-radio"]`).click();
cy.get('[data-testid="preferred-trial-city"]').select(trialLocation);
cy.get(
':nth-child(9) > .usa-fieldset > :nth-child(3) > .usa-radio__label',
).click();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PROCEDURE_TYPES_MAP } from '../../../shared/src/business/entities/EntityConstants';
import { uploadFile } from '../file/upload-file';

export function petitionerCreatesElectronicCaseUpdated(
Expand Down Expand Up @@ -26,8 +27,9 @@ export function petitionerCreatesElectronicCaseUpdated(
cy.get('[data-testid="redaction-acknowledgement-label"]').click();
cy.get('[data-testid="step-3-next-button"]').click();

cy.get('[data-testid="procedure-type-1"]').click();
cy.get('[data-testid="procedure-type-0"]').click();
cy.get(
`[data-testid="procedure-type-${PROCEDURE_TYPES_MAP.regular}-radio"]`,
).click();
cy.get('[data-testid="preferred-trial-city"]').select('Mobile, Alabama');
cy.get('[data-testid="step-4-next-button"]').click();

Expand Down Expand Up @@ -119,8 +121,9 @@ export function petitionerAttemptsToUploadCorruptPdfUpdated() {
cy.get('[data-testid="redaction-acknowledgement-label"]').click();
cy.get('[data-testid="step-3-next-button"]').click();

cy.get('[data-testid="procedure-type-1"]').click();
cy.get('[data-testid="procedure-type-0"]').click();
cy.get(
`[data-testid="procedure-type-${PROCEDURE_TYPES_MAP.regular}-radio"]`,
).click();
cy.get('[data-testid="preferred-trial-city"]').select('Mobile, Alabama');
cy.get('[data-testid="step-4-next-button"]').click();

Expand Down Expand Up @@ -170,8 +173,9 @@ export function petitionerCreatesElectronicCaseWithSpouseUpdated(
cy.get('[data-testid="redaction-acknowledgement-label"]').click();
cy.get('[data-testid="step-3-next-button"]').click();

cy.get('[data-testid="procedure-type-1"]').click();
cy.get('[data-testid="procedure-type-0"]').click();
cy.get(
`[data-testid="procedure-type-${PROCEDURE_TYPES_MAP.regular}-radio"]`,
).click();
cy.get('[data-testid="preferred-trial-city"]').select('Mobile, Alabama');
cy.get('[data-testid="step-4-next-button"]').click();

Expand Down Expand Up @@ -221,8 +225,9 @@ export function petitionerCreatesElectronicCaseWithDeceasedSpouseUpdated(
cy.get('[data-testid="redaction-acknowledgement-label"]').click();
cy.get('[data-testid="step-3-next-button"]').click();

cy.get('[data-testid="procedure-type-1"]').click();
cy.get('[data-testid="procedure-type-0"]').click();
cy.get(
`[data-testid="procedure-type-${PROCEDURE_TYPES_MAP.regular}-radio"]`,
).click();
cy.get('[data-testid="preferred-trial-city"]').select('Mobile, Alabama');
cy.get('[data-testid="step-4-next-button"]').click();

Expand Down
31 changes: 19 additions & 12 deletions cypress/helpers/fileAPetition/petitioner-creates-electronic-case.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PROCEDURE_TYPES_MAP } from '../../../shared/src/business/entities/EntityConstants';
import {
petitionerAttemptsToUploadCorruptPdfUpdated,
petitionerCreatesElectronicCaseForBusinessUpdated,
Expand Down Expand Up @@ -31,8 +32,9 @@ export function petitionerCreatesElectronicCaseWithDeceasedSpouseOld(
cy.get('[data-testid="phone"]').type('1111111111');
cy.get('[data-testid="use-same-address-above-label"]').click();
cy.get('[data-testid="complete-step-3"]').click();
cy.get('[data-testid="procedure-type-1"]').click();
cy.get('[data-testid="procedure-type-0"]').click();
cy.get(
`[data-testid="procedure-type-${PROCEDURE_TYPES_MAP.regular}-radio"]`,
).click();
cy.get('[data-testid="preferred-trial-city"]').select('Mobile, Alabama');
cy.get('[data-testid="complete-step-4"]').click();
cy.get('[data-testid="file-petition"]').click();
Expand Down Expand Up @@ -111,8 +113,9 @@ export function petitionerCreatesElectronicCaseWithSpouseOld(
cy.get('[data-testid="phone"]').type('1111111111');
cy.get('[data-testid="use-same-address-above-label"]').click();
cy.get('[data-testid="complete-step-3"]').click();
cy.get('[data-testid="procedure-type-1"]').click();
cy.get('[data-testid="procedure-type-0"]').click();
cy.get(
`[data-testid="procedure-type-${PROCEDURE_TYPES_MAP.regular}-radio"]`,
).click();
cy.get('[data-testid="preferred-trial-city"]').select('Mobile, Alabama');
cy.get('[data-testid="complete-step-4"]').click();
cy.get('[data-testid="file-petition"]').click();
Expand Down Expand Up @@ -160,8 +163,9 @@ function petitionerCreatesElectronicCaseOld(primaryFilerName = 'John') {
cy.get('[data-testid="phone"]').type('1111111111');

cy.get('[data-testid="complete-step-3"]').click();
cy.get('[data-testid="procedure-type-1"]').click();
cy.get('[data-testid="procedure-type-0"]').click();
cy.get(
`[data-testid="procedure-type-${PROCEDURE_TYPES_MAP.regular}-radio"]`,
).click();
cy.get('[data-testid="preferred-trial-city"]').select('Mobile, Alabama');
cy.get('[data-testid="complete-step-4"]').click();

Expand Down Expand Up @@ -204,8 +208,9 @@ export function petitionerCreatesElectronicCaseForBusinessOld() {
uploadFile('corporate-disclosure-file');

cy.get('[data-testid="complete-step-3"]').click();
cy.get('[data-testid="procedure-type-1"]').click();
cy.get('[data-testid="procedure-type-0"]').click();
cy.get(
`[data-testid="procedure-type-${PROCEDURE_TYPES_MAP.regular}-radio"]`,
).click();
cy.get('[data-testid="preferred-trial-city"]').select('Mobile, Alabama');
cy.get('[data-testid="complete-step-4"]').click();

Expand Down Expand Up @@ -259,8 +264,9 @@ export function privatePractitionerCreatesElectronicCaseForBusiness() {
uploadFile('corporate-disclosure-file');

cy.get('[data-testid="complete-step-3"]').click();
cy.get('[data-testid="procedure-type-1"]').click();
cy.get('[data-testid="procedure-type-0"]').click();
cy.get(
`[data-testid="procedure-type-${PROCEDURE_TYPES_MAP.regular}-radio"]`,
).click();
cy.get('[data-testid="preferred-trial-city"]').select('Mobile, Alabama');
cy.get('[data-testid="complete-step-4"]').click();

Expand Down Expand Up @@ -313,8 +319,9 @@ export function petitionerAttemptsToUploadCorruptPdfOld() {
cy.get('[data-testid="phone"]').type('1111111111');

cy.get('[data-testid="complete-step-3"]').click();
cy.get('[data-testid="procedure-type-1"]').click();
cy.get('[data-testid="procedure-type-0"]').click();
cy.get(
`[data-testid="procedure-type-${PROCEDURE_TYPES_MAP.regular}-radio"]`,
).click();
cy.get('[data-testid="preferred-trial-city"]').select('Mobile, Alabama');
cy.get('[data-testid="complete-step-4"]').click();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PROCEDURE_TYPES_MAP } from '../../../shared/src/business/entities/EntityConstants';
import { petitionerCreatesElectronicCaseUpdated } from './petitioner-creates-electronic-case-updated';
import { uploadFile } from '../file/upload-file';

Expand Down Expand Up @@ -32,8 +33,9 @@ export function practitionerCreatesElectronicCaseOld() {
cy.get('[data-testid="phone"]').type('1111111111');
cy.get('[data-testid="use-same-address-above-label"]').click();
cy.get('[data-testid="complete-step-3"]').click();
cy.get('[data-testid="procedure-type-1"]').click();
cy.get('[data-testid="procedure-type-0"]').click();
cy.get(
`[data-testid="procedure-type-${PROCEDURE_TYPES_MAP.regular}-radio"]`,
).click();
cy.get('[data-testid="preferred-trial-city"]').select('Mobile, Alabama');
cy.get('[data-testid="complete-step-4"]').click();
cy.get('[data-testid="file-petition"]').click();
Expand Down
5 changes: 4 additions & 1 deletion cypress/local-only/support/pages/create-paper-petition.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PROCEDURE_TYPES_MAP } from '../../../../shared/src/business/entities/EntityConstants';
import { faker } from '@faker-js/faker';
import {
getCreateACaseButton,
Expand Down Expand Up @@ -54,7 +55,9 @@ export const fillInCreateCaseFromPaperForm = (testData?: {

cy.get('input#date-received-picker').type('01/01/2020');
cy.get('#mailing-date').type('01/01/2020');
cy.get('#procedure-type-0').click();
cy.get(
`[data-testid="procedure-type-${PROCEDURE_TYPES_MAP.regular}-radio"]`,
).click();
cy.get('#preferred-trial-city').scrollIntoView();
cy.get('#preferred-trial-city').select('Birmingham, Alabama');
cy.get('label[for="payment-status-paid"]').click();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PROCEDURE_TYPES_MAP } from '../../../../../shared/src/business/entities/EntityConstants';
import { checkA11y } from '../../../support/generalCommands/checkA11y';
import { loginAsPetitioner } from '../../../../helpers/authentication/login-as-helpers';

Expand Down Expand Up @@ -262,7 +263,9 @@ describe('File a Petition Page - Petitioner Accessibility', () => {
loginAsPetitioner();
cy.visit('/file-a-petition-pa11y/step-4');
cy.get('[data-testid="complete-step-4"]').should('exist');
cy.get('#procedure-type-0').click();
cy.get(
`[data-testid="procedure-type-${PROCEDURE_TYPES_MAP.regular}-radio"]`,
).click();
cy.get('#preferred-trial-city').should('exist');

checkA11y();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PROCEDURE_TYPES_MAP } from '../../../../../shared/src/business/entities/EntityConstants';
import { checkA11y } from '../../../support/generalCommands/checkA11y';
import {
fillIrsNoticeInformation,
Expand All @@ -22,7 +23,9 @@ describe('Petition generation - step 4', () => {
});

it('Small Case: should be free of a11y issues', () => {
cy.get('[data-testid="procedure-type-1"]').click();
cy.get(
`[data-testid="procedure-type-${PROCEDURE_TYPES_MAP.small}-radio"]`,
).click();
checkA11y();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import {
CASE_STATUS_TYPES,
PROCEDURE_TYPES_MAP,
} from '../../../../../shared/src/business/entities/EntityConstants';
import {
FORMATS,
formatNow,
} from '../../../../../shared/src/business/utilities/DateHandler';
import { createAndServePaperPetition } from '../../../../helpers/fileAPetition/create-and-serve-paper-petition';
import { goToCase } from '../../../../helpers/caseDetail/go-to-case';
import { loginAsColvin } from '../../../../helpers/authentication/login-as-helpers';
import { retry } from '../../../../helpers/retry';

describe('Blocked Cases Report', () => {
beforeEach(() => {
cy.task('deleteAllFilesInFolder', 'cypress/downloads');
});

it('should show a blocked case in the blocked cases report and the downloaded csv report', () => {
const trialLocation = 'Portland, Maine';
const [trialCity, trialState] = trialLocation.split(', ');
const procedureType = PROCEDURE_TYPES_MAP.small;
createAndServePaperPetition({
procedureType,
trialLocation,
}).then(({ docketNumber }) => {
//block case
loginAsColvin();
goToCase(docketNumber);
cy.get('[data-testid="tab-case-information"]').click();
cy.get('[data-testid="add-manual-block-button"]').click();
cy.get('[data-testid="blocked-from-trial-reason-textarea"]').type(
'This case cannot go to trial.',
);
cy.get('[data-testid="modal-button-confirm"]').click();
cy.get('[data-testid="success-alert"]').contains(
'Case blocked from being set for trial.',
);

//View report
cy.get('[data-testid="dropdown-select-report"]').click();
cy.get('[data-testid="blocked-cases-report"]').click();

function checkIfOpensearchHasIndexedBlockedCase() {
cy.reload();
cy.get('[data-testid="trial-location-filter"]').select(trialLocation);
cy.get('[data-testid="procedure-type-filter"]').select(procedureType);
cy.get('[data-testid="case-status-filter"]').select(
CASE_STATUS_TYPES.generalDocket,
);
cy.get('[data-testid="blocked-reason-filter"]').select('Manual Block');
const selector = `[data-testid="blocked-case-${docketNumber}-row"]`;
return cy.get(selector).then(elements => elements.length > 0);
}

retry(checkIfOpensearchHasIndexedBlockedCase);

cy.get('[data-testid="blocked-cases-count"]').should('exist');

//download csv
cy.get('[data-testid="export-blocked-case-report"]').click();
const today = formatNow(FORMATS.MMDDYYYY_UNDERSCORED);
const fileName = `Blocked Cases Report - ${trialCity}_${trialState} ${today}.csv`;
cy.readFile(`cypress/downloads/${fileName}`, 'utf-8').should(
fileContent => {
expect(fileContent).to.include(docketNumber);
},
);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
fillPetitionerInformation,
selectInput,
} from './petition-helper';
import { PROCEDURE_TYPES_MAP } from '../../../../../shared/src/business/entities/EntityConstants';
import { loginAsPetitioner } from '../../../../helpers/authentication/login-as-helpers';

describe('File a petition - Step 4 Case Procedure & Trial Location', () => {
Expand All @@ -20,21 +21,20 @@ describe('File a petition - Step 4 Case Procedure & Trial Location', () => {
});

it('should display all the possible options', () => {
const EXPECTED_CASE_PROCEDURES: string[] = ['Regular case', 'Small case'];
cy.get('[data-testid^="procedure-type-"]').should('have.length', 2);

EXPECTED_CASE_PROCEDURES.forEach((option: string, index: number) => {
cy.get(`[data-testid="procedure-type-${index}"]`).should('exist');
cy.get(`[data-testid="procedure-type-${index}"]`).should(
'have.text',
option,
);
});
cy.get(
`[data-testid="procedure-type-${PROCEDURE_TYPES_MAP.regular}-radio"]`,
).should('have.text', 'Regular case');
cy.get(
`[data-testid="procedure-type-${PROCEDURE_TYPES_MAP.small}-radio"]`,
).should('have.text', 'Small case');
});

describe('Regular case', () => {
beforeEach(() => {
cy.get('[data-testid="procedure-type-0"]').click();
cy.get(
`[data-testid="procedure-type-${PROCEDURE_TYPES_MAP.regular}-radio"]`,
).click();
});

it('should display validation error message when user presses "Next" button without selecting a trial location', () => {
Expand Down Expand Up @@ -100,7 +100,9 @@ describe('File a petition - Step 4 Case Procedure & Trial Location', () => {

describe('Small case', () => {
beforeEach(() => {
cy.get('[data-testid="procedure-type-1"]').click();
cy.get(
`[data-testid="procedure-type-${PROCEDURE_TYPES_MAP.small}-radio"]`,
).click();
});

it('should display validation error message when user presses "Next" button without selecting a trial location', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PROCEDURE_TYPES_MAP } from '../../../../../shared/src/business/entities/EntityConstants';
import {
fillCaseProcedureInformation,
fillIrsNoticeInformation,
Expand Down Expand Up @@ -41,9 +42,12 @@ describe('File a petition - Step 6 Review & Submit Case', () => {
});

it('should display Case Procedure and Trial Location information correctly for small case', () => {
fillCaseProcedureInformation('small');
fillCaseProcedureInformation(PROCEDURE_TYPES_MAP.small);
fillStinInformation(VALID_FILE);
cy.get('[data-testid="procedure-type"]').should('have.text', 'Small');
cy.get('[data-testid="procedure-type"]').should(
'have.text',
PROCEDURE_TYPES_MAP.small,
);
cy.get('[data-testid="trial-location"]').should(
'have.text',
'Birmingham, Alabama',
Expand Down
Loading

0 comments on commit 1049f50

Please sign in to comment.