Skip to content

Commit

Permalink
Merge branch 'staging' into 10285-design-debt
Browse files Browse the repository at this point in the history
  • Loading branch information
jimlerza authored Dec 6, 2024
2 parents bb44c92 + 71ac1e6 commit 5e035f5
Show file tree
Hide file tree
Showing 266 changed files with 540,284 additions and 4,485 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ module.exports = {
'rect',
'reindex',
'renderer',
'repo',
'rescan',
'restapi',
'riker',
Expand Down Expand Up @@ -440,6 +441,7 @@ module.exports = {
'wicg',
'workitem',
'workitems',
'xlsx',
'xpos',
'zendesk',
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { fillPaperFilingForm } from './fill-paper-filing-form';

export function createAndSaveForLaterPaperFiling({
dateReceived,
documentType,
}: {
documentType: string;
dateReceived: string;
}) {
fillPaperFilingForm({ dateReceived, documentType });

cy.get('[data-testid="save-for-later"]').click();
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
import { attachFile } from '../../../file/upload-file';
import { selectTypeaheadInput } from '../../../components/typeAhead/select-typeahead-input';
import { fillPaperFilingForm } from './fill-paper-filing-form';

export function createAndServePaperFiling(
documentType: string,
dateReceived: string,
) {
cy.get('[data-testid="case-detail-menu-button"]').click();
cy.get('[data-testid="menu-button-add-paper-filing"]').click();
cy.get(
'.usa-date-picker__wrapper > [data-testid="date-received-picker"]',
).type(dateReceived);
selectTypeaheadInput('primary-document-type-search', documentType);
cy.get('[data-testid="filed-by-option"]').click();
cy.get('[data-testid="objections-No"]').click();
cy.get('[data-testid="upload-pdf-button"]').click();

attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#primaryDocumentFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
export function createAndServePaperFiling({
dateReceived,
documentType,
isPaperCase = true,
}: {
documentType: string;
dateReceived: string;
isPaperCase?: boolean;
}) {
fillPaperFilingForm({ dateReceived, documentType });

cy.get('[data-testid="save-and-serve"]').click();
cy.get('[data-testid="modal-button-confirm"]').click();
cy.get('[data-testid="print-paper-service-done-button"]').click();
if (isPaperCase)
cy.get('[data-testid="print-paper-service-done-button"]').click();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { attachFile } from '../../../file/upload-file';
import { selectTypeaheadInput } from '../../../components/typeAhead/select-typeahead-input';

export function fillPaperFilingForm({
dateReceived,
documentType,
}: {
documentType: string;
dateReceived: string;
}) {
cy.get('[data-testid="case-detail-menu-button"]').click();
cy.get('[data-testid="menu-button-add-paper-filing"]').click();
cy.get(
'.usa-date-picker__wrapper > [data-testid="date-received-picker"]',
).type(dateReceived);
selectTypeaheadInput('primary-document-type-search', documentType);
cy.get('[data-testid="filed-by-option"]').click();
cy.get('[data-testid="objections-No"]').click();
cy.get('[data-testid="upload-pdf-button"]').click();

attachFile({
filePath: '../../helpers/file/sample.pdf',
selector: 'input#primaryDocumentFile-file',
selectorToAwaitOnSuccess: '[data-testid="remove-pdf"]',
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ export function createAndServePaperPetition(
];

expectedDocuments.forEach(({ eventCode, index, servedTo }) => {
cy.get(`[data-testid="docket-entry-index-${index}-eventCode"]`).should(
cy.get(`[data-testid="docket-entry-eventCode-${index}"]`).should(
'have.text',
eventCode,
);
cy.get(
`[data-testid="docket-entry-index-${index}-servedPartiesCode"]`,
`[data-testid="docket-entry-servedPartiesCode-${index}"]`,
).should('have.text', servedTo);
});

Expand Down
2 changes: 1 addition & 1 deletion cypress/helpers/retry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function retry(cb: () => Cypress.Chainable<boolean>, maxAttempts = 5) {
}
});
} else {
throw new Error('cypress failed to run a successful retry block');
throw new Error('cypress failed to successfully run a retry block');
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { checkA11y } from '../../../../support/generalCommands/checkA11y';

describe('Trial Sessions - Public Accessibility', () => {
beforeEach(() => {
Cypress.session.clearCurrentSessionData();
});

it('should be free of a11y issues', () => {
cy.visit('/trial-sessions');
checkA11y();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,25 @@ describe('Docket clerk views consolidated case', function () {
});

it('should persist the selected sort filter by navigating away from the tab', () => {
cy.get('select[name="docketRecordSort.111-19"]').should(
'have.value',
'byDate',
);
cy.get('select[name="docketRecordSort.111-19"]').select('Newest');
cy.get('[data-testid="descriptionDisplay-sortable-button"]')
.find('svg')
.invoke('attr', 'data-icon')
.should('equal', 'exchange-alt');

cy.get('[data-testid="descriptionDisplay-sortable-button"]').click();

cy.get('[data-testid="descriptionDisplay-sortable-button"]')
.find('svg')
.invoke('attr', 'data-icon')
.should('equal', 'long-arrow-alt-up');

cy.get('#tab-document-view').click();
cy.get('#tab-docket-sub-record').click();
cy.get('select[name="docketRecordSort.111-19"]').should(
'have.value',
'byDateDesc',
);

cy.get('[data-testid="descriptionDisplay-sortable-button"]')
.find('svg')
.invoke('attr', 'data-icon')
.should('equal', 'long-arrow-alt-up');
});

it('should persist the populated consolidated cases in the overview tab when petitioner counsel is added to parties', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ describe('Judge`s chambers stamps an order', () => {
createAndServePaperPetition().then(({ docketNumber }) => {
loginAsDocketClerk1();
goToCase(docketNumber);
createAndServePaperFiling('Motion to Proceed Remotely', '01/01/2022');
createAndServePaperFiling({
dateReceived: '01/01/2022',
documentType: 'Motion to Proceed Remotely',
});
cy.get(
'[data-testid="docket-record-table"] td:contains("Motion to Proceed Remotely")',
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ describe('Judge`s chambers stamps an order', () => {
createAndServePaperPetition().then(({ docketNumber }) => {
loginAsDocketClerk1();
goToCase(docketNumber);
createAndServePaperFiling('Motion to Proceed Remotely', '01/01/2022');
createAndServePaperFiling({
dateReceived: '01/01/2022',
documentType: 'Motion to Proceed Remotely',
});
cy.get(
'[data-testid="docket-record-table"] td:contains("Motion to Proceed Remotely")',
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
import { createAndSaveForLaterPaperFiling } from '../../../../../helpers/caseDetail/docketRecord/paperFiling/create-and-save-for-later-paper-filing';
import { createAndServePaperFiling } from '../../../../../helpers/caseDetail/docketRecord/paperFiling/create-and-serve-paper-filing';
import { externalUserCreatesElectronicCase } from '../../../../../helpers/fileAPetition/petitioner-creates-electronic-case';
import { goToCase } from '../../../../../helpers/caseDetail/go-to-case';
import {
loginAsDocketClerk,
loginAsPetitioner,
} from '../../../../../helpers/authentication/login-as-helpers';
import { logout } from '../../../../../helpers/authentication/logout';
import { petitionsClerkServesPetition } from '../../../../../helpers/documentQC/petitionsclerk-serves-petition';

describe('Docket record sort', () => {
before(() => {
loginAsPetitioner();
externalUserCreatesElectronicCase().then(docketNumber => {
cy.wrap(docketNumber).as('DOCKET_NUMBER');
petitionsClerkServesPetition(docketNumber);
logout();
loginAsDocketClerk();
goToCase(docketNumber);
createAndServePaperFiling({
dateReceived: '01/01/2022',
documentType: 'Motion for a New Trial',
isPaperCase: false,
});
createAndSaveForLaterPaperFiling({
dateReceived: '01/01/2022',
documentType: 'Motion for a New Trial',
});
goToCase(docketNumber);
});
});

beforeEach(() => {
cy.reload(true);
cy.keepAliases();
});

it('should display docket entries in default sort order', () => {
getColumnTextFields('docket-entry-filedDate').then(columnTextFields => {
const sortedColumnsTextFieldsAsc = [...columnTextFields].sort(
sortColumnsAsc,
);

expect(columnTextFields).to.deep.equal(sortedColumnsTextFieldsAsc);
});
});

[
{
columnId: 'docket-entry-index',
fieldName: 'index',
sortButtonId: 'index-sortable-button',
},
{
columnId: 'docket-entry-filedDate',
defaultSort: true,
fieldName: 'date',
sortButtonId: 'sortingFilingDate-sortable-button',
},
{
columnId: 'docket-entry-eventCode',
fieldName: 'event code',
sortButtonId: 'eventCode-sortable-button',
},
{
columnId: 'docket-entry-filingsAndProceedings',
fieldName: 'filings and proceedings',
sortButtonId: 'descriptionDisplay-sortable-button',
},
{
columnId: 'docket-entry-numberOfPages',
fieldName: 'number of pages',
sortButtonId: 'numberOfPages-sortable-button',
},
{
columnId: 'docket-entry-filedBy',
fieldName: 'filed by',
sortButtonId: 'filedBy-sortable-button',
},
{
columnId: 'docket-entry-action',
fieldName: 'action',
sortButtonId: 'action-sortable-button',
},
{
columnId: 'docket-record-cell-not-served',
fieldName: 'served',
sortButtonId: 'servedAt-sortable-button',
},
{
columnId: 'docket-entry-servedPartiesCode',
fieldName: 'served parties',
sortButtonId: 'servedPartiesCode-sortable-button',
},
].forEach(testInfo => {
it(`should display docket entries in correct order when sorting by ${testInfo.fieldName} ascending and descending`, () => {
if (!testInfo.defaultSort) {
cy.get(`[data-testid="${testInfo.sortButtonId}"]`).click();
}
getColumnTextFields(testInfo.columnId).then(columnTextFields => {
const sortedColumnsTextFieldsAsc = [...columnTextFields].sort(
sortColumnsAsc,
);

expect(columnTextFields).to.deep.equal(sortedColumnsTextFieldsAsc);
});

cy.get(`[data-testid="${testInfo.sortButtonId}"]`).click();

getColumnTextFields(testInfo.columnId).then(columnTextFields => {
const sortedColumnsTextFieldsDesc = [...columnTextFields]
.sort(sortColumnsAsc)
.reverse();
expect(columnTextFields).to.deep.equal(sortedColumnsTextFieldsDesc);
});
});
});

describe('Mobile View', () => {
beforeEach(() => {
cy.viewport('iphone-5');
});
it('should update the dropdown value when user selects an option', () => {
cy.get('[data-testid="docket-record-sort-select"]').should(
'have.value',
'byDate',
);
cy.get('[data-testid="docket-record-sort-select"]').select('byIndexDesc');
cy.get('[data-testid="docket-record-sort-select"]').should(
'have.value',
'byIndexDesc',
);
});
});
});

const getColumnTextFields = (dataTestId: string) => {
return cy.get(`[data-testid^="${dataTestId}"]`).then($cells => {
return $cells.toArray().map(cell => cell.innerText);
});
};

function sortColumnsAsc(a: string, b: string) {
const getPriority = (value: string) => {
if (value === '') return 1;
if (value?.toLocaleLowerCase() === 'not served') return 2;
return 0;
};

const priorityA = getPriority(a);
const priorityB = getPriority(b);

if (priorityA !== priorityB) return priorityA - priorityB;
return a.localeCompare(b);
}
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,10 @@ describe('Verify the activity report', () => {
goToCase(docketNumber);
updateCaseStatus('Submitted', 'Colvin');
goToCase(docketNumber);
createAndServePaperFiling('Motion for a New Trial', '01/01/2022');
createAndServePaperFiling({
dateReceived: '01/01/2022',
documentType: 'Motion for a New Trial',
});
goToCase(docketNumber);

cy.get(
Expand Down
Loading

0 comments on commit 5e035f5

Please sign in to comment.