diff --git a/packages/testsuite/cypress/e2e/distributable-web/test-configuration-subsystem-distributable-web-routing.cy.ts b/packages/testsuite/cypress/e2e/distributable-web/test-configuration-subsystem-distributable-web-routing.cy.ts index e20ffd563..9f161a9a1 100644 --- a/packages/testsuite/cypress/e2e/distributable-web/test-configuration-subsystem-distributable-web-routing.cy.ts +++ b/packages/testsuite/cypress/e2e/distributable-web/test-configuration-subsystem-distributable-web-routing.cy.ts @@ -87,7 +87,7 @@ describe("TESTS: Configuration => Subsystem => Distributable Web => Routing", () it("Switch routing to Infinispan", () => { cy.navigateTo(managementEndpoint, "distributable-web"); cy.get("#dw-routing-item").click(); - cy.get("#dw-routing-select").select("Infinispan", { force: true }); + cy.selectInDropdownMenuOnPage("dw-routing-select", "Infinispan"); cy.text("dw-routing-infinispan-add", "cache-container", cacheContainers.create.name); cy.confirmAddResourceWizard(); cy.verifySuccess(); @@ -145,7 +145,7 @@ describe("TESTS: Configuration => Subsystem => Distributable Web => Routing", () }); cy.navigateTo(managementEndpoint, "distributable-web"); cy.get("#dw-routing-item").click(); - cy.get("#dw-routing-select").select("local", { force: true }); + cy.selectInDropdownMenuOnPage("dw-routing-select", "local"); cy.verifySuccess(); cy.validateAddress(managementEndpoint, ["subsystem", "distributable-web", "routing", "local"], true); }); diff --git a/packages/testsuite/cypress/e2e/elytron-oidc-client/test-oidc-security-configure-oidc.cy.ts b/packages/testsuite/cypress/e2e/elytron-oidc-client/test-oidc-security-configure-oidc.cy.ts index 50242d907..51f212635 100644 --- a/packages/testsuite/cypress/e2e/elytron-oidc-client/test-oidc-security-configure-oidc.cy.ts +++ b/packages/testsuite/cypress/e2e/elytron-oidc-client/test-oidc-security-configure-oidc.cy.ts @@ -106,7 +106,7 @@ describe("TESTS: Access secured by Elytron OIDC client, performed in Web Console cy.addInTable("model-browser-children-table"); cy.text(secureDeployment.id, secureDeployment.resource, "wildfly-management"); cy.get(optionalFields).click(); - cy.selectText(secureDeployment.id, secureDeployment.sslRequired, "EXTERNAL"); + cy.selectInDropdownMenu(secureDeployment.id, secureDeployment.sslRequired, "EXTERNAL"); cy.text(secureDeployment.id, secureDeployment.principal, "preferred_username"); cy.text(secureDeployment.id, secureDeployment.provider, "keycloak"); cy.text(secureDeployment.id, secureDeployment.clientId, "wildfly-management"); diff --git a/packages/testsuite/cypress/support/form-editing.ts b/packages/testsuite/cypress/support/form-editing.ts index 7468343a0..129b0ba28 100644 --- a/packages/testsuite/cypress/support/form-editing.ts +++ b/packages/testsuite/cypress/support/form-editing.ts @@ -163,10 +163,19 @@ Cypress.Commands.add("clearListAttributeItems", (attributeName) => { }); }); -Cypress.Commands.add("selectText", (formId, attributeName, value) => { - cy.formInput(formId, attributeName).select(value, { force: true }); - cy.formInput(formId, attributeName).should("have.value", value); - cy.formInput(formId, attributeName).trigger("change", { force: true }); +Cypress.Commands.add("selectInDropdownMenuOnPage", (elementId, value) => { + // somtimes can be the dropdown menu behind a pop-up alert notification. So we need close them. + cy.closeAllPopUpNotifications(); + cy.get(`button[data-id="${elementId}"]`).click(); + cy.get(`button[data-id="${elementId}"]`) + .parent() + .within(() => { + cy.get(`a.dropdown-item`).contains(value).click(); + }); +}); + +Cypress.Commands.add("selectInDropdownMenu", (formId, attributeName, value) => { + cy.selectInDropdownMenuOnPage(`${formId}-${attributeName}-editing`, value); }); export {}; @@ -295,20 +304,32 @@ declare global { * @param attributeName - specific ID part of form input with text form input. */ clearAttribute(formId: string, attributeName: string): Chainable; + /** + * Select value from form input. * @category Data inserting * * @example The form input have select with id "#model-browser-root-secure-server-add-ssl-required-editing"" * - The formId is: "model-browser-root-provider-add" - * - The attributeName is: "auth-server-url" + * - The fieledName is: "auth-server-url" * - value: what you want write to input * * @param formId - The ID of section which contain form inputs. * @param attributeName - specific ID part of form input with select input. * @param value - the value which needs to be selected. */ - selectText(formId: string, attributeName: string, value: string): Chainable; + selectInDropdownMenu(formId: string, attributeName: string, value: string): Chainable; } } } diff --git a/packages/testsuite/cypress/support/verification-utils.ts b/packages/testsuite/cypress/support/verification-utils.ts index 44e0c9c3e..328c14b39 100644 --- a/packages/testsuite/cypress/support/verification-utils.ts +++ b/packages/testsuite/cypress/support/verification-utils.ts @@ -83,6 +83,12 @@ Cypress.Commands.add("verifyUserRole", (expectedRoleName) => { }); }); +Cypress.Commands.add("closeAllPopUpNotifications", () => { + cy.get(".alert.alert-dismissable").each(($popupNotification) => { + $popupNotification.find(".close").trigger("click"); + }); +}); + export {}; declare global { @@ -203,6 +209,11 @@ declare global { * @param expectedRoleName expected roles */ verifyUserRole(expectedRoleName: string): void; + + /** + * Close all pop-up notifications + */ + closeAllPopUpNotifications(): void; } } }