Fix realm_test in cypress (#26400)
Signed-off-by: Alfredo Moises Boullosa <aboullos@redhat.com>
This commit is contained in:
parent
f496e46dbb
commit
74e3b97d54
4 changed files with 42 additions and 24 deletions
|
@ -34,23 +34,20 @@ describe("Realm tests", () => {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
it("should fail creating Master realm", () => {
|
it("should fail creating duplicated or empty name realm", () => {
|
||||||
sidebarPage.goToCreateRealm();
|
sidebarPage.goToCreateRealm();
|
||||||
|
|
||||||
|
createRealmPage.createRealm().verifyRealmNameFieldInvalid();
|
||||||
|
|
||||||
createRealmPage.fillRealmName("master").createRealm();
|
createRealmPage.fillRealmName("master").createRealm();
|
||||||
|
|
||||||
masthead.checkNotificationMessage(
|
masthead.checkNotificationMessage(
|
||||||
"Could not create realm Conflict detected. See logs for details",
|
"Could not create realm Conflict detected. See logs for details",
|
||||||
);
|
);
|
||||||
|
|
||||||
createRealmPage.cancelRealmCreation();
|
createRealmPage.cancelRealmCreation();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should fail creating realm with empty name", () => {
|
|
||||||
sidebarPage.goToCreateRealm();
|
|
||||||
createRealmPage.createRealm();
|
|
||||||
|
|
||||||
createRealmPage.verifyRealmNameFieldInvalid();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should create Test realm", () => {
|
it("should create Test realm", () => {
|
||||||
sidebarPage.goToCreateRealm();
|
sidebarPage.goToCreateRealm();
|
||||||
|
|
||||||
|
@ -63,24 +60,27 @@ describe("Realm tests", () => {
|
||||||
masthead.checkNotificationMessage("Realm created successfully");
|
masthead.checkNotificationMessage("Realm created successfully");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should create Test Disabled realm", () => {
|
it("CRUD test of Disabled realm", () => {
|
||||||
sidebarPage.goToCreateRealm();
|
sidebarPage.goToCreateRealm();
|
||||||
sidebarPage.waitForPageLoad();
|
sidebarPage.waitForPageLoad();
|
||||||
|
|
||||||
createRealmPage.fillRealmName(testDisabledName).createRealm();
|
createRealmPage.fillRealmName(testDisabledName).createRealm();
|
||||||
createRealmPage.disableRealm();
|
|
||||||
|
|
||||||
masthead.checkNotificationMessage("Realm created successfully");
|
masthead.checkNotificationMessage("Realm created successfully");
|
||||||
});
|
|
||||||
|
|
||||||
it("Should cancel deleting Test Disabled realm", () => {
|
cy.reload();
|
||||||
|
sidebarPage.goToRealm(testDisabledName).goToRealmSettings();
|
||||||
|
|
||||||
|
createRealmPage.disableRealm();
|
||||||
|
modalUtils.confirmModal();
|
||||||
|
|
||||||
|
masthead.checkNotificationMessage("Realm successfully updated");
|
||||||
|
|
||||||
sidebarPage.goToRealm(testDisabledName).goToRealmSettings();
|
sidebarPage.goToRealm(testDisabledName).goToRealmSettings();
|
||||||
realmSettings.clickActionMenu();
|
realmSettings.clickActionMenu();
|
||||||
cy.findByText("Delete").click();
|
cy.findByText("Delete").click();
|
||||||
modalUtils.cancelModal();
|
modalUtils.cancelModal();
|
||||||
});
|
|
||||||
|
|
||||||
it("Should delete Test Disabled realm", () => {
|
|
||||||
cy.reload();
|
cy.reload();
|
||||||
sidebarPage.waitForPageLoad();
|
sidebarPage.waitForPageLoad();
|
||||||
sidebarPage.goToRealm(testDisabledName).goToRealmSettings();
|
sidebarPage.goToRealm(testDisabledName).goToRealmSettings();
|
||||||
|
@ -90,7 +90,7 @@ describe("Realm tests", () => {
|
||||||
masthead.checkNotificationMessage("The realm has been deleted");
|
masthead.checkNotificationMessage("The realm has been deleted");
|
||||||
|
|
||||||
// Show current realms
|
// Show current realms
|
||||||
sidebarPage.showCurrentRealms(2);
|
sidebarPage.realmExists("Test-Disabled", false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should create realm from new a realm", () => {
|
it("should create realm from new a realm", () => {
|
||||||
|
|
|
@ -2,7 +2,7 @@ export default class CreateRealmPage {
|
||||||
#clearBtn = ".pf-c-file-upload__file-select button:last-child";
|
#clearBtn = ".pf-c-file-upload__file-select button:last-child";
|
||||||
#modalClearBtn = "clear-button";
|
#modalClearBtn = "clear-button";
|
||||||
#realmNameInput = "#kc-realm-name";
|
#realmNameInput = "#kc-realm-name";
|
||||||
#enabledSwitch = '[for="kc-realm-enabled-switch"] span.pf-c-switch__toggle';
|
#enabledSwitch = ".pf-c-toolbar .pf-c-switch__toggle";
|
||||||
#createBtn = '.pf-c-form__group:last-child button[type="submit"]';
|
#createBtn = '.pf-c-form__group:last-child button[type="submit"]';
|
||||||
#cancelBtn = '.pf-c-form__group:last-child button[type="button"]';
|
#cancelBtn = '.pf-c-form__group:last-child button[type="button"]';
|
||||||
#codeEditor = ".pf-c-code-editor__code";
|
#codeEditor = ".pf-c-code-editor__code";
|
||||||
|
|
|
@ -72,8 +72,12 @@ export default class ListingPage extends CommonElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
showNextPageTableItems() {
|
showNextPageTableItems() {
|
||||||
cy.get(this.#nextPageBtn).scrollIntoView();
|
cy.get("body").then(($body) => {
|
||||||
cy.get(this.#nextPageBtn).click();
|
if (!$body.find('[data-testid="' + this.#nextPageBtn + '"]').length) {
|
||||||
|
cy.get(this.#nextPageBtn).scrollIntoView();
|
||||||
|
cy.get(this.#nextPageBtn).click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,13 +17,29 @@ export default class SidebarPage extends CommonElements {
|
||||||
#identityProvidersBtn = "#nav-item-identity-providers";
|
#identityProvidersBtn = "#nav-item-identity-providers";
|
||||||
#userFederationBtn = "#nav-item-user-federation";
|
#userFederationBtn = "#nav-item-user-federation";
|
||||||
|
|
||||||
|
realmsElements = '[data-testid="realmSelector"] li';
|
||||||
|
|
||||||
showCurrentRealms(length: number) {
|
showCurrentRealms(length: number) {
|
||||||
cy.findByTestId(this.#realmsDrpDwn).click();
|
cy.findByTestId(this.#realmsDrpDwn).click();
|
||||||
cy.get('[data-testid="realmSelector"] li').should(
|
cy.get(this.realmsElements).contains("Loading realms…").should("not.exist");
|
||||||
|
cy.get(this.realmsElements).should(
|
||||||
"have.length",
|
"have.length",
|
||||||
length + 1, // account for button
|
length + 1, // account for button
|
||||||
);
|
);
|
||||||
cy.findByTestId(this.#realmsDrpDwn).click({ force: true });
|
cy.findByTestId(this.#realmsDrpDwn).click({ force: true });
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
realmExists(realmName: string, exists = true) {
|
||||||
|
cy.findByTestId(this.#realmsDrpDwn).click();
|
||||||
|
cy.get(this.realmsElements).contains("Loading realms…").should("not.exist");
|
||||||
|
cy.get(this.realmsElements)
|
||||||
|
.contains(realmName)
|
||||||
|
.should((exists ? "" : "not.") + "exist");
|
||||||
|
cy.findByTestId(this.#realmsDrpDwn).click();
|
||||||
|
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
getCurrentRealm() {
|
getCurrentRealm() {
|
||||||
|
@ -32,11 +48,9 @@ export default class SidebarPage extends CommonElements {
|
||||||
|
|
||||||
goToRealm(realmName: string) {
|
goToRealm(realmName: string) {
|
||||||
this.waitForPageLoad();
|
this.waitForPageLoad();
|
||||||
cy.findByTestId(this.#realmsDrpDwn)
|
cy.findByTestId(this.#realmsDrpDwn).click();
|
||||||
.click()
|
cy.get(this.realmsElements).contains("Loading realms…").should("not.exist");
|
||||||
.parent()
|
cy.get(this.realmsElements).contains(realmName).click();
|
||||||
.contains(realmName)
|
|
||||||
.click();
|
|
||||||
this.waitForPageLoad();
|
this.waitForPageLoad();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in a new issue