Skip to content

Commit

Permalink
feat(admin): Reports Screen Content Revamp (#4028)
Browse files Browse the repository at this point in the history
* replace existing tally report screens with screens using the new tally report viewer component (doesn't wire them up to app yet)

* add preset ballot count reports, one by precint and one by voting method

* refactor: move builder screens into new subdirectory

* rename: change batch results button name to be consistent with other CSV export buttoms

* revamp reports screen
- remove old ballot counts components
- rearrange screen
- move reports screen files to new subdirectory
- update routing accordingly

* fix app testing and remove no longer needed testing utils

* remove TODO comments that do not seem to be relevant anymore
  • Loading branch information
adghayes authored Oct 4, 2023
1 parent c9b843c commit 855c1d6
Show file tree
Hide file tree
Showing 27 changed files with 1,034 additions and 2,172 deletions.
2 changes: 1 addition & 1 deletion apps/admin/frontend/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ export const getCardCounts = {
return input ? ['getCardCounts', input] : ['getCardCounts'];
},
useQuery(
input: GetCardCountsInput = { groupBy: {} },
input: GetCardCountsInput = {},
options: { enabled: boolean } = { enabled: true }
) {
const apiClient = useApiClient();
Expand Down
27 changes: 14 additions & 13 deletions apps/admin/frontend/src/app.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ import { eitherNeitherElectionDefinition } from '../test/render_in_app_context';
import { VxFiles } from './lib/converters';
import { buildApp } from '../test/helpers/build_app';
import { ApiMock, createApiMock } from '../test/helpers/mock_api_client';
import { expectReportsScreenCardCountQueries } from '../test/helpers/api_expect_helpers';

import { mockCastVoteRecordFileRecord } from '../test/api_mock_data';
import { getSimpleMockTallyResults } from '../test/helpers/mock_results';
import {
getMockCardCounts,
getSimpleMockTallyResults,
} from '../test/helpers/mock_results';

jest.mock('@votingworks/ballot-encoder', () => {
return {
Expand Down Expand Up @@ -333,23 +335,24 @@ test('marking results as official', async () => {
electionDefinition,
});
apiMock.expectGetCastVoteRecordFileMode('official');
apiMock.expectGetResultsForTallyReports({ filter: {} }, [
apiMock.expectGetResultsForTallyReports({ filter: {}, groupBy: {} }, [
getSimpleMockTallyResults({
election,
scannedBallotCount: 100,
cardCountsByParty: {},
}),
]);
apiMock.expectGetScannerBatches([]);
apiMock.expectGetManualResultsMetadata([]);
expectReportsScreenCardCountQueries({ apiMock, isPrimary: true });
apiMock.expectGetCardCounts({}, [getMockCardCounts(0)]);
renderApp();

await apiMock.authenticateAsElectionManager(electionDefinition);

userEvent.click(screen.getButton('Reports'));
userEvent.click(screen.getButton('Unofficial Full Election Tally Report'));
await screen.findByText('Unofficial Example Primary Election Tally Report');
userEvent.click(screen.getButton('Full Election Tally Report'));
await screen.findByText(
'Unofficial Mammal Party Example Primary Election Tally Report'
);

apiMock.expectMarkResultsOfficial();
apiMock.expectGetCurrentElectionMetadata({
Expand All @@ -365,7 +368,9 @@ test('marking results as official', async () => {
'Mark Tally Results as Official'
)
);
await screen.findByText('Official Example Primary Election Tally Report');
await screen.findByText(
'Official Mammal Party Example Primary Election Tally Report'
);
});

test('removing election resets cvr and manual data files', async () => {
Expand Down Expand Up @@ -486,11 +491,7 @@ test('election manager UI has expected nav', async () => {
apiMock.expectGetCastVoteRecordFileMode('unlocked');
apiMock.expectGetCastVoteRecordFiles([]);
apiMock.expectGetManualResultsMetadata([]);
expectReportsScreenCardCountQueries({
apiMock,
isPrimary: false,
});
apiMock.expectGetScannerBatches([]);
apiMock.expectGetCardCounts({}, [getMockCardCounts(100)]);
renderApp();
await apiMock.authenticateAsElectionManager(eitherNeitherElectionDefinition);

Expand Down
Loading

0 comments on commit 855c1d6

Please sign in to comment.