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
…137-devex
  • Loading branch information
Absolutestunna committed Nov 23, 2023
2 parents dc7636e + 4ceaa7a commit 1ae6226
Show file tree
Hide file tree
Showing 56 changed files with 636 additions and 585 deletions.
81 changes: 81 additions & 0 deletions cypress/cypress-integration/integration/judges-notes-icon.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import {
createMessage,
enterSubject,
fillOutMessageField,
selectChambers,
selectRecipient,
selectSection,
sendMessage,
} from '../support/pages/document-qc';
import { fillInCreateCaseFromPaperForm } from '../support/pages/create-paper-petition';

import {
getCreateACaseButton,
navigateTo as navigateToDocumentQC,
} from '../support/pages/document-qc';

describe('Notes Icon triggered by Judges Notes', () => {
let newDocketNumber: string;
beforeEach(() => {
navigateToDocumentQC('petitionsclerk');

getCreateACaseButton().click();
cy.get('#tab-parties').parent().should('have.attr', 'aria-selected');

fillInCreateCaseFromPaperForm();

cy.intercept('POST', '**/paper').as('postPaperCase');
cy.get('#submit-case').click();

cy.wait('@postPaperCase').then(({ response }) => {
if (!response || !response.body?.docketNumber) {
throw new Error(
'Unable to get Docket Number from postPaperCase HTTP request',
);
}
newDocketNumber = response.body?.docketNumber;
});
});

it('should display the notes icon when logged in as a judge user and there are judges notes on the case we navigated to using the messages link', () => {
cy.login('judgecolvin', `/case-detail/${newDocketNumber}`);
cy.get('[data-testid="tab-notes"]').click();
cy.get('[data-testid="add-case-judge-notes-button"]').click();
cy.get('[data-testid="case-notes"]').type('SOME RANDOM NOTES');
cy.get('#confirm').click();

cy.login('docketclerk', `/case-detail/${newDocketNumber}`);
createMessage();
selectSection('Chambers');
selectChambers('colvinsChambers');
selectRecipient('Judge Colvin');
enterSubject();
fillOutMessageField();
sendMessage();

cy.login('judgecolvin');
cy.get('[data-testid="message-header-link"]').first().click();
cy.get('[data-testid="notes-icon"]').should('exist');
});

it('should display the notes icon when logged in as a chambers user and there are judges notes on the case we navigated to using the messages link', () => {
cy.login('judgecolvin', `/case-detail/${newDocketNumber}`);
cy.get('[data-testid="tab-notes"]').click();
cy.get('[data-testid="add-case-judge-notes-button"]').click();
cy.get('[data-testid="case-notes"]').type('SOME RANDOM NOTES');
cy.get('#confirm').click();

cy.login('docketclerk', `/case-detail/${newDocketNumber}`);
createMessage();
selectSection('Chambers');
selectChambers('colvinsChambers');
selectRecipient("Test Colvin's Chambers");
enterSubject();
fillOutMessageField();
sendMessage();

cy.login('colvinschambers');
cy.get('[data-testid="message-header-link"]').first().click();
cy.get('[data-testid="notes-icon"]').should('exist');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import {
createMessage,
enterSubject,
fillOutMessageField,
selectChambers,
selectRecipient,
selectSection,
sendMessage,
} from '../support/pages/document-qc';

describe('Message Count', () => {
it("should display the message count on the Judge's dashboard", () => {
cy.login('docketclerk', '/case-detail/103-20');
createMessage();
selectSection('Chambers');
selectChambers('colvinsChambers');
selectRecipient('Judge Colvin');
enterSubject();
fillOutMessageField();
sendMessage();

cy.login('judgecolvin');
cy.get('[data-testid="header-message-count"]').should('exist');
});

it("should display the message count on the Chamber's dashboard", () => {
cy.login('docketclerk', '/case-detail/103-20');
createMessage();
selectSection('Chambers');
selectChambers('colvinsChambers');
selectRecipient("Test Colvin's Chambers");
enterSubject();
fillOutMessageField();
sendMessage();

cy.login('colvinschambers');
cy.get('[data-testid="header-message-count"]').should('exist');
});
});
8 changes: 6 additions & 2 deletions cypress/cypress-integration/support/pages/document-qc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ export const openCompleteAndSendMessageDialog = () => {
cy.get('button#save-and-add-supporting').click();
};

export const selectSection = section => {
export const selectSection = (section: string) => {
cy.get('#toSection').scrollIntoView().select(section);
};

export const selectRecipient = recipient => {
export const selectChambers = (chamber: string) => {
cy.get('#chambers').scrollIntoView().select(chamber);
};

export const selectRecipient = (recipient: string) => {
cy.get('#toUserId').scrollIntoView().select(recipient);
};

Expand Down
52 changes: 37 additions & 15 deletions shared/src/business/entities/cases/CaseExternal.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {
CASE_TYPES_MAP,
MAX_FILE_SIZE_BYTES,
MAX_FILE_SIZE_MB,
PARTY_TYPES,
} from '../EntityConstants';
import { CaseExternal } from './CaseExternal';
import { applicationContext } from '../../test/createTestApplicationContext';

const { VALIDATION_ERROR_MESSAGES } = CaseExternal;

describe('CaseExternal entity', () => {
describe('isValid', () => {
it('requires corporate disclosure if filing type is a business', () => {
Expand All @@ -22,10 +21,12 @@ describe('CaseExternal entity', () => {
},
{ applicationContext },
);

expect(
caseExternal.getFormattedValidationErrors()!.corporateDisclosureFile,
).toEqual(VALIDATION_ERROR_MESSAGES.corporateDisclosureFile);
).toEqual('Upload a Corporate Disclosure Statement');
});

it('does not require corporate disclosure if filing type not set', () => {
const petition = new CaseExternal(
{
Expand All @@ -36,10 +37,12 @@ describe('CaseExternal entity', () => {
},
{ applicationContext },
);

expect(
petition.getFormattedValidationErrors()!.corporateDisclosureFile,
).toBeUndefined();
});

it('does not require corporate disclosure if filing type not a business', () => {
const caseExternal = new CaseExternal(
{
Expand All @@ -51,10 +54,12 @@ describe('CaseExternal entity', () => {
},
{ applicationContext },
);

expect(
caseExternal.getFormattedValidationErrors()!.corporateDisclosureFile,
).toBeUndefined();
});

it('requires stinFile', () => {
const caseExternal = new CaseExternal(
{
Expand All @@ -67,8 +72,9 @@ describe('CaseExternal entity', () => {
},
{ applicationContext },
);

expect(caseExternal.getFormattedValidationErrors()!.stinFile).toEqual(
VALIDATION_ERROR_MESSAGES.stinFile,
'Upload a Statement of Taxpayer Identification Number (STIN)',
);
});
});
Expand All @@ -88,9 +94,12 @@ describe('CaseExternal entity', () => {
},
{ applicationContext },
);

expect(
caseExternal.getFormattedValidationErrors()!.petitionFileSize,
).toEqual(VALIDATION_ERROR_MESSAGES.petitionFileSize[0].message);
).toEqual(
`Your Petition file size is too big. The maximum file size is ${MAX_FILE_SIZE_MB}MB.`,
);
});

it('should inform you if petition file size is zero', () => {
Expand All @@ -107,9 +116,10 @@ describe('CaseExternal entity', () => {
},
{ applicationContext },
);

expect(
caseExternal.getFormattedValidationErrors()!.petitionFileSize,
).toEqual(VALIDATION_ERROR_MESSAGES.petitionFileSize[1]);
).toEqual('Your Petition file size is empty');
});

it('should not error on petitionFileSize when petitionFile is undefined', () => {
Expand All @@ -124,6 +134,7 @@ describe('CaseExternal entity', () => {
},
{ applicationContext },
);

expect(
caseExternal.getFormattedValidationErrors()!.petitionFileSize,
).toBeUndefined();
Expand All @@ -142,9 +153,10 @@ describe('CaseExternal entity', () => {
},
{ applicationContext },
);

expect(
caseExternal.getFormattedValidationErrors()!.petitionFileSize,
).toEqual(VALIDATION_ERROR_MESSAGES.petitionFileSize[1]);
).toEqual('Your Petition file size is empty');
});
});

Expand All @@ -163,8 +175,9 @@ describe('CaseExternal entity', () => {
},
{ applicationContext },
);

expect(caseExternal.getFormattedValidationErrors()!.stinFileSize).toEqual(
VALIDATION_ERROR_MESSAGES.stinFileSize[0].message,
`Your STIN file size is too big. The maximum file size is ${MAX_FILE_SIZE_MB}MB.`,
);
});

Expand All @@ -182,8 +195,9 @@ describe('CaseExternal entity', () => {
},
{ applicationContext },
);

expect(caseExternal.getFormattedValidationErrors()!.stinFileSize).toEqual(
VALIDATION_ERROR_MESSAGES.stinFileSize[1],
'Your STIN file size is empty',
);
});

Expand All @@ -199,12 +213,13 @@ describe('CaseExternal entity', () => {
},
{ applicationContext },
);

expect(
caseExternal.getFormattedValidationErrors()!.stinFileSize,
).toBeUndefined();
});

