Skip to content

Commit

Permalink
Merge pull request #1119 from votingworks/test/bmd/fix-race-condition
Browse files Browse the repository at this point in the history
test(bmd): fix race condition in `TestBallotDeckScreen` test
  • Loading branch information
eventualbuddha committed Oct 28, 2021
2 parents 3277387 + 5f2cec9 commit 009b886
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions apps/bmd/src/pages/TestBallotDeckScreen.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ import {
import React from 'react';
import { fireEvent, waitFor, act, screen } from '@testing-library/react';
import { asElectionDefinition } from '@votingworks/fixtures';
import { fakeKiosk, fakePrinterInfo, mockOf } from '@votingworks/test-utils';
import {
advanceTimersAndPromises,
fakeKiosk,
fakePrinterInfo,
mockOf,
} from '@votingworks/test-utils';
import electionSample from '../data/electionSample.json';
import { render } from '../../test/testUtils';
import { randomBase64 } from '../utils/random';
Expand Down Expand Up @@ -72,7 +77,6 @@ it('renders test decks appropriately', async () => {
jest.advanceTimersByTime(66000);
});
expect(screen.queryAllByText('Printing Ballots…').length).toBe(0);
jest.useRealTimers();
});

it('shows printer not connected when appropriate', async () => {
Expand All @@ -98,6 +102,7 @@ it('shows printer not connected when appropriate', async () => {
fireEvent.click(screen.getByText('All Precincts'));

fireEvent.click(screen.getByText('Print 63 ballots'));
await advanceTimersAndPromises();

expect(kiosk.getPrinterInfo).toHaveBeenCalled();

Expand Down

0 comments on commit 009b886

Please sign in to comment.