Skip to content

Commit

Permalink
10489: add cypress tests;
Browse files Browse the repository at this point in the history
  • Loading branch information
nechama-krigsman committed Nov 26, 2024
1 parent f766dcb commit 478463a
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import {
FORMATS,
formatNow,
} from '../../../../../shared/src/business/utilities/DateHandler';
import {
docketNumber,
getLastDraftOrderElementFromDrafts,
} from '../../../support/statusReportOrder';
import {
loginAsColvin,
loginAsDocketClerk,
} from '../../../../helpers/authentication/login-as-helpers';
import { logout } from '../../../../helpers/authentication/logout';

describe('should default status report order descriptions', () => {
const today = formatNow(FORMATS.MMDDYYYY);
it('should display default description when document type is an Order', () => {
judgeCreatesAndSavesStatusReportOrder(today);
loginAsDocketClerk();
cy.visit(`/case-detail/${docketNumber}`);
cy.get('#tab-drafts').click();
getLastDraftOrderElementFromDrafts().click();
cy.get('[data-testid="add-court-issued-docket-entry-button"]').click();
cy.get('.select-react-element__control').should('have.text', 'Order');
cy.get('[data-testid="document-description-input"]').should(
'have.value',
`Order parties by ${today} shall file a status report.`,
);
cy.get('[data-testid="docket-entry-preview-text"]').should(
'have.text',
`Docket entry preview: Order parties by ${today} shall file a status report.`,
);
});
it('should set event code to OJR when case is stricken from trial session and jurisdiction is retained and display default description', () => {
judgeCreatesAndSavesStatusReportOrder(today, true);
loginAsDocketClerk();
cy.visit(`/case-detail/${docketNumber}`);
cy.get('#tab-drafts').click();
getLastDraftOrderElementFromDrafts().click();
cy.get('[data-testid="add-court-issued-docket-entry-button"]').click();
cy.get('.select-react-element__control').should(
'have.text',
'Order that jurisdiction is retained',
);
cy.get('[data-testid="document-description-input"]').should(
'have.value',
`. Parties by ${today} shall file a status report. Case is stricken from the current trial session.`,
);
cy.get('#judge-label').click();
cy.get('[data-testid="docket-entry-preview-text"]').should(
'have.text',
`Docket entry preview: Order that jurisdiction is retained by Colvin. Parties by ${today} shall file a status report. Case is stricken from the current trial session.`,
);
});
});

function judgeCreatesAndSavesStatusReportOrder(
today: string,
jurisdictionRetain: boolean = false,
) {
loginAsColvin();
cy.visit(`/case-detail/${docketNumber}`);
cy.get('#tab-document-view').click();
cy.contains('Status Report').click();
cy.get('[data-testid="status-report-order-button"]').click();
cy.get('[data-testid="order-type-status-report"]').check({ force: true });
cy.get('#status-report-due-date-picker').type(today);

if (jurisdictionRetain) {
cy.get('#stricken-from-trial-sessions-label').click();

cy.get(
'#jurisdiction-form-group > :nth-child(2) > .usa-radio__label',
).click();
cy.get('#jurisdiction-retained').check();
}
cy.get('[data-testid="save-draft-button"]').click();
cy.get('[data-testid="sign-pdf-canvas"]').click();
cy.get('[data-testid="save-signature-button"]').click();
logout();
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ export const CourtIssuedDocketEntry = connect(
</div>
<div className="grid-col-7">
<div className="display-flex flex-row flex-justify flex-align-center">
<div className="margin-top-1 margin-bottom-1 docket-entry-preview-text">
<div
className="margin-top-1 margin-bottom-1 docket-entry-preview-text"
data-testid="docket-entry-preview-text"
>
<span className="text-bold">Docket entry preview: </span>
{addCourtIssuedDocketEntryHelper.formattedDocumentTitle}
</div>
Expand Down
1 change: 1 addition & 0 deletions web-client/src/views/StatusReportOrder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export const StatusReportOrder = connect(
.statusReport
}
className="usa-radio__input"
data-testid="order-type-status-report"
id="order-type-status-report"
name="orderType"
type="radio"
Expand Down

0 comments on commit 478463a

Please sign in to comment.