remove class
This commit is contained in:
parent
095a5522d3
commit
fde78fe874
4 changed files with 45 additions and 68 deletions
|
@ -5,7 +5,7 @@ import { productDetailsUrl } from "../../../url/urlList";
|
||||||
import ChannelsUtils from "../../../utils/channelsUtils";
|
import ChannelsUtils from "../../../utils/channelsUtils";
|
||||||
import ProductsUtils from "../../../utils/productsUtils";
|
import ProductsUtils from "../../../utils/productsUtils";
|
||||||
import ShippingUtils from "../../../utils/shippingUtils";
|
import ShippingUtils from "../../../utils/shippingUtils";
|
||||||
import StoreFrontProductUtils from "../../../utils/storeFront/storeFrontProductUtils";
|
import { isProductAvailableForPurchase } from "../../../utils/storeFront/storeFrontProductUtils";
|
||||||
|
|
||||||
// <reference types="cypress" />
|
// <reference types="cypress" />
|
||||||
describe("Products available in listings", () => {
|
describe("Products available in listings", () => {
|
||||||
|
@ -13,7 +13,6 @@ describe("Products available in listings", () => {
|
||||||
const channelsUtils = new ChannelsUtils();
|
const channelsUtils = new ChannelsUtils();
|
||||||
const productsUtils = new ProductsUtils();
|
const productsUtils = new ProductsUtils();
|
||||||
const productSteps = new ProductSteps();
|
const productSteps = new ProductSteps();
|
||||||
const frontShopProductUtils = new StoreFrontProductUtils();
|
|
||||||
const startsWith = "Cy-";
|
const startsWith = "Cy-";
|
||||||
const name = `${startsWith}${faker.random.number()}`;
|
const name = `${startsWith}${faker.random.number()}`;
|
||||||
let productType;
|
let productType;
|
||||||
|
@ -74,14 +73,14 @@ describe("Products available in listings", () => {
|
||||||
productSteps.updateProductIsAvailableForPurchase(productUrl, true);
|
productSteps.updateProductIsAvailableForPurchase(productUrl, true);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
frontShopProductUtils.isProductAvailableForPurchase(
|
isProductAvailableForPurchase(
|
||||||
productsUtils.getCreatedProduct().id,
|
productsUtils.getCreatedProduct().id,
|
||||||
defaultChannel.slug,
|
defaultChannel.slug,
|
||||||
productName
|
productName
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.then(isProductVisible => {
|
.then(isVisibleResp => {
|
||||||
expect(isProductVisible).to.be.eq(true);
|
expect(isVisibleResp).to.be.eq(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it("should update product to not available for purchase", () => {
|
it("should update product to not available for purchase", () => {
|
||||||
|
@ -102,7 +101,7 @@ describe("Products available in listings", () => {
|
||||||
productSteps.updateProductIsAvailableForPurchase(productUrl, false);
|
productSteps.updateProductIsAvailableForPurchase(productUrl, false);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
frontShopProductUtils.isProductAvailableForPurchase(
|
isProductAvailableForPurchase(
|
||||||
productsUtils.getCreatedProduct().id,
|
productsUtils.getCreatedProduct().id,
|
||||||
defaultChannel.slug,
|
defaultChannel.slug,
|
||||||
productName
|
productName
|
||||||
|
|
|
@ -4,14 +4,13 @@ import ProductSteps from "../../../steps/productSteps";
|
||||||
import { productDetailsUrl } from "../../../url/urlList";
|
import { productDetailsUrl } from "../../../url/urlList";
|
||||||
import ChannelsUtils from "../../../utils/channelsUtils";
|
import ChannelsUtils from "../../../utils/channelsUtils";
|
||||||
import ProductsUtils from "../../../utils/productsUtils";
|
import ProductsUtils from "../../../utils/productsUtils";
|
||||||
import StoreFrontProductUtils from "../../../utils/storeFront/storeFrontProductUtils";
|
import { isProductVisible } from "../../../utils/storeFront/storeFrontProductUtils";
|
||||||
|
|
||||||
// <reference types="cypress" />
|
// <reference types="cypress" />
|
||||||
describe("Published products", () => {
|
describe("Published products", () => {
|
||||||
const channelsUtils = new ChannelsUtils();
|
const channelsUtils = new ChannelsUtils();
|
||||||
const productsUtils = new ProductsUtils();
|
const productsUtils = new ProductsUtils();
|
||||||
const productSteps = new ProductSteps();
|
const productSteps = new ProductSteps();
|
||||||
const frontShopProductUtils = new StoreFrontProductUtils();
|
|
||||||
|
|
||||||
const startsWith = "Cy-";
|
const startsWith = "Cy-";
|
||||||
const name = `${startsWith}${faker.random.number()}`;
|
const name = `${startsWith}${faker.random.number()}`;
|
||||||
|
@ -53,11 +52,7 @@ describe("Published products", () => {
|
||||||
const product = productsUtils.getCreatedProduct();
|
const product = productsUtils.getCreatedProduct();
|
||||||
const productUrl = productDetailsUrl(product.id);
|
const productUrl = productDetailsUrl(product.id);
|
||||||
productSteps.updateProductPublish(productUrl, true);
|
productSteps.updateProductPublish(productUrl, true);
|
||||||
frontShopProductUtils.isProductVisible(
|
isProductVisible(product.id, defaultChannel.slug, productName);
|
||||||
product.id,
|
|
||||||
defaultChannel.slug,
|
|
||||||
productName
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.then(isVisible => {
|
.then(isVisible => {
|
||||||
expect(isVisible).to.be.eq(true);
|
expect(isVisible).to.be.eq(true);
|
||||||
|
@ -84,22 +79,14 @@ describe("Published products", () => {
|
||||||
product = productsUtils.getCreatedProduct();
|
product = productsUtils.getCreatedProduct();
|
||||||
const productUrl = productDetailsUrl(product.id);
|
const productUrl = productDetailsUrl(product.id);
|
||||||
productSteps.updateProductPublish(productUrl, false);
|
productSteps.updateProductPublish(productUrl, false);
|
||||||
frontShopProductUtils.isProductVisible(
|
isProductVisible(product.id, defaultChannel.slug, productName);
|
||||||
product.id,
|
|
||||||
defaultChannel.slug,
|
|
||||||
productName
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.then(isVisible => {
|
.then(isVisible => {
|
||||||
expect(isVisible).to.be.eq(false);
|
expect(isVisible).to.be.eq(false);
|
||||||
cy.loginInShop();
|
cy.loginInShop();
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
frontShopProductUtils.isProductVisible(
|
isProductVisible(product.id, defaultChannel.slug, productName);
|
||||||
product.id,
|
|
||||||
defaultChannel.slug,
|
|
||||||
productName
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.then(isVisible => {
|
.then(isVisible => {
|
||||||
expect(isVisible).to.be.eq(true);
|
expect(isVisible).to.be.eq(true);
|
||||||
|
|
|
@ -4,14 +4,13 @@ import ProductSteps from "../../../steps/productSteps";
|
||||||
import { productDetailsUrl } from "../../../url/urlList";
|
import { productDetailsUrl } from "../../../url/urlList";
|
||||||
import ChannelsUtils from "../../../utils/channelsUtils";
|
import ChannelsUtils from "../../../utils/channelsUtils";
|
||||||
import ProductsUtils from "../../../utils/productsUtils";
|
import ProductsUtils from "../../../utils/productsUtils";
|
||||||
import StoreFrontProductUtils from "../../../utils/storeFront/storeFrontProductUtils";
|
import { isProductVisibleInSearchResult } from "../../../utils/storeFront/storeFrontProductUtils";
|
||||||
|
|
||||||
// <reference types="cypress" />
|
// <reference types="cypress" />
|
||||||
describe("Products displayed in listings", () => {
|
describe("Products displayed in listings", () => {
|
||||||
const channelsUtils = new ChannelsUtils();
|
const channelsUtils = new ChannelsUtils();
|
||||||
const productsUtils = new ProductsUtils();
|
const productsUtils = new ProductsUtils();
|
||||||
const productSteps = new ProductSteps();
|
const productSteps = new ProductSteps();
|
||||||
const frontShopProductUtils = new StoreFrontProductUtils();
|
|
||||||
|
|
||||||
const startsWith = "Cy-";
|
const startsWith = "Cy-";
|
||||||
const name = `${startsWith}${faker.random.number()}`;
|
const name = `${startsWith}${faker.random.number()}`;
|
||||||
|
@ -53,10 +52,7 @@ describe("Products displayed in listings", () => {
|
||||||
const product = productsUtils.getCreatedProduct();
|
const product = productsUtils.getCreatedProduct();
|
||||||
const productUrl = productDetailsUrl(product.id);
|
const productUrl = productDetailsUrl(product.id);
|
||||||
productSteps.updateProductVisibleInListings(productUrl);
|
productSteps.updateProductVisibleInListings(productUrl);
|
||||||
frontShopProductUtils.isProductVisibleInSearchResult(
|
isProductVisibleInSearchResult(productName, defaultChannel.slug);
|
||||||
productName,
|
|
||||||
defaultChannel.slug
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.then(isProductVisible => {
|
.then(isProductVisible => {
|
||||||
expect(isProductVisible).to.be.eq(true);
|
expect(isProductVisible).to.be.eq(true);
|
||||||
|
@ -82,18 +78,15 @@ describe("Products displayed in listings", () => {
|
||||||
const product = productsUtils.getCreatedProduct();
|
const product = productsUtils.getCreatedProduct();
|
||||||
const productUrl = productDetailsUrl(product.id);
|
const productUrl = productDetailsUrl(product.id);
|
||||||
productSteps.updateProductVisibleInListings(productUrl);
|
productSteps.updateProductVisibleInListings(productUrl);
|
||||||
frontShopProductUtils
|
isProductVisibleInSearchResult(productName, defaultChannel.slug).then(
|
||||||
.isProductVisibleInSearchResult(productName, defaultChannel.slug)
|
isProductVisible => {
|
||||||
.then(isProductVisible => {
|
|
||||||
expect(isProductVisible).to.be.eq(false);
|
expect(isProductVisible).to.be.eq(false);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
cy.loginInShop();
|
cy.loginInShop();
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
frontShopProductUtils.isProductVisibleInSearchResult(
|
isProductVisibleInSearchResult(productName, defaultChannel.slug);
|
||||||
productName,
|
|
||||||
defaultChannel.slug
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.then(isProductVisible => {
|
.then(isProductVisible => {
|
||||||
expect(isProductVisible).to.be.eq(true);
|
expect(isProductVisible).to.be.eq(true);
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import ProductDetails from "../../apiRequests/storeFront/ProductDetails";
|
import ProductDetails from "../../apiRequests/storeFront/ProductDetails";
|
||||||
import Search from "../../apiRequests/storeFront/Search";
|
import Search from "../../apiRequests/storeFront/Search";
|
||||||
|
|
||||||
class StoreFrontProductUtils {
|
export const isProductVisible = (productId, channelSlug, name) => {
|
||||||
isProductVisible(productId, channelSlug, name) {
|
|
||||||
const productDetails = new ProductDetails();
|
const productDetails = new ProductDetails();
|
||||||
return productDetails
|
return productDetails
|
||||||
.getProductDetails(productId, channelSlug)
|
.getProductDetails(productId, channelSlug)
|
||||||
|
@ -10,8 +9,9 @@ class StoreFrontProductUtils {
|
||||||
const product = productDetailsResp.body.data.product;
|
const product = productDetailsResp.body.data.product;
|
||||||
return product !== null && product.name === name;
|
return product !== null && product.name === name;
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
isProductAvailableForPurchase(productId, channelSlug) {
|
|
||||||
|
export const isProductAvailableForPurchase = (productId, channelSlug) => {
|
||||||
const productDetails = new ProductDetails();
|
const productDetails = new ProductDetails();
|
||||||
return productDetails
|
return productDetails
|
||||||
.getProductDetails(productId, channelSlug)
|
.getProductDetails(productId, channelSlug)
|
||||||
|
@ -19,8 +19,8 @@ class StoreFrontProductUtils {
|
||||||
productDetailsResp =>
|
productDetailsResp =>
|
||||||
productDetailsResp.body.data.product.isAvailableForPurchase
|
productDetailsResp.body.data.product.isAvailableForPurchase
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
isProductVisibleInSearchResult(productName, channelSlug) {
|
export const isProductVisibleInSearchResult = (productName, channelSlug) => {
|
||||||
const search = new Search();
|
const search = new Search();
|
||||||
return search
|
return search
|
||||||
.searchInShop(productName, channelSlug)
|
.searchInShop(productName, channelSlug)
|
||||||
|
@ -29,6 +29,4 @@ class StoreFrontProductUtils {
|
||||||
resp.body.data.products.totalCount !== 0 &&
|
resp.body.data.products.totalCount !== 0 &&
|
||||||
resp.body.data.products.edges[0].node.name === productName
|
resp.body.data.products.edges[0].node.name === productName
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
|
||||||
export default StoreFrontProductUtils;
|
|
||||||
|
|
Loading…
Reference in a new issue