test for variants
This commit is contained in:
parent
ded6cdd5c4
commit
089a2c428d
4 changed files with 28 additions and 15 deletions
|
@ -1,5 +1,6 @@
|
||||||
export const VARIANTS_SELECTORS = {
|
export const VARIANTS_SELECTORS = {
|
||||||
attributeCheckbox: "[name*='value:']",
|
attributeCheckbox: "[name*='value:']",
|
||||||
|
valueContainer: "[class*='valueContainer']",
|
||||||
nextButton: "[class*='MuiButton-containedPrimary']",
|
nextButton: "[class*='MuiButton-containedPrimary']",
|
||||||
priceInput: "[name*='channel-price']",
|
priceInput: "[name*='channel-price']",
|
||||||
costPriceInput: "[name*='channel-costPrice']",
|
costPriceInput: "[name*='channel-costPrice']",
|
||||||
|
|
|
@ -92,7 +92,7 @@ describe("creating variants", () => {
|
||||||
})
|
})
|
||||||
.then(variants => {
|
.then(variants => {
|
||||||
// expect(productDetailsResp.body[0].data.product.name).to.equal(name);
|
// expect(productDetailsResp.body[0].data.product.name).to.equal(name);
|
||||||
expect(variants[0].name).to.equal(attribute.values[0]);
|
expect(variants[0].name).to.equal(attribute.values[0].name);
|
||||||
expect(variants[0].pricing.price.gross.amount).to.equal(price);
|
expect(variants[0].pricing.price.gross.amount).to.equal(price);
|
||||||
// expect(
|
// expect(
|
||||||
// productDetailsResp.body[0].data.product.variants[0].pricing.price
|
// productDetailsResp.body[0].data.product.variants[0].pricing.price
|
||||||
|
@ -109,6 +109,7 @@ describe("creating variants", () => {
|
||||||
productUtils
|
productUtils
|
||||||
.createProductInChannel({
|
.createProductInChannel({
|
||||||
name,
|
name,
|
||||||
|
attributeId: attribute.id,
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
warehouseId: warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
|
@ -118,11 +119,12 @@ describe("creating variants", () => {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
createdProduct = productUtils.getCreatedProduct();
|
createdProduct = productUtils.getCreatedProduct();
|
||||||
cy.visit(`${urlList.products}${createdProduct.id}`);
|
cy.visit(`${urlList.products}${createdProduct.id}`);
|
||||||
variantsSteps.createVariant(
|
variantsSteps.createVariant({
|
||||||
secondVariantSku,
|
sku: secondVariantSku,
|
||||||
warehouse.name,
|
warehouseName: warehouse.name,
|
||||||
variantsPrice
|
attributeName: attribute.values[1].name,
|
||||||
);
|
price: variantsPrice
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.then(
|
.then(
|
||||||
() =>
|
() =>
|
||||||
|
@ -181,7 +183,12 @@ describe("creating variants", () => {
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
cy.visit(`${urlList.products}${createdProduct.id}`);
|
cy.visit(`${urlList.products}${createdProduct.id}`);
|
||||||
variantsSteps.createFirstVariant(name, warehouse.id, variantsPrice);
|
variantsSteps.createFirstVariant(
|
||||||
|
name,
|
||||||
|
warehouse.id,
|
||||||
|
variantsPrice,
|
||||||
|
attribute.name
|
||||||
|
);
|
||||||
// productDetails.getProductDetails(product.id, defaultChannel.slug);
|
// productDetails.getProductDetails(product.id, defaultChannel.slug);
|
||||||
storeFrontProductUtils.getProductVariants(
|
storeFrontProductUtils.getProductVariants(
|
||||||
product.id,
|
product.id,
|
||||||
|
@ -192,10 +199,7 @@ describe("creating variants", () => {
|
||||||
expect(variants[0].pricing.price.gross.amount).to.equal(variantsPrice);
|
expect(variants[0].pricing.price.gross.amount).to.equal(variantsPrice);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
storeFrontProductUtils.getProductVariants(
|
storeFrontProductUtils.getProductVariants(product.id, newChannel.slug);
|
||||||
product.id,
|
|
||||||
defaultChannel.slug
|
|
||||||
);
|
|
||||||
// productDetails.getProductDetails(product.id, newChannel.slug);
|
// productDetails.getProductDetails(product.id, newChannel.slug);
|
||||||
})
|
})
|
||||||
.then(variants => {
|
.then(variants => {
|
||||||
|
|
|
@ -3,7 +3,9 @@ import { VARIANTS_SELECTORS } from "../../elements/catalog/variants-selectors";
|
||||||
class VariantsSteps {
|
class VariantsSteps {
|
||||||
createFirstVariant({ sku, warehouseId, price, attribute }) {
|
createFirstVariant({ sku, warehouseId, price, attribute }) {
|
||||||
cy.get(PRODUCTS_SELECTORS.addVariantsButton).click();
|
cy.get(PRODUCTS_SELECTORS.addVariantsButton).click();
|
||||||
cy.get(`${VARIANTS_SELECTORS.attributeCheckbox}`)
|
cy.get(VARIANTS_SELECTORS.valueContainer)
|
||||||
|
.contains(attribute)
|
||||||
|
.find(VARIANTS_SELECTORS.attributeCheckbox)
|
||||||
.click()
|
.click()
|
||||||
.get(VARIANTS_SELECTORS.nextButton)
|
.get(VARIANTS_SELECTORS.nextButton)
|
||||||
.click();
|
.click();
|
||||||
|
@ -23,13 +25,19 @@ class VariantsSteps {
|
||||||
cy.get(VARIANTS_SELECTORS.nextButton).click();
|
cy.get(VARIANTS_SELECTORS.nextButton).click();
|
||||||
cy.wait("@ProductVariantBulkCreate");
|
cy.wait("@ProductVariantBulkCreate");
|
||||||
}
|
}
|
||||||
createVariant(sku, warehouseName, price, costPrice = price) {
|
createVariant({
|
||||||
|
sku,
|
||||||
|
warehouseName,
|
||||||
|
attributeName,
|
||||||
|
price,
|
||||||
|
costPrice = price
|
||||||
|
}) {
|
||||||
cy.get(PRODUCTS_SELECTORS.addVariantsButton)
|
cy.get(PRODUCTS_SELECTORS.addVariantsButton)
|
||||||
.click()
|
.click()
|
||||||
.get(VARIANTS_SELECTORS.attributeSelector)
|
.get(VARIANTS_SELECTORS.attributeSelector)
|
||||||
.click()
|
.click()
|
||||||
.get(VARIANTS_SELECTORS.attributeOption)
|
.get(VARIANTS_SELECTORS.attributeOption)
|
||||||
.first()
|
.contains(attributeName)
|
||||||
.click()
|
.click()
|
||||||
.get(VARIANTS_SELECTORS.priceInput)
|
.get(VARIANTS_SELECTORS.priceInput)
|
||||||
.type(price)
|
.type(price)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { PRODUCTS_SELECTORS } from "../elements/catalog/product-selectors";
|
import { PRODUCTS_SELECTORS } from "../../elements/catalog/product-selectors";
|
||||||
|
|
||||||
class ProductSteps {
|
class ProductSteps {
|
||||||
valueTrue = PRODUCTS_SELECTORS.radioButtonsValueTrue;
|
valueTrue = PRODUCTS_SELECTORS.radioButtonsValueTrue;
|
Loading…
Reference in a new issue