From 1a4c6359465af001fa40b58c1c74febad8e45fd1 Mon Sep 17 00:00:00 2001 From: jenny-s51 Date: Wed, 3 Mar 2021 14:12:16 -0500 Subject: [PATCH] clean up and add cypress test --- cypress/integration/users_test.spec.ts | 22 ++++++ src/user/UserForm.tsx | 7 +- src/user/UsersSection.tsx | 4 +- src/user/UsersTabs.tsx | 105 +++---------------------- 4 files changed, 39 insertions(+), 99 deletions(-) create mode 100644 cypress/integration/users_test.spec.ts diff --git a/cypress/integration/users_test.spec.ts b/cypress/integration/users_test.spec.ts new file mode 100644 index 0000000000..623a004927 --- /dev/null +++ b/cypress/integration/users_test.spec.ts @@ -0,0 +1,22 @@ +import SidebarPage from "../support/pages/admin_console/SidebarPage"; +import LoginPage from "../support/pages/LoginPage"; + +describe("Users test", () => { + const loginPage = new LoginPage(); + const sidebarPage = new SidebarPage(); + + describe("User creation", () => { + beforeEach(function () { + cy.visit(""); + loginPage.logIn(); + sidebarPage.goToUsers(); + }); + + it("Go to create User page", () => { + cy.get("[data-testid=add-user").click(); + cy.url().should("include", "users/add-user"); + cy.get("[data-testid=cancel-create-user").click(); + cy.url().should("not.include", "/add-user"); + }); + }); +}); diff --git a/src/user/UserForm.tsx b/src/user/UserForm.tsx index 4945fa5a1e..c637d32e86 100644 --- a/src/user/UserForm.tsx +++ b/src/user/UserForm.tsx @@ -6,7 +6,6 @@ import { Select, SelectOption, Switch, - TextArea, TextInput, } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; @@ -219,7 +218,11 @@ export const UserForm = ({ form, save }: UserFormProps) => { - diff --git a/src/user/UsersSection.tsx b/src/user/UsersSection.tsx index 58d2b0b150..4fcba14380 100644 --- a/src/user/UsersSection.tsx +++ b/src/user/UsersSection.tsx @@ -194,7 +194,9 @@ export const UsersSection = () => { toolbarItem={ <> - +