Skip to content

Commit

Permalink
Merge commit '84d0cfbfa36f1aac928c703d57a8bcebfb2374f8' into ian/353-…
Browse files Browse the repository at this point in the history
…flaky-tests
  • Loading branch information
macfarlandian committed Mar 31, 2021
2 parents ed75303 + 84d0cfb commit 685c829
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 deletions.
6 changes: 2 additions & 4 deletions spotlight-client/src/App-auth.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,10 @@ test("requires email verification", async () => {
render(<App />);
await waitFor(() => {
// application contents should not have been rendered without verification
expect(
screen.queryByRole("heading", { name: authenticatedTextMatch })
).not.toBeInTheDocument();
expect(screen.queryByTestId("PageTitle")).not.toBeInTheDocument();
// there should be a message about the verification requirement
expect(
screen.getByRole("heading", { name: /verification/i })
screen.getByRole("heading", { name: /verification/i, hidden: true })
).toBeInTheDocument();
});
});
Expand Down
2 changes: 1 addition & 1 deletion spotlight-client/src/Loading/Loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const LoadingSpinnerText = styled.div`

export default function Loading(): JSX.Element {
return (
<LoadingWrapper role="status">
<LoadingWrapper role="status" data-testid="LoadingIndicator">
<LoadingSpinnerIcon />
<LoadingSpinnerText>Data is loading</LoadingSpinnerText>
</LoadingWrapper>
Expand Down
2 changes: 1 addition & 1 deletion spotlight-client/src/ModelHydrator/ModelHydrator.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test("hydrated", async () => {
});

await waitFor(() => {
expect(screen.queryByRole("status")).not.toBeInTheDocument();
expect(screen.queryByTestId("LoadingIndicator")).not.toBeInTheDocument();
expect(screen.getByText("hydrated")).toBeInTheDocument();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,7 @@ test("total counts", async () => {
renderWithStore(<VizPopulationBreakdownByLocation metric={metric} />);

await waitFor(() => {
const stat = screen.getByRole("figure", {
name: "Total people in prison",
// performance is better if we don't check for visibility within the *ByRole query;
// it's also redundant since we do it immediately after this
hidden: true,
});

const stat = screen.getByLabelText("Total people in prison");
expect(stat).toBeVisible();
expect(within(stat).getByText("2,041")).toBeVisible();
});
Expand Down Expand Up @@ -162,12 +156,7 @@ test("counts filtered by locality", async () => {
fireEvent.click(option);

await waitFor(() => {
const stat = screen.getByRole("figure", {
name: "Total people in prison",
// performance is better if we don't check for visibility within the *ByRole query;
// it's also redundant since we do it immediately after this
hidden: true,
});
const stat = screen.getByLabelText("Total people in prison");
expect(within(stat).getByText("413")).toBeVisible();
});

Expand Down

0 comments on commit 685c829

Please sign in to comment.