-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f33919c
commit af6cbff
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Feature: Cati dashboard link | ||
|
||
Scenario: Following the Cati dashboard link takes a user to the case info page | ||
Given I access the Telephone Operations Blaise Interface URL | ||
When I click the link to the CATI dashboard | ||
Then I arrive at the Case Info tab URL |
54 changes: 54 additions & 0 deletions
54
src/features/step_definitions/CATI_Dashboard_Link.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
|
||
import React from "react"; | ||
import { defineFeature, loadFeature } from "jest-cucumber"; | ||
import {cleanup, fireEvent, render, screen, waitFor} from "@testing-library/react"; | ||
import { act } from "react-dom/test-utils"; | ||
import { createMemoryHistory } from "history"; | ||
import { Router } from "react-router-dom"; | ||
import flushPromises from "../../tests/utils"; | ||
|
||
import App from "../../App"; | ||
|
||
const feature = loadFeature( | ||
"./src/features/CATI_Dashboard_Link.feature", | ||
); | ||
|
||
|
||
defineFeature(feature, test => { | ||
afterEach(() => { | ||
jest.clearAllMocks(); | ||
cleanup(); | ||
jest.resetModules(); | ||
}); | ||
|
||
beforeEach(() => { | ||
cleanup(); | ||
}); | ||
|
||
test("Following the Cati dashboard link takes a user to the case info page", ({ given, when, then }) => { | ||
given("I access the Telephone Operations Blaise Interface URL", async () => { | ||
const history = createMemoryHistory(); | ||
render( | ||
<Router history={history}> | ||
<App/> | ||
</Router> | ||
); | ||
await act(async () => { | ||
await flushPromises(); | ||
}); | ||
}); | ||
|
||
when("I click the link to the CATI dashboard", async () => { | ||
fireEvent.click(screen.getByText(/Link to CATI dashboard/i)); | ||
await act(async () => { | ||
await flushPromises(); | ||
}); | ||
}); | ||
|
||
then("I arrive at the Case Info tab URL", async () => { | ||
await waitFor(() => { | ||
expect(window.location.pathname).toContain("/Blaise/CaseInfo"); | ||
}); | ||
}); | ||
}); | ||
}); |