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", () => { it("should enable delete account", () => {
const action = "Delete Account"; const action = "Delete Account";
requiredActionsPage.enableAction(action); requiredActionsPage.switchAction(action);
masthead.checkNotificationMessage("Updated required action successfully"); masthead.checkNotificationMessage("Updated required action successfully");
requiredActionsPage.isChecked(action); requiredActionsPage.isChecked(action);
}); });
it("should register an unregistered action", () => { it("should register an unregistered action", () => {
const action = "Verify Profile"; 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"); masthead.checkNotificationMessage("Updated required action successfully");
requiredActionsPage.isChecked(action).isDefaultEnabled(action); requiredActionsPage.isChecked(action).isDefaultEnabled(action);
}); });

View file

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

View file

@ -48,9 +48,9 @@ export default class ListingPage extends CommonElements {
#listHeaderSecondaryBtn = #listHeaderSecondaryBtn =
".pf-c-page__main .pf-c-toolbar__content-section .pf-m-link"; ".pf-c-page__main .pf-c-toolbar__content-section .pf-m-link";
#previousPageBtn = #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 = #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"; public tableRowItem = "tbody tr[data-ouia-component-type]:visible";
#table = "table[aria-label]"; #table = "table[aria-label]";
#filterSessionDropdownButton = ".pf-c-select button:nth-child(1)"; #filterSessionDropdownButton = ".pf-c-select button:nth-child(1)";
@ -72,7 +72,8 @@ export default class ListingPage extends CommonElements {
} }
showNextPageTableItems() { showNextPageTableItems() {
cy.get(this.#nextPageBtn).first().click(); cy.get(this.#nextPageBtn).scrollIntoView();
cy.get(this.#nextPageBtn).click();
return this; return this;
} }

View file

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