Add actions for flaky Admin UI tests (#26778)

Signed-off-by: Alfredo Moises Boullosa <aboullos@redhat.com>
This commit is contained in:
Aboullos 2024-02-05 16:37:16 +01:00 committed by GitHub
parent be66bf1957
commit ac6f16df70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 20 additions and 13 deletions

View file

@ -224,14 +224,17 @@ describe("Required actions", () => {
it("should enable delete account", () => {
const action = "Delete Account";
requiredActionsPage.enableAction(action);
requiredActionsPage.switchAction(action);
masthead.checkNotificationMessage("Updated required action successfully");
requiredActionsPage.isChecked(action);
});
it("should register an unregistered action", () => {
const action = "Verify Profile";
requiredActionsPage.enableAction(action);
requiredActionsPage.isChecked(action).isDefaultEnabled(action);
requiredActionsPage.switchAction(action);
masthead.checkNotificationMessage("Updated required action successfully");
requiredActionsPage.switchAction(action);
masthead.checkNotificationMessage("Updated required action successfully");
requiredActionsPage.isChecked(action).isDefaultEnabled(action);
});

View file

@ -81,6 +81,8 @@ describe("Realm tests", () => {
});
it("Should delete Test Disabled realm", () => {
cy.reload();
sidebarPage.waitForPageLoad();
sidebarPage.goToRealm(testDisabledName).goToRealmSettings();
realmSettings.clickActionMenu();
cy.findByText("Delete").click();

View file

@ -48,9 +48,9 @@ export default class ListingPage extends CommonElements {
#listHeaderSecondaryBtn =
".pf-c-page__main .pf-c-toolbar__content-section .pf-m-link";
#previousPageBtn =
"div[class=pf-c-pagination__nav-control] button[data-action=previous]:visible";
".pf-c-pagination:not([class*=pf-m-bottom]) button[data-action=previous]";
#nextPageBtn =
"div[class=pf-c-pagination__nav-control] button[data-action=next]:visible";
".pf-c-pagination:not([class*=pf-m-bottom]) button[data-action=next]";
public tableRowItem = "tbody tr[data-ouia-component-type]:visible";
#table = "table[aria-label]";
#filterSessionDropdownButton = ".pf-c-select button:nth-child(1)";
@ -72,7 +72,8 @@ export default class ListingPage extends CommonElements {
}
showNextPageTableItems() {
cy.get(this.#nextPageBtn).first().click();
cy.get(this.#nextPageBtn).scrollIntoView();
cy.get(this.#nextPageBtn).click();
return this;
}

View file

@ -7,10 +7,10 @@ export default class RequiredActions {
return name.replace(/\s/g, "-");
}
#getEnabled(name: string) {
#getEnabledSwitch(name: string) {
return `#enable-${this.#toKey(name)}`;
}
#getDefault(name: string) {
#getDefaultSwitch(name: string) {
return `#default-${this.#toKey(name)}`;
}
@ -18,28 +18,29 @@ export default class RequiredActions {
cy.findByTestId("requiredActions").click();
}
enableAction(name: string) {
cy.get(this.#getEnabled(name)).click({ force: true });
switchAction(name: string) {
cy.get(this.#getEnabledSwitch(name)).scrollIntoView();
cy.get(this.#getEnabledSwitch(name)).click({ force: true });
return this;
}
isChecked(name: string) {
cy.get(this.#getEnabled(name)).should("be.checked");
cy.get(this.#getEnabledSwitch(name)).should("be.checked");
return this;
}
isDefaultEnabled(name: string) {
cy.get(this.#getDefault(name)).should("be.enabled");
cy.get(this.#getDefaultSwitch(name)).should("be.enabled");
return this;
}
setAsDefault(name: string) {
cy.get(this.#getDefault(name)).click({ force: true });
cy.get(this.#getDefaultSwitch(name)).click({ force: true });
return this;
}
isDefaultChecked(name: string) {
cy.get(this.#getEnabled(name)).should("be.checked");
cy.get(this.#getEnabledSwitch(name)).should("be.checked");
return this;
}