saleor-dashboard/cypress/steps/shared/autocompleteSelect.js
Karolina Rakoczy 4013105844
Saleor 2697 tests for updating products (#1060)
* updating products

* updating products

* test for updating
2021-04-21 10:02:48 +02:00

22 lines
627 B
JavaScript

import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
export function fillAutocompleteSelect(selectSelector, option) {
cy.get(selectSelector)
.click()
.get(BUTTON_SELECTORS.selectOption)
.should("be.visible");
if (option) {
cy.get(selectSelector).clearAndType(option);
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");
}