it('should error on stinFileSize when stinFile is defined', () => {
it('should error on stinFileSize when stinFile is undefined', () => {
const caseExternal = new CaseExternal(
{
caseType: CASE_TYPES_MAP.other,
Expand All @@ -214,11 +229,13 @@ describe('CaseExternal entity', () => {
preferredTrialCity: 'Memphis, Tennessee',
procedureType: 'Small',
stinFile: new File([], 'testStinFile.pdf'),
stinFileSize: undefined,
},
{ applicationContext },
);

expect(caseExternal.getFormattedValidationErrors()!.stinFileSize).toEqual(
VALIDATION_ERROR_MESSAGES.stinFileSize[1],
'Your STIN file size is empty',
);
});
});
Expand All @@ -238,11 +255,12 @@ describe('CaseExternal entity', () => {
},
{ applicationContext },
);

expect(
caseExternal.getFormattedValidationErrors()!
.corporateDisclosureFileSize,
).toEqual(
VALIDATION_ERROR_MESSAGES.corporateDisclosureFileSize[0].message,
`Your Corporate Disclosure Statement file size is too big. The maximum file size is ${MAX_FILE_SIZE_MB}MB.`,
);
});

Expand All @@ -260,10 +278,11 @@ describe('CaseExternal entity', () => {
},
{ applicationContext },
);

