diff --git a/cypress/e2e/products/productsVariants.js b/cypress/e2e/products/productsVariants.js index 3baf32106..266f7cdb7 100644 --- a/cypress/e2e/products/productsVariants.js +++ b/cypress/e2e/products/productsVariants.js @@ -82,6 +82,8 @@ describe("As an admin I should be able to create variant", () => { const name = `${startsWith}${faker.datatype.number()}`; const price = 10; let createdProduct; + // TODO fix name for proper one when problem with typing in grid will be solved - now only first letter of string is able to be typed in grid cell + const variantName = "A"; createProduct({ attributeId: attribute.id, @@ -103,25 +105,27 @@ describe("As an admin I should be able to create variant", () => { cy.visit( `${urlList.products}${createdProduct.id}`, ).waitForProgressBarToNotBeVisible(); - addVariantToDataGrid(name); + addVariantToDataGrid(variantName); enterVariantEditPage(); selectChannelsForVariant(); + cy.addAliasToGraphRequest("VariantUpdate"); createVariant({ channelName: [defaultChannel.name, newChannel.name], sku: name, price, attributeName: attributeValues[0], }); + cy.wait("@VariantUpdate"); getProductVariants(createdProduct.id, defaultChannel.slug); }) .then(([variant]) => { - expect(variant).to.have.property("name", name); + expect(variant).to.have.property("name", variantName); expect(variant).to.have.property("price", price); expect(variant).to.have.property("currency", "USD"); getProductVariants(createdProduct.id, newChannel.slug); }) .then(([variant]) => { - expect(variant).to.have.property("name", name); + expect(variant).to.have.property("name", variantName); expect(variant).to.have.property("price", price); expect(variant).to.have.property("currency", "PLN"); }); @@ -164,6 +168,7 @@ describe("As an admin I should be able to create variant", () => { () => { const name = `${startsWith}${faker.datatype.number()}`; const secondVariantSku = `${startsWith}${faker.datatype.number()}`; + const secondVariantName = `${startsWith}${faker.datatype.number()}`; const variants = [{ price: 7 }, { name: attributeValues[1], price: 16 }]; let createdProduct; @@ -182,25 +187,26 @@ describe("As an admin I should be able to create variant", () => { cy.visit(`${urlList.products}${createdProduct.id}`); cy.get(PRODUCT_DETAILS.dataGridTable).scrollIntoView(); - enterVariantEditPage(); - cy.get(PRODUCT_DETAILS.addVariantButton) .click() .then(() => { + cy.addAliasToGraphRequest("VariantCreate"); createVariant({ sku: secondVariantSku, attributeName: variants[1].name, price: variants[1].price, channelName: defaultChannel.name, + variantName: secondVariantName, }); + cy.wait("@VariantCreate"); getProductVariants(createdProduct.id, defaultChannel.slug); }) .then(([secondVariant, firstVariant]) => { expect(firstVariant).to.have.property("price", variants[0].price); expect(firstVariant).to.have.property("name", "value"); expect(firstVariant).to.have.property("currency", "USD"); - expect(secondVariant).to.have.property("name", secondVariantSku); + expect(secondVariant).to.have.property("name", secondVariantName); expect(secondVariant).to.have.property( "price", variants[1].price, diff --git a/cypress/support/pages/catalog/products/VariantsPage.js b/cypress/support/pages/catalog/products/VariantsPage.js index db2d1ca31..db2bbf960 100644 --- a/cypress/support/pages/catalog/products/VariantsPage.js +++ b/cypress/support/pages/catalog/products/VariantsPage.js @@ -80,7 +80,6 @@ export function fillUpVariantDetails({ .each(input => { cy.wrap(input).type(costPrice); }); - if (variantName) { cy.get(VARIANTS_SELECTORS.variantNameInput).type(variantName); } diff --git a/src/products/components/ProductStocks/ProductStocks.tsx b/src/products/components/ProductStocks/ProductStocks.tsx index cd91273e9..209ae7ca9 100644 --- a/src/products/components/ProductStocks/ProductStocks.tsx +++ b/src/products/components/ProductStocks/ProductStocks.tsx @@ -123,12 +123,6 @@ export const ProductStocks: React.FC = ({ const handleChange = (e: React.ChangeEvent) => { onFormDataChange(e); - onFormDataChange({ - target: { - name: "variantName", - value: e.target.value, - }, - }); }; return (