diff --git a/cypress/integration/homePage/homePageAnalitics.js b/cypress/integration/homePage/homePageAnalitics.js index b7496af29..8cc8411f6 100644 --- a/cypress/integration/homePage/homePageAnalitics.js +++ b/cypress/integration/homePage/homePageAnalitics.js @@ -52,7 +52,8 @@ filterTests({ definedTags: ["all", "critical", "refactored"] }, () => { .createProductWithShipping({ name: randomName, productPrice, - shippingPrice + shippingPrice, + newChannel: true }) .then(resp => { createdVariants = resp.variantsList; @@ -156,7 +157,7 @@ filterTests({ definedTags: ["all", "critical", "refactored"] }, () => { ordersReadyToFulfillRegexp ).should("be.visible"); cy.contains( - HOMEPAGE_SELECTORS.ordersReadyForCapture, + HOMEPAGE_SELECTORS.paymentsWaitingForCapture, ordersReadyForCaptureRegexp ).should("be.visible"); cy.contains(HOMEPAGE_SELECTORS.sales, salesAmountRegexp).should( diff --git a/cypress/support/api/utils/products/productsUtils.js b/cypress/support/api/utils/products/productsUtils.js index 4b2a16358..8aae4e18f 100644 --- a/cypress/support/api/utils/products/productsUtils.js +++ b/cypress/support/api/utils/products/productsUtils.js @@ -1,6 +1,7 @@ import { returnValueDependsOnShopVersion } from "../../../formatData/dataDependingOnVersion"; import * as attributeRequest from "../../requests/Attribute"; import * as categoryRequest from "../../requests/Category"; +import { createChannel } from "../../requests/Channels"; import { createCollection } from "../../requests/Collections"; import * as productRequest from "../../requests/Product"; import { @@ -128,17 +129,36 @@ export function createNewProductWithNewDataAndDefaultChannel({ sku = name, productPrice = 10 }) { - let defaultChannel; + return getDefaultChannel().then(channel => { + createNewProductWithNewDataAndChannel({ + name, + description, + warehouseId, + preorder, + attributeValues, + sku, + productPrice, + defaultChannel: channel + }); + }); +} + +export function createNewProductWithNewDataAndChannel({ + name, + description = name, + warehouseId, + preorder, + attributeValues = ["value"], + sku = name, + productPrice = 10, + defaultChannel +}) { let collection; let attribute; let category; let productType; - return getDefaultChannel() - .then(channel => { - defaultChannel = channel; - createCollection(name); - }) + return createCollection(name) .then(collectionResp => { collection = collectionResp; createTypeAttributeAndCategoryForProduct({ name, attributeValues }); @@ -182,7 +202,8 @@ export function createProductWithShipping({ sku = name, productPrice = 10, shippingPrice = 10, - preorder + preorder, + newChannel = false }) { let address; let warehouse; @@ -194,7 +215,11 @@ export function createProductWithShipping({ .fixture("addresses") .then(addresses => { address = addresses.usAddress; - getDefaultChannel(); + if (!newChannel) { + getDefaultChannel(); + } else { + createChannel({ name }); + } }) .then(channelResp => { defaultChannel = channelResp; @@ -214,13 +239,14 @@ export function createProductWithShipping({ warehouse = warehouseResp; shippingMethod = shippingMethodResp; shippingZone = shippingZoneResp; - createNewProductWithNewDataAndDefaultChannel({ + createNewProductWithNewDataAndChannel({ name, warehouseId: warehouse.id, productPrice, preorder, attributeValues, - sku + sku, + defaultChannel }); } )