Fix test for home page analytics (#2038)
This commit is contained in:
parent
7bfb10369e
commit
f843c9a732
2 changed files with 39 additions and 12 deletions
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
});
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue