saleor-dashboard/cypress/steps/shared/autocompleteSelect.js
Karolina 114476d615
Saleor 2696 tests for product create (#1026)
* test for product create

* tests for creating product

* create new expect product info utils file
2021-04-01 14:33:36 +02:00

22 lines
619 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).type(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");
}