2021-04-01 12:33:36 +00:00
|
|
|
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
|
2021-07-12 08:50:50 +00:00
|
|
|
import { selectorWithDataValue } from "../../elements/shared/sharedElements";
|
2021-04-01 12:33:36 +00:00
|
|
|
|
|
|
|
export function fillAutocompleteSelect(selectSelector, option) {
|
|
|
|
cy.get(selectSelector)
|
|
|
|
.click()
|
|
|
|
.get(BUTTON_SELECTORS.selectOption)
|
|
|
|
.should("be.visible");
|
|
|
|
if (option) {
|
2021-04-21 08:02:48 +00:00
|
|
|
cy.get(selectSelector).clearAndType(option);
|
2021-04-01 12:33:36 +00:00
|
|
|
cy.contains(BUTTON_SELECTORS.selectOption, option).click();
|
|
|
|
cy.wrap(option).as("option");
|
|
|
|
} else {
|
|
|
|
cy.get(BUTTON_SELECTORS.selectOption)
|
|
|
|
.first()
|
|
|
|
.invoke("text")
|
|
|
|
.as("option");
|
|
|
|
cy.get(BUTTON_SELECTORS.selectOption)
|
|
|
|
.first()
|
|
|
|
.click();
|
|
|
|
}
|
|
|
|
return cy.get("@option");
|
|
|
|
}
|
2021-07-12 08:50:50 +00:00
|
|
|
|
|
|
|
export function fillBaseSelect(selectSelector, value) {
|
|
|
|
cy.get(selectSelector)
|
|
|
|
.click()
|
|
|
|
.get(selectorWithDataValue(value))
|
|
|
|
.click();
|
|
|
|
}
|
2021-09-08 11:32:05 +00:00
|
|
|
|
|
|
|
export function createNewOption(selectSelector, newOption) {
|
|
|
|
cy.get(selectSelector).type(newOption);
|
|
|
|
cy.contains(BUTTON_SELECTORS.selectOption, newOption)
|
|
|
|
.should("be.visible")
|
|
|
|
.click();
|
|
|
|
}
|