2021-03-03 19:12:16 +00:00
|
|
|
import SidebarPage from "../support/pages/admin_console/SidebarPage";
|
|
|
|
import LoginPage from "../support/pages/LoginPage";
|
2021-03-04 14:26:21 +00:00
|
|
|
import CreateUserPage from "../support/pages/admin_console/manage/users/CreateUserPage";
|
|
|
|
import Masthead from "../support/pages/admin_console/Masthead";
|
|
|
|
import ListingPage from "../support/pages/admin_console/ListingPage";
|
2021-03-11 20:23:08 +00:00
|
|
|
import UserDetailsPage from "../support/pages/admin_console/manage/users/UserDetailsPage";
|
|
|
|
import ModalUtils from "../support/util/ModalUtils";
|
2021-03-18 12:48:14 +00:00
|
|
|
import { keycloakBefore } from "../support/util/keycloak_before";
|
2021-04-14 18:19:39 +00:00
|
|
|
import GroupModal from "../support/pages/admin_console/manage/groups/GroupModal";
|
|
|
|
import UserGroupsPage from "../support/pages/admin_console/manage/users/UserGroupsPage";
|
|
|
|
|
|
|
|
let groupName = "group";
|
|
|
|
|
|
|
|
describe("Group creation", () => {
|
|
|
|
const loginPage = new LoginPage();
|
|
|
|
const masthead = new Masthead();
|
|
|
|
const sidebarPage = new SidebarPage();
|
|
|
|
const listingPage = new ListingPage();
|
|
|
|
const groupModal = new GroupModal();
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToGroups();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Add group to be joined", () => {
|
|
|
|
groupName += "_" + (Math.random() + 1).toString(36).substring(7);
|
|
|
|
|
|
|
|
groupModal
|
|
|
|
.open("openCreateGroupModal")
|
|
|
|
.fillGroupForm(groupName)
|
|
|
|
.clickCreate();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage("Group created");
|
|
|
|
|
|
|
|
sidebarPage.goToGroups();
|
|
|
|
listingPage.searchItem(groupName, false).itemExist(groupName);
|
|
|
|
});
|
|
|
|
});
|
2021-03-03 19:12:16 +00:00
|
|
|
|
|
|
|
describe("Users test", () => {
|
|
|
|
const loginPage = new LoginPage();
|
|
|
|
const sidebarPage = new SidebarPage();
|
2021-03-04 14:26:21 +00:00
|
|
|
const createUserPage = new CreateUserPage();
|
2021-04-14 18:19:39 +00:00
|
|
|
const userGroupsPage = new UserGroupsPage();
|
2021-03-04 14:26:21 +00:00
|
|
|
const masthead = new Masthead();
|
2021-03-11 20:23:08 +00:00
|
|
|
const modalUtils = new ModalUtils();
|
2021-03-04 14:26:21 +00:00
|
|
|
const listingPage = new ListingPage();
|
2021-03-11 20:23:08 +00:00
|
|
|
const userDetailsPage = new UserDetailsPage();
|
2021-03-04 14:26:21 +00:00
|
|
|
|
|
|
|
let itemId = "user_crud";
|
2021-03-03 19:12:16 +00:00
|
|
|
|
|
|
|
describe("User creation", () => {
|
2021-03-11 20:23:08 +00:00
|
|
|
beforeEach(() => {
|
2021-03-18 12:48:14 +00:00
|
|
|
keycloakBefore();
|
2021-03-03 19:12:16 +00:00
|
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToUsers();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Go to create User page", () => {
|
2021-03-04 18:49:05 +00:00
|
|
|
cy.wait(100);
|
|
|
|
|
2021-03-04 14:26:21 +00:00
|
|
|
createUserPage.goToCreateUser();
|
2021-03-03 19:12:16 +00:00
|
|
|
cy.url().should("include", "users/add-user");
|
2021-03-04 14:26:21 +00:00
|
|
|
|
|
|
|
// Verify Cancel button works
|
|
|
|
createUserPage.cancel();
|
2021-03-03 19:12:16 +00:00
|
|
|
cy.url().should("not.include", "/add-user");
|
|
|
|
});
|
2021-03-04 14:26:21 +00:00
|
|
|
|
|
|
|
it("Create user test", function () {
|
|
|
|
itemId += "_" + (Math.random() + 1).toString(36).substring(7);
|
2021-03-04 18:49:05 +00:00
|
|
|
|
2021-03-04 14:26:21 +00:00
|
|
|
// Create
|
2021-03-04 18:49:05 +00:00
|
|
|
cy.wait(100);
|
|
|
|
|
2021-03-04 14:26:21 +00:00
|
|
|
createUserPage.goToCreateUser();
|
2021-03-04 18:49:05 +00:00
|
|
|
|
2021-03-11 20:23:08 +00:00
|
|
|
createUserPage.createUser(itemId).save();
|
2021-03-04 14:26:21 +00:00
|
|
|
|
|
|
|
masthead.checkNotificationMessage("The user has been created");
|
|
|
|
|
2021-03-11 20:23:08 +00:00
|
|
|
sidebarPage.goToUsers();
|
|
|
|
});
|
|
|
|
|
2021-04-14 18:19:39 +00:00
|
|
|
it("User details test", function () {
|
2021-03-11 20:23:08 +00:00
|
|
|
cy.wait(1000);
|
|
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
|
|
|
|
|
|
|
cy.wait(1000);
|
|
|
|
listingPage.goToItemDetails(itemId);
|
|
|
|
|
|
|
|
userDetailsPage.fillUserData().save();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage("The user has been saved");
|
|
|
|
|
2021-03-23 19:02:27 +00:00
|
|
|
cy.wait(1000);
|
|
|
|
|
2021-04-14 18:19:39 +00:00
|
|
|
sidebarPage.goToUsers();
|
|
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
|
|
|
});
|
2021-03-23 19:02:27 +00:00
|
|
|
|
2021-04-14 18:19:39 +00:00
|
|
|
it("Add user to group test", function () {
|
|
|
|
// Go to user groups
|
2021-03-23 19:02:27 +00:00
|
|
|
|
2021-03-04 14:26:21 +00:00
|
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
2021-04-14 18:19:39 +00:00
|
|
|
listingPage.goToItemDetails(itemId);
|
|
|
|
|
|
|
|
userGroupsPage.goToGroupsTab();
|
|
|
|
userGroupsPage.toggleAddGroupModal();
|
|
|
|
cy.getId(`${groupName}`).click();
|
|
|
|
userGroupsPage.joinGroup();
|
|
|
|
|
|
|
|
cy.wait(1000);
|
|
|
|
|
|
|
|
listingPage.itemExist(groupName);
|
|
|
|
});
|
2021-03-11 20:23:08 +00:00
|
|
|
|
2021-04-14 18:19:39 +00:00
|
|
|
it("Leave group test", function () {
|
|
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
|
|
|
listingPage.goToItemDetails(itemId);
|
|
|
|
// Go to user groups
|
|
|
|
userGroupsPage.goToGroupsTab();
|
|
|
|
cy.getId(`leave-${groupName}`).click();
|
|
|
|
cy.getId("modalConfirm").click();
|
|
|
|
});
|
|
|
|
|
2021-04-14 18:39:21 +00:00
|
|
|
it("Go to user consents test", function () {
|
|
|
|
cy.wait(1000);
|
2021-04-14 18:19:39 +00:00
|
|
|
listingPage.searchItem(itemId).itemExist(itemId);
|
2021-04-14 18:39:21 +00:00
|
|
|
|
|
|
|
cy.wait(1000);
|
|
|
|
listingPage.goToItemDetails(itemId);
|
|
|
|
|
|
|
|
cy.getId("user-consents-tab").click();
|
|
|
|
|
|
|
|
cy.getId("empty-state").contains("No consents");
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Delete user test", function () {
|
2021-03-11 20:23:08 +00:00
|
|
|
// Delete
|
|
|
|
cy.wait(1000);
|
|
|
|
listingPage.deleteItem(itemId);
|
|
|
|
|
|
|
|
modalUtils.checkModalTitle("Delete user?").confirmModal();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage("The user has been deleted");
|
|
|
|
|
|
|
|
listingPage.itemExist(itemId, false);
|
2021-03-04 14:26:21 +00:00
|
|
|
});
|
2021-03-03 19:12:16 +00:00
|
|
|
});
|
2021-04-14 18:19:39 +00:00
|
|
|
});
|