f2e26b0049
* Cypress tests for masthead. * Update snapshot * Update Keycloak version. * Fix download address * Update start.js Co-authored-by: Erik Jan de Wit <erikjan.dewit@gmail.com> * Follow redirect when downloading keycloak. * Refactor HeaderPage into Masthead and ModalUtils * Minor change to kick off build. * logOutTest no longer needs a param * goToAcctMgtTest no longer needs a param * Update tests/cypress/support/pages/admin_console/Masthead.js Co-authored-by: Aboullos <61687012+Aboullos@users.noreply.github.com> * Update tests/cypress/support/pages/admin_console/Masthead.js Co-authored-by: Aboullos <61687012+Aboullos@users.noreply.github.com> * Fix userDropdown() method * Minor refactor Co-authored-by: Erik Jan de Wit <erikjan.dewit@gmail.com> Co-authored-by: Aboullos <61687012+Aboullos@users.noreply.github.com>
75 lines
2.2 KiB
JavaScript
75 lines
2.2 KiB
JavaScript
import LoginPage from "../support/pages/LoginPage.js";
|
|
import Masthead from "../support/pages/admin_console/Masthead.js";
|
|
import ModalUtils from "../support/util/ModalUtils.js";
|
|
import ListingPage from "../support/pages/admin_console/ListingPage.js";
|
|
import SidebarPage from "../support/pages/admin_console/SidebarPage.js";
|
|
import CreateRealmRolePage from "../support/pages/admin_console/manage/realm_roles/CreateRealmRolePage.js";
|
|
|
|
describe("Realm roles test", function () {
|
|
const itemId = "realm_role_1";
|
|
const loginPage = new LoginPage();
|
|
const masthead = new Masthead();
|
|
const modalUtils = new ModalUtils();
|
|
const sidebarPage = new SidebarPage();
|
|
const listingPage = new ListingPage();
|
|
const createRealmRolePage = new CreateRealmRolePage();
|
|
|
|
describe("Realm roles creation", function () {
|
|
beforeEach(function () {
|
|
cy.visit("");
|
|
});
|
|
|
|
it("should fail creating realm role", function () {
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToRealmRoles();
|
|
|
|
listingPage.goToCreateItem();
|
|
|
|
createRealmRolePage.save().checkRealmRoleNameRequiredMessage();
|
|
|
|
createRealmRolePage.fillRealmRoleData("admin").save();
|
|
|
|
// The error should inform about duplicated name/id (THIS MESSAGE DOES NOT HAVE QUOTES AS THE OTHERS)
|
|
masthead.checkNotificationMessage(
|
|
"Could not create role: Role with name admin already exists"
|
|
);
|
|
});
|
|
|
|
it("should create realm role", function () {
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToRealmRoles();
|
|
|
|
listingPage.itemExist(itemId, false).goToCreateItem();
|
|
|
|
createRealmRolePage.fillRealmRoleData(itemId).save();
|
|
|
|
masthead.checkNotificationMessage("Role created");
|
|
|
|
sidebarPage.goToRealmRoles();
|
|
|
|
listingPage.itemExist(itemId).searchItem(itemId).itemExist(itemId);
|
|
});
|
|
});
|
|
|
|
describe("Realm roles elimination", function () {
|
|
beforeEach(function () {
|
|
cy.visit("");
|
|
});
|
|
|
|
it("should delete realm role", function () {
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToRealmRoles();
|
|
|
|
listingPage.itemExist(itemId).deleteItem(itemId);
|
|
|
|
modalUtils.checkModalTitle("Delete role?").confirmModal();
|
|
|
|
masthead.checkNotificationMessage("The role has been deleted");
|
|
|
|
listingPage.itemExist(itemId, false);
|
|
});
|
|
});
|
|
});
|