2023-02-07 11:00:34 +00:00
|
|
|
export default class Select {
|
|
|
|
static assertSelectedItem(
|
|
|
|
chain: Cypress.Chainable<JQuery<HTMLElement>>,
|
2023-07-11 14:03:21 +00:00
|
|
|
itemName: string,
|
2023-02-07 11:00:34 +00:00
|
|
|
) {
|
2024-01-12 09:52:50 +00:00
|
|
|
chain.parent().should("have.text", itemName);
|
2023-02-07 11:00:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static selectItem(
|
|
|
|
chain: Cypress.Chainable<JQuery<HTMLElement>>,
|
2023-07-11 14:03:21 +00:00
|
|
|
itemName: string,
|
2023-02-07 11:00:34 +00:00
|
|
|
) {
|
|
|
|
chain.click();
|
|
|
|
this.#getSelectMenu(chain).contains(itemName).click();
|
|
|
|
}
|
|
|
|
|
|
|
|
static #getSelectMenu(chain: Cypress.Chainable<JQuery<HTMLElement>>) {
|
2024-04-05 14:37:05 +00:00
|
|
|
return chain.parent().get(".pf-v5-c-select__menu");
|
2023-02-07 11:00:34 +00:00
|
|
|
}
|
|
|
|
}
|