expect(
caseExternal.getFormattedValidationErrors()!
.corporateDisclosureFileSize,
).toEqual(VALIDATION_ERROR_MESSAGES.corporateDisclosureFileSize[1]);
).toEqual('Your Corporate Disclosure Statement file size is empty');
});

it('should not error on corporateDisclosureFileSize when corporateDisclosureFile is undefined', () => {
Expand All @@ -278,17 +297,19 @@ describe('CaseExternal entity', () => {
},
{ applicationContext },
);

expect(
caseExternal.getFormattedValidationErrors()!
.corporateDisclosureFileSize,
).toBeUndefined();
});

it('should error on corporateDisclosureFileSize when corporateDisclosureFile is defined', () => {
it('should error on corporateDisclosureFileSize when corporateDisclosureFile is undefined', () => {
const caseExternal = new CaseExternal(
{
caseType: CASE_TYPES_MAP.other,
corporateDisclosureFile: new File([], 'testStinFile.pdf'),
corporateDisclosureFileSize: undefined,
filingType: 'Myself',
hasIrsNotice: true,
partyType: PARTY_TYPES.nextFriendForMinor,
Expand All @@ -297,10 +318,11 @@ describe('CaseExternal entity', () => {
},
{ applicationContext },
);

expect(
caseExternal.getFormattedValidationErrors()!
.corporateDisclosureFileSize,
).toEqual(VALIDATION_ERROR_MESSAGES.corporateDisclosureFileSize[1]);
).toEqual('Your Corporate Disclosure Statement file size is empty');
});
});
});
Loading

0 comments on commit 1ae6226

Please sign in to comment.