Skip to content

Commit

Permalink
fix rest of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kshen0 committed Oct 10, 2023
1 parent 0bb3947 commit 22abecd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 28 deletions.
32 changes: 6 additions & 26 deletions apps/mark-scan/frontend/src/app_cardless_voting.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
screen,
within,
} from '../test/react_testing_library';
import * as GLOBALS from './config/globals';

import { App } from './app';

Expand Down Expand Up @@ -258,16 +257,9 @@ test('Cardless Voting Flow', async () => {
apiMock.expectGetInterpretation(mockInterpretation);
userEvent.click(screen.getByText('My Ballot is Correct'));

// Reset Ballot is called
// Show Verify and Scan Instructions
await screen.findByText('You’re Almost Done');
expect(
screen.queryByText('3. Return the card to a poll worker.')
).toBeFalsy();
apiMock.setPaperHandlerState('ejecting_to_rear');
await screen.findByText('Casting Ballot');

// Wait for timeout to return to Insert Card screen
apiMock.mockApiClient.endCardlessVoterSession.expectCallWith().resolves();
await advanceTimersAndPromises(GLOBALS.BALLOT_INSTRUCTIONS_TIMEOUT_SECONDS);
apiMock.setAuthStatusLoggedOut();
await screen.findByText('Insert Card');
});
Expand Down Expand Up @@ -412,14 +404,9 @@ test('Voter can submit a blank ballot', async () => {
apiMock.expectGetInterpretation(mockInterpretation);
userEvent.click(screen.getByText('My Ballot is Correct'));

// Reset Ballot is called
// Show Verify and Scan Instructions
await screen.findByText('You’re Almost Done');
expect(screen.queryByText('3. Return the card.')).toBeFalsy();
apiMock.setPaperHandlerState('ejecting_to_rear');
await screen.findByText('Casting Ballot');

// Click "Done" to get back to Insert Card screen
apiMock.mockApiClient.endCardlessVoterSession.expectCallWith().resolves();
fireEvent.click(screen.getByText('Done'));
apiMock.setAuthStatusLoggedOut();
await screen.findByText('Insert Card');
});
Expand Down Expand Up @@ -636,16 +623,9 @@ test('poll worker must select a precinct first', async () => {
apiMock.expectGetInterpretation(mockInterpretation);
userEvent.click(screen.getByText('My Ballot is Correct'));

// Reset Ballot is called
// Show Verify and Scan Instructions
await screen.findByText('You’re Almost Done');
expect(
screen.queryByText('3. Return the card to a poll worker.')
).toBeFalsy();
apiMock.setPaperHandlerState('ejecting_to_rear');
await screen.findByText('Casting Ballot');

// Wait for timeout to return to Insert Card screen
apiMock.mockApiClient.endCardlessVoterSession.expectCallWith().resolves();
await advanceTimersAndPromises(GLOBALS.BALLOT_INSTRUCTIONS_TIMEOUT_SECONDS);
apiMock.setAuthStatusLoggedOut();
await screen.findByText('Insert Card');
});
3 changes: 1 addition & 2 deletions apps/mark-scan/frontend/src/app_end_to_end.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,9 @@ test('MarkAndPrint end-to-end flow', async () => {
// Validate Ballot page
await screen.findByText('Review Your Votes');
apiMock.expectValidateBallot();
apiMock.mockApiClient.endCardlessVoterSession.expectCallWith().resolves();
apiMock.expectGetInterpretation(mockInterpretation);
userEvent.click(screen.getByText('My Ballot is Correct'));
userEvent.click(await screen.findByText('Done'));

apiMock.setAuthStatusLoggedOut();

// ---------------
Expand Down

0 comments on commit 22abecd

Please sign in to comment.