Skip to content
Snippets Groups Projects

 CE-1916: Remove-React-Testing-Library

Merged  CE-1916: Remove-React-Testing-Library
1 unresolved thread
Merged Alexander Madsen requested to merge CE-1916-Remove-React-Testing-Library into develop
1 unresolved thread
5 files
+ 0
577
Compare changes
  • Side-by-side
  • Inline
Files
5
import React from "react";
import { loadFeature, defineFeature } from "jest-cucumber";
import { render, screen /* , findByText*/ } from "@testing-library/react";
import App from "../App";
import { createMemoryHistory } from "history";
// mock BrowserRouter (this should probably live somewhere else)
const reactRouterDom = require("react-router-dom");
reactRouterDom.BrowserRouter = ({ children }) => <div>{children}</div>;
const Router = reactRouterDom.Router;
const feature = loadFeature("features/deployments/browse-deployments.feature");
defineFeature(feature, (test) => {
test("User wants to browse IOC deployments", ({ given, when, then }) => {
given(
"the user is not logged in and navigates to the deployments page",
async () => {
const history = createMemoryHistory();
history.push("/deployments");
render(
<Router history={history}>
<App />
</Router>
);
await screen.findByText(/Running/i);
}
);
then("they should not get Access deniend", async () => {
expect(await screen.findByText(/IOC name/i)).toBeInTheDocument();
});
});
test("User wants to see relevant IOC deployments", ({
given,
when,
then,
and
}) => {
given("the user is on the deployments page", () => {});
when("the user clicks on the My deployments toogle button", () => {});
then(
"the table should display only deployments which the user has made",
() => {}
);
and("recent deployments should be at the top", () => {});
});
test("User wants to navigate to a specific IOC deployment", ({
given,
when,
then
}) => {
given(
"the user is not logged in and tries to navigate any deployment details page",
async () => {
const history = createMemoryHistory();
history.push("/deployments/1");
render(
<Router history={history}>
<App />
</Router>
);
await screen.findByText(/deployment details/i);
}
);
then("they should not get Access deniend", async () => {
expect(
await screen.findByText(/Running Undeployment/i)
).toBeInTheDocument();
});
});
/* test('Logged in user wants to navigate to a specific IOC deployment', ({ given, when, then }) => {
given('the user is on the deployments page', async () => {
const history = createMemoryHistory();
history.push('/deployments')
const { container } = render(
<Router history={history}>
<App />
</Router>
)
await findByText(container, /my deployments/i);
});
when('the user clicks on the deployment in the table', async () => {
const history = createMemoryHistory();
history.push('/deployments/1')
render(
<Router history={history}>
<App />
</Router>
)
await screen.findByTestId("deployment-details-container")
});
then('the user should be redirected to the deployment details page.', async () => {
expect(await screen.findByText(/the deployment is queued/i)).toBeInTheDocument()
});
});*/
});
Loading