keycloak-scim/js/apps/admin-ui/cypress/support/forms/Select.ts
Erik Jan de Wit 118965ca7e
refactored authentication to use the ui-shared (#25730)
Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
2024-01-12 10:52:50 +01:00

20 lines
508 B
TypeScript

export default class Select {
static assertSelectedItem(
chain: Cypress.Chainable<JQuery<HTMLElement>>,
itemName: string,
) {
chain.parent().should("have.text", itemName);
}
static selectItem(
chain: Cypress.Chainable<JQuery<HTMLElement>>,
itemName: string,
) {
chain.click();
this.#getSelectMenu(chain).contains(itemName).click();
}
static #getSelectMenu(chain: Cypress.Chainable<JQuery<HTMLElement>>) {
return chain.parent().get(".pf-c-select__menu");
}
}