Skip to content

Commit

Permalink
distrubutable web - close popup notification and select a value in dr…
Browse files Browse the repository at this point in the history
…opdown menu
  • Loading branch information
kstekovi committed Nov 3, 2023
1 parent 9074705 commit 2ed89f8
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
33 changes: 27 additions & 6 deletions packages/testsuite/cypress/support/form-editing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
Expand Down Expand Up @@ -295,20 +304,32 @@ declare global {
* @param attributeName - specific ID part of form input with text form input.
*/
clearAttribute(formId: string, attributeName: string): Chainable<void>;
/**
* Select value from <select> input which isn't part of a form.
* @category Data inserting
*
* @example The form input have select with id "#dw-routing-select"
* - The elementId is: "dw-routing-select"
* - value: what you want select.
*
* @param elementId - The element ID of section
* @param value - the value which needs to be selected.
*/
selectInDropdownMenuOnPage(elementId: string, value: string): Chainable<void>;
/**
* Select value from <select> 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<void>;
selectInDropdownMenu(formId: string, attributeName: string, value: string): Chainable<void>;
}
}
}
11 changes: 11 additions & 0 deletions packages/testsuite/cypress/support/verification-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -203,6 +209,11 @@ declare global {
* @param expectedRoleName expected roles
*/
verifyUserRole(expectedRoleName: string): void;

/**
* Close all pop-up notifications
*/
closeAllPopUpNotifications(): void;
}
}
}

0 comments on commit 2ed89f8

Please sign in to comment.