keycloak-scim/js/apps/admin-ui/cypress/support/forms/Select.ts
Jon Koops d3c2475041
Upgrade admin and account console to PatternFly 5 (#28196)
Closes #21345
Closes #21344

Signed-off-by: Jon Koops <jonkoops@gmail.com>
Co-authored-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Co-authored-by: Mark Franceschelli <mfrances@redhat.com>
Co-authored-by: Hynek Mlnařík <hmlnarik@redhat.com>
Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com>
2024-04-05 16:37:05 +02:00

20 lines
511 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-v5-c-select__menu");
}
}