tests for products

This commit is contained in:
Karolina Rakoczy 2021-02-18 20:50:12 +01:00
parent 1b4da95e81
commit 76ef2e6264
5 changed files with 11 additions and 17 deletions

View file

@ -11,7 +11,7 @@ import ProductsUtils from "../utils/productsUtils";
import ShippingUtils from "../utils/shippingUtils"; import ShippingUtils from "../utils/shippingUtils";
// <reference types="cypress" /> // <reference types="cypress" />
describe("User authorization", () => { describe("Homepage analytics", () => {
const startsWith = "Cy-"; const startsWith = "Cy-";
const customer = new Customer(); const customer = new Customer();

View file

@ -1,7 +1,7 @@
import faker from "faker"; import faker from "faker";
import ProductSteps from "../../steps/productSteps"; import ProductSteps from "../../steps/productSteps";
import { URL_LIST } from "../../url/url-list"; import { urlList } from "../../url/urlList";
import ChannelsUtils from "../../utils/channelsUtils"; import ChannelsUtils from "../../utils/channelsUtils";
import FrontShopProductUtils from "../../utils/frontShop/frontShopProductUtils"; import FrontShopProductUtils from "../../utils/frontShop/frontShopProductUtils";
import ProductsUtils from "../../utils/productsUtils"; import ProductsUtils from "../../utils/productsUtils";
@ -73,7 +73,7 @@ describe("Products available in listings", () => {
true true
) )
.then(() => { .then(() => {
const productUrl = `${URL_LIST.products}${ const productUrl = `${urlList.products}${
productsUtils.getCreatedProduct().id productsUtils.getCreatedProduct().id
}`; }`;
productSteps.updateProductIsAvailableForPurchase(productUrl, true); productSteps.updateProductIsAvailableForPurchase(productUrl, true);
@ -106,7 +106,7 @@ describe("Products available in listings", () => {
true true
) )
.then(() => { .then(() => {
const productUrl = `${URL_LIST.products}${ const productUrl = `${urlList.products}${
productsUtils.getCreatedProduct().id productsUtils.getCreatedProduct().id
}`; }`;
productSteps.updateProductIsAvailableForPurchase(productUrl, false); productSteps.updateProductIsAvailableForPurchase(productUrl, false);

View file

@ -1,13 +1,13 @@
import faker from "faker"; import faker from "faker";
import ProductSteps from "../../steps/productSteps"; import ProductSteps from "../../steps/productSteps";
import { URL_LIST } from "../../url/url-list"; import { urlList } from "../../url/urlList";
import ChannelsUtils from "../../utils/channelsUtils"; import ChannelsUtils from "../../utils/channelsUtils";
import FrontShopProductUtils from "../../utils/frontShop/frontShopProductUtils"; import FrontShopProductUtils from "../../utils/frontShop/frontShopProductUtils";
import ProductsUtils from "../../utils/productsUtils"; import ProductsUtils from "../../utils/productsUtils";
// <reference types="cypress" /> // <reference types="cypress" />
describe("Publish 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();
@ -55,7 +55,7 @@ describe("Publish products", () => {
}) })
.then(() => { .then(() => {
const product = productsUtils.getCreatedProduct(); const product = productsUtils.getCreatedProduct();
const productUrl = `${URL_LIST.products}${product.id}`; const productUrl = `${urlList.products}${product.id}`;
productSteps.updateProductPublish(productUrl, true); productSteps.updateProductPublish(productUrl, true);
frontShopProductUtils.isProductVisible( frontShopProductUtils.isProductVisible(
product.id, product.id,
@ -88,7 +88,7 @@ describe("Publish products", () => {
}) })
.then(() => { .then(() => {
product = productsUtils.getCreatedProduct(); product = productsUtils.getCreatedProduct();
const productUrl = `${URL_LIST.products}${product.id}`; const productUrl = `${urlList.products}${product.id}`;
productSteps.updateProductPublish(productUrl, false); productSteps.updateProductPublish(productUrl, false);
frontShopProductUtils.isProductVisible( frontShopProductUtils.isProductVisible(
product.id, product.id,

View file

@ -1,7 +1,7 @@
import faker from "faker"; import faker from "faker";
import ProductSteps from "../../steps/productSteps"; import ProductSteps from "../../steps/productSteps";
import { URL_LIST } from "../../url/url-list"; import { urlList } from "../../url/urlList";
import ChannelsUtils from "../../utils/channelsUtils"; import ChannelsUtils from "../../utils/channelsUtils";
import FrontShopProductUtils from "../../utils/frontShop/frontShopProductUtils"; import FrontShopProductUtils from "../../utils/frontShop/frontShopProductUtils";
import ProductsUtils from "../../utils/productsUtils"; import ProductsUtils from "../../utils/productsUtils";
@ -55,7 +55,7 @@ describe("Products displayed in listings", () => {
}) })
.then(() => { .then(() => {
const product = productsUtils.getCreatedProduct(); const product = productsUtils.getCreatedProduct();
const productUrl = `${URL_LIST.products}${product.id}`; const productUrl = `${urlList.products}${product.id}`;
productSteps.updateProductVisibleInListings(productUrl); productSteps.updateProductVisibleInListings(productUrl);
frontShopProductUtils.isProductVisibleInSearchResult( frontShopProductUtils.isProductVisibleInSearchResult(
productName, productName,
@ -89,7 +89,7 @@ describe("Products displayed in listings", () => {
}) })
.then(() => { .then(() => {
const product = productsUtils.getCreatedProduct(); const product = productsUtils.getCreatedProduct();
const productUrl = `${URL_LIST.products}${product.id}`; const productUrl = `${urlList.products}${product.id}`;
productSteps.updateProductVisibleInListings(productUrl); productSteps.updateProductVisibleInListings(productUrl);
frontShopProductUtils frontShopProductUtils
.isProductVisibleInSearchResult(productName, defaultChannel.slug) .isProductVisibleInSearchResult(productName, defaultChannel.slug)

View file

@ -1,6 +0,0 @@
export const URL_LIST = {
dashbord: "/",
channels: "/channels/",
products: "/products/",
orders: "/orders/"
};