From 91460bd8b1e932dcd12ba36fc57064ec95f417ab Mon Sep 17 00:00:00 2001 From: Karolina Rakoczy Date: Wed, 17 Feb 2021 13:50:57 +0100 Subject: [PATCH] add data-test-id --- cypress/integration/productsVariants.js | 59 +++++++------------ .../ProductStocks/ProductStocks.tsx | 1 + .../ProductVariantCreatorPage.tsx | 1 + .../ProductVariantCreatorSummary.tsx | 1 + 4 files changed, 24 insertions(+), 38 deletions(-) diff --git a/cypress/integration/productsVariants.js b/cypress/integration/productsVariants.js index 16e5b5a8c..63d6b025d 100644 --- a/cypress/integration/productsVariants.js +++ b/cypress/integration/productsVariants.js @@ -1,10 +1,9 @@ import faker from "faker"; +import { visit } from "graphql"; import Channels from "../apiRequests/Channels"; import Product from "../apiRequests/Product"; import ShopInfo from "../apiRequests/ShopInfo"; -import { PRODUCTS_SELECTORS } from "../elements/catalog/product-selectors"; -import { VARIANTS_SELECTORS } from "../elements/catalog/variants-selectors"; import VariantsSteps from "../steps/products/VariantsSteps"; import { urlList } from "../url/url-list"; import ChannelsUtils from "../utils/channelsUtils"; @@ -84,24 +83,6 @@ describe("creating variants", () => { ); cy.visit(`${urlList.products}${productId}`); variantsSteps.createFirstVariant(warehouse.id); - // .get(PRODUCTS_SELECTORS.addVariantsButton) - // .click() - // .get(VARIANTS_SELECTORS.attributeCheckbox) - // .first() - // .click() - // .get(VARIANTS_SELECTORS.nextButton) - // .click() - // .get(VARIANTS_SELECTORS.priceInput) - // .type(10) - // .get(`[name*='${warehouseId}']`) - // .click() - // .get(VARIANTS_SELECTORS.nextButton) - // .click() - // .get(VARIANTS_SELECTORS.skuInput) - // .type(name) - // .get(VARIANTS_SELECTORS.nextButton) - // .click() - // .waitForGraph("ProductVariantBulkCreate") cy.getProductDetails(product.id, defaultChannel.slug).then( productDetailsResp => { expect(productDetailsResp.body[0].data.product.name).to.equal(name); @@ -133,24 +114,6 @@ describe("creating variants", () => { .then(() => { cy.visit(`${urlList.products}${productId}`); variantsSteps.createVariant(secondVariantSku, warehouse.name); - // .get(PRODUCTS_SELECTORS.addVariantsButton) - // .click() - // .get(VARIANTS_SELECTORS.attributeSelector) - // .click() - // .get(VARIANTS_SELECTORS.attributeOption) - // .first() - // .click() - // .get(VARIANTS_SELECTORS.priceInput) - // .type(10) - // .get(VARIANTS_SELECTORS.skuInputInAddVariant) - // .type(secondVariantSku) - // .get(VARIANTS_SELECTORS.addWarehouseButton) - // .click() - // .get(VARIANTS_SELECTORS.warehouseOption) - // .contains(name) - // .click() - // .get(VARIANTS_SELECTORS.saveButton) - // .click() }) .then(() => cy.getProductDetails(productId, defaultChannel.slug)) .then(productDetailsResp => { @@ -194,5 +157,25 @@ describe("creating variants", () => { true ); }); + visit(`${urlList.products}${productId}`); + variantsSteps.createFirstVariant(warehouse.id); + cy.getProductDetails(product.id, defaultChannel.slug).then( + productDetailsResp => { + expect(productDetailsResp.body[0].data.product.name).to.equal(name); + expect( + productDetailsResp.body[0].data.product.variants[0].pricing.price + .gross.amount + ).to.equal(10); + } + ); + cy.getProductDetails(product.id, newChannel.slug).then( + productDetailsResp => { + expect(productDetailsResp.body[0].data.product.name).to.equal(name); + expect( + productDetailsResp.body[0].data.product.variants[0].pricing.price + .gross.amount + ).to.equal(10); + } + ); }); }); diff --git a/src/products/components/ProductStocks/ProductStocks.tsx b/src/products/components/ProductStocks/ProductStocks.tsx index 84a72acbd..210c51816 100644 --- a/src/products/components/ProductStocks/ProductStocks.tsx +++ b/src/products/components/ProductStocks/ProductStocks.tsx @@ -310,6 +310,7 @@ const ProductStocks: React.FC = ({ >
setExpansionState(!isExpanded)} > diff --git a/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorPage.tsx b/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorPage.tsx index 7d98048cc..97235b282 100644 --- a/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorPage.tsx +++ b/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorPage.tsx @@ -200,6 +200,7 @@ const ProductVariantCreatePage: React.FC = props )} {step !== ProductVariantCreatorStep.summary ? (