Skip to content
Snippets Groups Projects
Commit 838c04e3 authored by Zoltan Runyo's avatar Zoltan Runyo
Browse files

ICSHWI-7535: Browse deployments tests

parent 5be7de2d
No related branches found
No related tags found
1 merge request!61ICSHWI-7535: Browse deployments tests
Pipeline #92684 passed
......@@ -5,14 +5,14 @@ Feature: Browse IOC Deployments
When the user navigates to the deployments page
Then they should be presented with a table of IOC deployments
Scenario: User wants to see all IOC deployments
Given the user is on the deployments page
When the user opens the Explore deployments tab
Then the table should display all IOC deployments in the facility
# Scenario: User wants to see all IOC deployments
# Given the user is on the deployments page
# When the user opens the Explore deployments tab
# Then the table should display all IOC deployments in the facility
Scenario: User wants to see relevant IOC deployments
Given the user is on the hosts page
When the user clicks on the Your Deployments tab
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
......@@ -21,27 +21,27 @@ Feature: Browse IOC Deployments
When the user clicks on the deployment in the table
Then the user should be redirected to the deployment details page.
Scenario: User wants to highlight copy values from deployments table to clipboard
Given the user is on the deployments page
When the user highlights content within the table
Then they shall not be redirected to the deployment details page
Scenario: User wants to search for a deployment
Given the user is on the deployments page
When the user types a query in the search bar
Then the deployments table should be updated with the search results
Scenario: User wants to filter the deployments
Given the user is on the deployments page
When the user types a filter into the search bar
Then the deployments in the table should be filtered based on the filter string.
Scenario: User wants change the order the IOC deployments are displayed
Given the user is on the deployments page
When the user clicks on a column header in the table
Then the deployments table rows should be sorted by the values of that column
Scenario: There are more deployments than can be displayed
Given the user is on the deployments page
When there are more deployments matching the search query than can be displayed
Then a warning should be shown letting the user know that all deployments are not rendered
# Scenario: User wants to highlight copy values from deployments table to clipboard
# Given the user is on the deployments page
# When the user highlights content within the table
# Then they shall not be redirected to the deployment details page
# Scenario: User wants to search for a deployment
# Given the user is on the deployments page
# When the user types a query in the search bar
# Then the deployments table should be updated with the search results
# Scenario: User wants to filter the deployments
# Given the user is on the deployments page
# When the user types a filter into the search bar
# Then the deployments in the table should be filtered based on the filter string.
# Scenario: User wants change the order the IOC deployments are displayed
# Given the user is on the deployments page
# When the user clicks on a column header in the table
# Then the deployments table rows should be sorted by the values of that column
# Scenario: There are more deployments than can be displayed
# Given the user is on the deployments page
# When there are more deployments matching the search query than can be displayed
# Then a warning should be shown letting the user know that all deployments are not rendered
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 logged in', () => {
const history = createMemoryHistory()
history.push('/deployments')
render(
<Router history={history}>
<App />
</Router>
)
});
when('the user navigates to the deployments page', async () => {
await screen.findByText(/my deployments/i);
});
then('they should be presented with a table of IOC deployments', async () => {
expect(await screen.findByText('CCCE / Deployment log')).toBeInTheDocument();
expect(await screen.findByText(/all/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 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()
});
});
});
\ No newline at end of file
......@@ -22,7 +22,7 @@ export function DeploymentDetailsView({ match }) {
};
return (
<Container>
<Container data-testid="deployment-details-container">
<Paper>
<IconButton color="inherit" onClick={handleClick}>
<ArrowBackIcon />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment