Add realm selector tests (#2362)
This commit is contained in:
parent
bb226b52ff
commit
77ef19e0e6
5 changed files with 96 additions and 7 deletions
|
@ -29,7 +29,7 @@ const modalUtils = new ModalUtils();
|
||||||
const createRealmRolePage = new CreateRealmRolePage();
|
const createRealmRolePage = new CreateRealmRolePage();
|
||||||
|
|
||||||
describe("Clients test", () => {
|
describe("Clients test", () => {
|
||||||
describe.skip("Client details - Client scopes subtab", () => {
|
describe("Client details - Client scopes subtab", () => {
|
||||||
const clientScopesTab = new ClientScopesTab();
|
const clientScopesTab = new ClientScopesTab();
|
||||||
const clientId = "client-scopes-subtab-test";
|
const clientId = "client-scopes-subtab-test";
|
||||||
const clientScopeName = "client-scope-test";
|
const clientScopeName = "client-scope-test";
|
||||||
|
@ -203,7 +203,7 @@ describe("Clients test", () => {
|
||||||
});*/
|
});*/
|
||||||
});
|
});
|
||||||
|
|
||||||
describe.skip("Client creation", () => {
|
describe("Client creation", () => {
|
||||||
before(() => {
|
before(() => {
|
||||||
keycloakBefore();
|
keycloakBefore();
|
||||||
loginPage.logIn();
|
loginPage.logIn();
|
||||||
|
@ -356,10 +356,7 @@ describe("Clients test", () => {
|
||||||
.searchItem("", false);
|
.searchItem("", false);
|
||||||
|
|
||||||
initialAccessTokenTab.getFirstId((id) => {
|
initialAccessTokenTab.getFirstId((id) => {
|
||||||
listingPage
|
listingPage.checkRowColumnValue(id, 4, "4").itemExist(id);
|
||||||
.checkRowColumnValue(id, 4, "3")
|
|
||||||
.checkRowColumnValue(id, 5, "3")
|
|
||||||
.itemExist(id);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listingPage.goToCreateItem();
|
listingPage.goToCreateItem();
|
||||||
|
|
|
@ -4,11 +4,15 @@ import CreateRealmPage from "../support/pages/admin_console/CreateRealmPage";
|
||||||
import Masthead from "../support/pages/admin_console/Masthead";
|
import Masthead from "../support/pages/admin_console/Masthead";
|
||||||
import adminClient from "../support/util/AdminClient";
|
import adminClient from "../support/util/AdminClient";
|
||||||
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
||||||
|
import RealmSettings from "../support/pages/admin_console/configure/realm_settings/RealmSettings";
|
||||||
|
import ModalUtils from "../support/util/ModalUtils";
|
||||||
|
|
||||||
const masthead = new Masthead();
|
const masthead = new Masthead();
|
||||||
const loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
const sidebarPage = new SidebarPage();
|
const sidebarPage = new SidebarPage();
|
||||||
const createRealmPage = new CreateRealmPage();
|
const createRealmPage = new CreateRealmPage();
|
||||||
|
const realmSettings = new RealmSettings();
|
||||||
|
const modalUtils = new ModalUtils();
|
||||||
|
|
||||||
describe("Realms test", () => {
|
describe("Realms test", () => {
|
||||||
const testRealmName =
|
const testRealmName =
|
||||||
|
@ -40,13 +44,53 @@ describe("Realms test", () => {
|
||||||
cy.reload();
|
cy.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should fail creating realm with empty name", () => {
|
||||||
|
sidebarPage.goToCreateRealm();
|
||||||
|
createRealmPage.createRealm();
|
||||||
|
|
||||||
|
createRealmPage.verifyRealmNameFieldInvalid();
|
||||||
|
cy.reload();
|
||||||
|
});
|
||||||
|
|
||||||
it("should create Test realm", () => {
|
it("should create Test realm", () => {
|
||||||
sidebarPage.goToCreateRealm();
|
sidebarPage.goToCreateRealm();
|
||||||
|
|
||||||
|
// Test and clear resource field
|
||||||
|
createRealmPage.fillCodeEditor();
|
||||||
|
createRealmPage.clearTextField();
|
||||||
|
|
||||||
createRealmPage.fillRealmName(testRealmName).createRealm();
|
createRealmPage.fillRealmName(testRealmName).createRealm();
|
||||||
|
|
||||||
masthead.checkNotificationMessage("Realm created");
|
masthead.checkNotificationMessage("Realm created");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should create Test Disabled realm", () => {
|
||||||
|
sidebarPage.goToCreateRealm();
|
||||||
|
createRealmPage.fillRealmName("Test Disabled").createRealm();
|
||||||
|
createRealmPage.disableRealm();
|
||||||
|
|
||||||
|
masthead.checkNotificationMessage("Realm created");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should cancel deleting Test Disabled realm", () => {
|
||||||
|
sidebarPage.goToRealmSettings();
|
||||||
|
realmSettings.clickActionMenu();
|
||||||
|
cy.findByText("Delete").click();
|
||||||
|
modalUtils.cancelModal();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should delete Test Disabled realm", () => {
|
||||||
|
sidebarPage.goToRealmSettings();
|
||||||
|
realmSettings.clickActionMenu();
|
||||||
|
cy.findByText("Delete").click();
|
||||||
|
modalUtils.confirmModal();
|
||||||
|
masthead.checkNotificationMessage("The realm has been deleted");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should update realms on delete", () => {
|
||||||
|
sidebarPage.showCurrentRealms(2);
|
||||||
|
});
|
||||||
|
|
||||||
it("should create realm from new a realm", () => {
|
it("should create realm from new a realm", () => {
|
||||||
sidebarPage.goToCreateRealm();
|
sidebarPage.goToCreateRealm();
|
||||||
createRealmPage.fillRealmName(newRealmName).createRealm();
|
createRealmPage.fillRealmName(newRealmName).createRealm();
|
||||||
|
@ -66,6 +110,10 @@ describe("Realms test", () => {
|
||||||
cy.wait(["@fetch"]);
|
cy.wait(["@fetch"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Should show current realms", () => {
|
||||||
|
sidebarPage.showCurrentRealms(4);
|
||||||
|
});
|
||||||
|
|
||||||
it("should change to Test realm", () => {
|
it("should change to Test realm", () => {
|
||||||
sidebarPage.getCurrentRealm().should("eq", editedRealmName);
|
sidebarPage.getCurrentRealm().should("eq", editedRealmName);
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
export default class CreateRealmPage {
|
export default class CreateRealmPage {
|
||||||
private browseBtn = "#kc-realm-filename-browse-button";
|
private browseBtn = "#kc-realm-filename-browse-button";
|
||||||
private clearBtn = ".pf-c-file-upload__file-select button:last-child";
|
private clearBtn = ".pf-c-file-upload__file-select button:last-child";
|
||||||
|
private modalClearBtn = "clear-button";
|
||||||
private realmFileNameInput = "#kc-realm-filename";
|
private realmFileNameInput = "#kc-realm-filename";
|
||||||
private realmNameInput = "#kc-realm-name";
|
private realmNameInput = "#kc-realm-name";
|
||||||
private enabledSwitch =
|
private enabledSwitch =
|
||||||
'[for="kc-realm-enabled-switch"] span.pf-c-switch__toggle';
|
'[for="kc-realm-enabled-switch"] span.pf-c-switch__toggle';
|
||||||
private createBtn = '.pf-c-form__group:last-child button[type="submit"]';
|
private createBtn = '.pf-c-form__group:last-child button[type="submit"]';
|
||||||
private cancelBtn = '.pf-c-form__group:last-child button[type="button"]';
|
private cancelBtn = '.pf-c-form__group:last-child button[type="button"]';
|
||||||
|
private codeEditor = ".pf-c-code-editor__code";
|
||||||
|
|
||||||
fillRealmName(realmName: string) {
|
fillRealmName(realmName: string) {
|
||||||
cy.get(this.realmNameInput).clear().type(realmName);
|
cy.get(this.realmNameInput).clear().type(realmName);
|
||||||
|
@ -14,15 +16,43 @@ export default class CreateRealmPage {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fillCodeEditor() {
|
||||||
|
cy.get(this.codeEditor).click().type("clear this field");
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
createRealm() {
|
createRealm() {
|
||||||
cy.get(this.createBtn).click();
|
cy.get(this.createBtn).click();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disableRealm() {
|
||||||
|
cy.get(this.enabledSwitch).click();
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
cancelRealmCreation() {
|
cancelRealmCreation() {
|
||||||
cy.get(this.cancelBtn).click();
|
cy.get(this.cancelBtn).click();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearTextField() {
|
||||||
|
cy.get(this.clearBtn).click();
|
||||||
|
cy.findByTestId(this.modalClearBtn).click();
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
verifyRealmNameFieldInvalid() {
|
||||||
|
cy.get(this.realmNameInput)
|
||||||
|
.next("div")
|
||||||
|
.contains("Required field")
|
||||||
|
.should("have.class", "pf-m-error");
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,14 @@ export default class SidebarPage {
|
||||||
private identityProvidersBtn = "#nav-item-identity-providers";
|
private identityProvidersBtn = "#nav-item-identity-providers";
|
||||||
private userFederationBtn = "#nav-item-user-federation";
|
private userFederationBtn = "#nav-item-user-federation";
|
||||||
|
|
||||||
|
showCurrentRealms(length: number) {
|
||||||
|
cy.get(this.realmsDrpDwn).scrollIntoView().click({ force: true });
|
||||||
|
cy.get(this.realmsList)
|
||||||
|
.children("li")
|
||||||
|
.should("have.length", length + 1); // account for button
|
||||||
|
cy.get(this.realmsDrpDwn).click({ force: true });
|
||||||
|
}
|
||||||
|
|
||||||
getCurrentRealm() {
|
getCurrentRealm() {
|
||||||
return cy.get(this.realmsDrpDwn).scrollIntoView().invoke("text");
|
return cy.get(this.realmsDrpDwn).scrollIntoView().invoke("text");
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@ export const FileUploadForm = ({
|
||||||
<Button
|
<Button
|
||||||
key="confirm"
|
key="confirm"
|
||||||
variant="primary"
|
variant="primary"
|
||||||
|
data-testid="clear-button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setFileUpload(defaultUpload);
|
setFileUpload(defaultUpload);
|
||||||
onChange("");
|
onChange("");
|
||||||
|
@ -91,7 +92,12 @@ export const FileUploadForm = ({
|
||||||
>
|
>
|
||||||
{t("clear")}
|
{t("clear")}
|
||||||
</Button>,
|
</Button>,
|
||||||
<Button key="cancel" variant="link" onClick={removeDialog}>
|
<Button
|
||||||
|
data-testid="cancel"
|
||||||
|
key="cancel"
|
||||||
|
variant="link"
|
||||||
|
onClick={removeDialog}
|
||||||
|
>
|
||||||
{t("cancel")}
|
{t("cancel")}
|
||||||
</Button>,
|
</Button>,
|
||||||
]}
|
]}
|
||||||
|
|
Loading…
Reference in a new issue