Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arsalansufi committed Oct 6, 2023
1 parent 605ac43 commit 7b36383
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 22 deletions.
12 changes: 6 additions & 6 deletions apps/admin/frontend/src/app.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,9 @@ test('clearing results', async () => {

fireEvent.click(getByText('Tally'));
expect(
(await screen.findByText('Load CVR Files')).closest('button')
(await screen.findByText('Load CVRs')).closest('button')
).toBeDisabled();
expect(getByText('Remove CVR Files').closest('button')).toBeDisabled();
expect(getByText('Remove CVRs').closest('button')).toBeDisabled();
expect(
getByText('Edit Manually Entered Results').closest('button')
).toBeDisabled();
Expand All @@ -442,27 +442,27 @@ test('clearing results', async () => {
apiMock.expectGetManualResultsMetadata([]);
fireEvent.click(getByText('Clear All Tallies and Results'));
getByText(
'Do you want to remove the 1 loaded CVR file and the manually entered data?'
'Do you want to remove the 1 loaded CVR export and the manually entered data?'
);
fireEvent.click(getByText('Remove All Data'));

await waitFor(() => {
expect(getByText('Load CVR Files').closest('button')).toBeEnabled();
expect(getByText('Load CVRs').closest('button')).toBeEnabled();
});
await waitFor(() => {
expect(
getByText('Add Manually Entered Results').closest('button')
).toBeEnabled();
});

expect(getByText('Remove CVR Files').closest('button')).toBeDisabled();
expect(getByText('Remove CVRs').closest('button')).toBeDisabled();
expect(
getByText('Remove Manually Entered Results').closest('button')
).toBeDisabled();

expect(queryByText('Clear All Tallies and Results')).not.toBeInTheDocument();

getByText('No CVR files loaded.');
getByText('No CVRs loaded.');
});

test('can not view or print ballots', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('when USB is properly mounted', () => {
});
await waitFor(() =>
screen.getByText(
/There were no new CVR files automatically found on this USB drive/
/No new CVR exports were automatically found on this USB drive./
)
);

Expand All @@ -137,7 +137,7 @@ describe('when USB is properly mounted', () => {
apiMock.expectGetCastVoteRecordFileMode('test');
apiMock.expectGetCastVoteRecordFiles([]);

await screen.findByText('1,000 new CVRs Loaded');
await screen.findByText('1,000 New CVRs Loaded');

delete window.kiosk;
});
Expand All @@ -152,9 +152,9 @@ describe('when USB is properly mounted', () => {
usbDriveStatus: mockUsbDriveStatus('mounted'),
apiMock,
});
await screen.findByText('Load CVR Files');
await screen.findByText('Load CVRs');
screen.getByText(
/The following CVR files were automatically found on this USB drive./
/The following CVR exports were automatically found on this USB drive./
);

const tableRows = screen.getAllByTestId('table-row');
Expand Down Expand Up @@ -187,8 +187,8 @@ describe('when USB is properly mounted', () => {
apiMock.expectGetCastVoteRecordFiles([]);

userEvent.click(domGetByText(tableRows[0], 'Load'));
await screen.findByText('Loading');
await screen.findByText('1,000 new CVRs Loaded');
await screen.findByText('Loading CVRs');
await screen.findByText('1,000 New CVRs Loaded');
});

test('locks to test mode when in test mode & shows previously loaded files as loaded', async () => {
Expand All @@ -203,7 +203,7 @@ describe('when USB is properly mounted', () => {
apiMock,
});
await screen.findByRole('heading', {
name: 'Load Test Ballot Mode CVR Files',
name: 'Load Test Ballot Mode CVRs',
});

const tableRows = screen.getAllByTestId('table-row');
Expand Down Expand Up @@ -235,7 +235,7 @@ describe('when USB is properly mounted', () => {
usbDriveStatus: mockUsbDriveStatus('mounted'),
apiMock,
});
await screen.findByText('Load Official Ballot Mode CVR Files');
await screen.findByText('Load Official Ballot Mode CVRs');

const tableRows = screen.getAllByTestId('table-row');
expect(tableRows).toHaveLength(1);
Expand Down
6 changes: 3 additions & 3 deletions apps/admin/frontend/src/screens/tally_screen.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ test('with no data loaded', async () => {
await screen.findByRole('heading', {
name: 'Cast Vote Record (CVR) Management',
});
await screen.findByText('No CVR files loaded.');
expect(screen.getButton('Load CVR Files')).toBeEnabled();
expect(screen.getButton('Remove CVR Files')).toBeDisabled();
await screen.findByText('No CVRs loaded.');
expect(screen.getButton('Load CVRs')).toBeEnabled();
expect(screen.getButton('Remove CVRs')).toBeDisabled();
expect(screen.getButton('Add Manually Entered Results')).toBeEnabled();
expect(screen.getButton('Remove Manually Entered Results')).toBeDisabled();
});
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ test('render export modal when a usb drive is mounted as expected and allows aut
apiClient: mockApiClient,
})
);
getByText(
'USB drive successfully ejected, you may now take it to VxAdmin for tabulation.'
);
getByText('You may now take the USB drive to VxAdmin for tabulation.');
});

test('render export modal with errors when appropriate', async () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/scan/frontend/src/app.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ test('voter can cast a ballot that scans successfully ', async () => {

apiMock.expectExportCastVoteRecordsToUsbDrive({ mode: 'full_export' });
userEvent.click(await screen.findByText('Save'));
await screen.findByText('CVRs Saved to USB Drive');
await screen.findByText('CVRs Saved');

apiMock.mockApiClient.ejectUsbDrive.expectCallWith().resolves();
apiMock.expectGetUsbDriveStatus('ejected');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ test('render export modal when a usb drive is mounted as expected and allows exp

apiMock.expectExportCastVoteRecordsToUsbDrive({ mode: 'full_export' });
userEvent.click(getByText('Save'));
await waitFor(() => getByText('CVRs Saved to USB Drive'));
await waitFor(() => getByText('CVRs Saved'));

apiMock.mockApiClient.ejectUsbDrive.expectCallWith().resolves();
userEvent.click(getByText('Eject USB'));
Expand Down

0 comments on commit 7b36383

Please sign in to comment.