Skip to content

Commit

Permalink
e2e-test: Fixed tests workflow-item, timestamp & co
Browse files Browse the repository at this point in the history
- After adding an image for a placeholder, the test couldn't find a
  button to click on anymore, so a force command solved the issue.

- In timestamp_spec.js a div couldn't be found because it was nested,
  now the actual list is being forwarded.

- Fixed project_analytics_spec.js and subproject_edit_spec.js,...
  • Loading branch information
melissaSchmidt0302 committed May 4, 2020
1 parent 6d3c75c commit 6539d3d
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 39 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ DOCKER_REGISTRY_PASSWORD
*~
*-audit.json
.vscode/*
.vs/*
Untitled*
node_modules
yarn-error.log
Expand Down
2 changes: 2 additions & 0 deletions e2e-test/cypress/integration/global_permissions_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe("Users/Groups Dashboard", function() {
});

it("Display the global permission dialog correctly", function() {
cy.reload();
cy.get(`[data-test=edit-user-permissions-${testUserName}]`).click();
cy.get("[data-test=global-permissions-dialog]").should("be.visible");
cy.get("[data-test=cancel]").click();
Expand Down Expand Up @@ -47,6 +48,7 @@ describe("Users/Groups Dashboard", function() {
});

it("After clicking 'cancel', the selection is not adopted", function() {
cy.get(`[data-test=user-${testUserName}]`).should("be.visible");
cy.get(`[data-test=edit-user-permissions-${testUserName}]`).click();
cy.get("[data-test=global-permissions-dialog]").should("be.visible");

Expand Down
2 changes: 1 addition & 1 deletion e2e-test/cypress/integration/project_analytics_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ describe("Project Analytics", function() {
// Open dialog
cy.get("[data-test=details-analytics-button]")
.should("be.visible")
.click();
.click({ force: true });
cy.get("[data-test=select-currencies]")
.should("be.visible")
.click();
Expand Down
4 changes: 3 additions & 1 deletion e2e-test/cypress/integration/subproject_create_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ describe("Subproject creation", function() {
cy.visit(`/projects/${projectId}`);

//Create a subproject
cy.reload();
cy.get("[data-test=subproject-row]").should("be.visible");
cy.get("[data-test=subproject-create-button]").click();
cy.get("[data-test=nameinput] input").type("Test");
cy.get("[data-test=dropdown-sp-dialog-currencies-click]")
Expand All @@ -43,7 +45,7 @@ describe("Subproject creation", function() {

//Check warning badge
cy.get("[data-test=warning-badge]").should("be.visible");
cy.get("[data-test=spp-button-0]").click();
cy.get("[data-test=spp-button-0]").click({ force: true });
cy.get("[data-test=warning-badge]").should("not.be.checked");
cy.get("[data-test=permission-submit]").click();
cy.get("[data-test=warning-badge]").should("not.be.checked");
Expand Down
1 change: 1 addition & 0 deletions e2e-test/cypress/integration/subproject_edit_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe("Subproject Edit", function() {
.then(title => {
cy.get("[data-test=nameinput] input").type("-changed");
cy.get("[data-test=submit]").click();
cy.get("[data-test=highlighted-displayname]").should("be.visible");
cy.get("[data-test=subproject-title-0]")
.invoke("text")
.should("not.eq", title);
Expand Down
35 changes: 18 additions & 17 deletions e2e-test/cypress/integration/subproject_search_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ describe("Subproject Search", function() {
cy.login();
cy.visit(`/projects/${projectWithTag.id}`);
});

it("Check regex highlighting", function() {
cy.get("[data-test=subproject-row]").should("be.visible");
cy.get("[data-test=search-input]")
.should("be.visible")
.type("SearchTest");
Expand All @@ -44,23 +46,26 @@ describe("Subproject Search", function() {
});

it("Filter subprojects by display name", function() {
cy.get("[data-test=subproject-row]").should("be.visible");
cy.get("[data-test=sub-projects]")
.find("[data-test=search-bar]")
.find("[data-test=search-input]")
.should("be.visible")
.type(projectWithTag.subprojectTitle);
.should("not.be.disabled");
cy.get("[data-test=search-input").type(projectWithTag.subprojectTitle);
cy.get("[data-test=highlighted-displayname]").contains(projectWithTag.subprojectTitle);
//Only one element should should be in the list
cy.get("[data-test=subproject-title-0]").should("be.visible");
cy.get("[data-test=subproject-title-1]").should("not.be.visible");
});

it("Filter subprojects by prefix 'name' and 'status'", function() {
cy.get("[data-test=subproject-row]").should("be.visible");
cy.get("[data-test=sub-projects]")
.find("[data-test=search-bar]")
.find("[data-test=search-input]")
.should("be.visible")
.type("name:" + projectWithTag.subprojectTitle);
.should("be.visible");
cy.get("[data-test=search-input]").type("name:" + projectWithTag.subprojectTitle);
cy.get("[data-test=highlighted-displayname]").contains(projectWithTag.subprojectTitle);
//Only one element should should be in the list
cy.get("[data-test=subproject-title-0]").should("be.visible");
Expand All @@ -69,7 +74,8 @@ describe("Subproject Search", function() {
cy.get("[data-test=sub-projects]")
.find("[data-test=search-bar]")
.find("[data-test=search-input]")
.should("be.visible")
.should("be.visible");
cy.get("[data-test=search-input]")
.type("{selectall}{backspace}")
.type("status: open");
cy.get("[data-test=ssp-table]").contains("Open");
Expand All @@ -79,15 +85,13 @@ describe("Subproject Search", function() {
});

it("Search bar is empty when viewing subproject details", function() {
cy.get("[data-test=subproject-row]").should("be.visible");
// Type into search bar
cy.get("[data-test=sub-projects]")
.find("[data-test=search-bar]")
.find("[data-test=search-input]")
.should("be.visible");
cy.get("[data-test=sub-projects]")
.find("[data-test=search-bar]")
.find("[data-test=search-input] input")
.type("SearchTestExample");
cy.get("[data-test=search-input]").type("SearchTestExample");
// Go into detail view
cy.get("[data-test=subproject-view-details-0]").click();
// Go back to subproject view
Expand All @@ -99,15 +103,13 @@ describe("Subproject Search", function() {
});

it("Search bar is empty when clicking on 'Main' breadcrumb", function() {
cy.get("[data-test=subproject-row]").should("be.visible");
cy.get("[data-test=sub-projects]")
.find("[data-test=search-bar]")
.find("[data-test=search-input]")
.should("be.visible");
// Type into search bar
cy.get("[data-test=sub-projects]")
.find("[data-test=search-bar]")
.find("[data-test=search-input] input")
.type("SearchTestExample");
cy.get("[data-test=search-input]").type("SearchTestExample");
// Navigate via Main breadcrumb
cy.get("[data-test=breadcrumb-Main]").click();
// Go back to subproject view
Expand All @@ -119,15 +121,14 @@ describe("Subproject Search", function() {
});

it("Search bar is empty when clicking on 'Projects' breadcrumb", function() {
cy.get("[data-test=subproject-row]").should("be.visible");
cy.get("[data-test=sub-projects]")
.find("[data-test=search-bar]")
.find("[data-test=search-input]")
.should("be.visible");
.should("be.visible")
.should("not.be.disabled");
// Type into search bar
cy.get("[data-test=sub-projects]")
.find("[data-test=search-bar]")
.find("[data-test=search-input] input")
.type("SearchTestExample");
cy.get("[data-test=search-input]").type("SearchTestExample");
// Navigate via Projects breadcrumb
cy.get("[data-test=breadcrumb-Projects]").click();
// Go back to subproject view
Expand Down
4 changes: 2 additions & 2 deletions e2e-test/cypress/integration/timestamp_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const standardBudget = [
describe("Timestamps", function() {
before(function() {
cy.login("mstein", "test");
cy.visit(`/projects`);
cy.createProject("p-timestamp", "project timestamp test", standardBudget);
});

Expand All @@ -23,8 +22,9 @@ describe("Timestamps", function() {
.last()
.click();
cy.get("[data-test=assignee-selection]").click();
cy.get("[data-test=assignee-list]")
cy.get("[data-test=assignee-selection]")
.should("be.visible")
.get("[data-test=assignee-list]")
.find("[value=thouse]")
.click()
.get("[data-test=confirmation-dialog-confirm]")
Expand Down
2 changes: 1 addition & 1 deletion e2e-test/cypress/integration/workflowitem_create_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe("Workflowitem create", function() {
cy.get("[data-test=workflowitem-table]")
.find("[data-test=show-workflowitem-permissions]")
.first()
.click();
.click({ force: true });
cy.get("[data-test=warning-badge]")
.first()
.should("not.be.checked");
Expand Down
15 changes: 7 additions & 8 deletions frontend/src/pages/Nodes/NodeVoting.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import React from "react";

import Button from "@material-ui/core/Button";
import Card from "@material-ui/core/Card";
import CardHeader from "@material-ui/core/CardHeader";
import CardContent from "@material-ui/core/CardContent";

import Typography from "@material-ui/core/Typography";
import CardHeader from "@material-ui/core/CardHeader";
import Divider from "@material-ui/core/Divider";
import List from "@material-ui/core/List";
import ListItem from "@material-ui/core/ListItem";
import ListItemText from "@material-ui/core/ListItemText";
import Divider from "@material-ui/core/Divider";
import Button from "@material-ui/core/Button";
import { withStyles } from "@material-ui/core/styles";
import Typography from "@material-ui/core/Typography";
import React from "react";

import strings from "../../localizeStrings";
import { canApproveNode } from "../../permissions";
import { NewOrganizationsEmptyState, ExistingNodesEmptyState } from "./NodesEmptyStates";
Expand Down Expand Up @@ -124,7 +123,7 @@ const getListEntries = (nodes, canApprove, classes, cb) => {
const NodeVoting = ({ nodes, approveNewNodeForExistingOrganization, allowedIntents, classes, isDataLoading }) => {
const canApprove = canApproveNode(allowedIntents);

const [_self, newOrgaNodes, existingOrgaNodes] = splitNodes(nodes);
const [, newOrgaNodes, existingOrgaNodes] = splitNodes(nodes);

const newOrgaNodesListEntries = getListEntries(newOrgaNodes, canApprove, classes, ({ address }) =>
approveNewNodeForExistingOrganization(address)
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/SubProjects/SubProjectTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const getTableEntries = ({
/>
</div>
<div className={classes.button}>
<StyledBadge color="secondary" variant="dot" invisible={isBadgeHidden} data-test={"warning-badge"}>
<StyledBadge color="secondary" variant="dot" invisible={isBadgeHidden} data-test="warning-badge">
<ActionButton
notVisible={!canViewPermissions}
onClick={() => showSubProjectPermissions(id, displayName)}
Expand Down Expand Up @@ -253,7 +253,7 @@ const SubProjectTable = ({
{subProjects.length > 0 ? (
<Table data-test="ssp-table" className={classes.subprojectTable}>
<TableHead>
<TableRow>
<TableRow data-test="subproject-row">
<TableCell className={classes.displayName}>{strings.common.subproject}</TableCell>
<TableCell className={classes.projectdBudget}>{strings.common.projected_budget}</TableCell>
<TableCell className={classes.status}>{strings.common.status}</TableCell>
Expand Down
12 changes: 6 additions & 6 deletions frontend/src/pages/Workflows/SubProjectDetails.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import Avatar from "@material-ui/core/Avatar";
import Button from "@material-ui/core/Button";
import Card from "@material-ui/core/Card";
import IconButton from "@material-ui/core/IconButton";
import Button from "@material-ui/core/Button";
import List from "@material-ui/core/List";
import ListItem from "@material-ui/core/ListItem";
import ListItemText from "@material-ui/core/ListItemText";
import Tooltip from "@material-ui/core/Tooltip";
import Typography from "@material-ui/core/Typography";
import AmountIcon from "@material-ui/icons/AccountBalance";
import Table from "@material-ui/core/Table";
import TableBody from "@material-ui/core/TableBody";
import TableCell from "@material-ui/core/TableCell";
import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
import Tooltip from "@material-ui/core/Tooltip";
import Typography from "@material-ui/core/Typography";
import AmountIcon from "@material-ui/icons/AccountBalance";
import BarChartIcon from "@material-ui/icons/BarChart";
import DoneIcon from "@material-ui/icons/Check";
import DateIcon from "@material-ui/icons/DateRange";
import AssigneeIcon from "@material-ui/icons/Group";
import BarChartIcon from "@material-ui/icons/BarChart";
import _isUndefined from "lodash/isUndefined";
import React from "react";

import { statusIconMapping, statusMapping, toAmountString, unixTsToString } from "../../helper.js";
import strings from "../../localizeStrings";
import SubProjectAssigneeContainer from "./SubProjectAssigneeContainer";
import SubProjectAnalyticsDialog from "../Analytics/SubProjectAnalyticsDialog";
import SubProjectAssigneeContainer from "./SubProjectAssigneeContainer";
import BudgetEmptyState from "../Common/BudgetEmptyState";

const styles = {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/Workflows/WorkflowList.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import EditIcon from "@material-ui/icons/Edit";
import _isEmpty from "lodash/isEmpty";
import React from "react";
import { SortableContainer } from "react-sortable-hoc";

import { canReorderWorkflowItems } from "../../permissions.js";
import { RedactedWorkflowItem, WorkflowItem } from "./WorkflowItem";

Expand Down

0 comments on commit 6539d3d

Please sign in to comment.