saleor-dashboard/cypress/integration/products/products.js
Karolina 9d01f5b24e
Saleor 2686 tests for navigation (#1022)
* tests for home page

* test for navigation

* tests for navigation

* tests for navigation

* tests for navigation

* tests for navigation
2021-03-26 10:33:35 +01:00

43 lines
1.3 KiB
JavaScript

// <reference types="cypress" />
import { PRODUCTS_SELECTORS } from "../../elements/catalog/products/product-selectors";
import { urlList } from "../../url/urlList";
describe("Products", () => {
beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
});
it("should add new visible product", () => {
cy.visit(urlList.products)
.get(PRODUCTS_SELECTORS.createProductBtn)
.click()
.get(PRODUCTS_SELECTORS.productNameInput)
.click()
.type("Visible test product")
.get(PRODUCTS_SELECTORS.productTypeInput)
.click()
.get(PRODUCTS_SELECTORS.autocompleteDropdown) // trying to fill autocomplete before dropdown will cause error
.get(PRODUCTS_SELECTORS.productTypeInput)
.click()
.type("Cushion")
.get(PRODUCTS_SELECTORS.categoryItem)
.should("have.length", 1)
.get(PRODUCTS_SELECTORS.firstCategoryItem)
.click()
.get(PRODUCTS_SELECTORS.categoryInput)
.click()
.get(PRODUCTS_SELECTORS.categoryItem)
.first()
.click()
.get(PRODUCTS_SELECTORS.channelAvailabilityItem)
.first()
.click()
.get(PRODUCTS_SELECTORS.visibleRadioBtn)
.first()
.click()
.get(PRODUCTS_SELECTORS.saveBtn)
.click()
.get(PRODUCTS_SELECTORS.confirmationMsg)
.contains("Product created");
});
});