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({
|
.createProductWithShipping({
|
||||||
name: randomName,
|
name: randomName,
|
||||||
productPrice,
|
productPrice,
|
||||||
shippingPrice
|
shippingPrice,
|
||||||
|
newChannel: true
|
||||||
})
|
})
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
createdVariants = resp.variantsList;
|
createdVariants = resp.variantsList;
|
||||||
|
@ -156,7 +157,7 @@ filterTests({ definedTags: ["all", "critical", "refactored"] }, () => {
|
||||||
ordersReadyToFulfillRegexp
|
ordersReadyToFulfillRegexp
|
||||||
).should("be.visible");
|
).should("be.visible");
|
||||||
cy.contains(
|
cy.contains(
|
||||||
HOMEPAGE_SELECTORS.ordersReadyForCapture,
|
HOMEPAGE_SELECTORS.paymentsWaitingForCapture,
|
||||||
ordersReadyForCaptureRegexp
|
ordersReadyForCaptureRegexp
|
||||||
).should("be.visible");
|
).should("be.visible");
|
||||||
cy.contains(HOMEPAGE_SELECTORS.sales, salesAmountRegexp).should(
|
cy.contains(HOMEPAGE_SELECTORS.sales, salesAmountRegexp).should(
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { returnValueDependsOnShopVersion } from "../../../formatData/dataDependingOnVersion";
|
import { returnValueDependsOnShopVersion } from "../../../formatData/dataDependingOnVersion";
|
||||||
import * as attributeRequest from "../../requests/Attribute";
|
import * as attributeRequest from "../../requests/Attribute";
|
||||||
import * as categoryRequest from "../../requests/Category";
|
import * as categoryRequest from "../../requests/Category";
|
||||||
|
import { createChannel } from "../../requests/Channels";
|
||||||
import { createCollection } from "../../requests/Collections";
|
import { createCollection } from "../../requests/Collections";
|
||||||
import * as productRequest from "../../requests/Product";
|
import * as productRequest from "../../requests/Product";
|
||||||
import {
|
import {
|
||||||
|
@ -128,17 +129,36 @@ export function createNewProductWithNewDataAndDefaultChannel({
|
||||||
sku = name,
|
sku = name,
|
||||||
productPrice = 10
|
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 collection;
|
||||||
let attribute;
|
let attribute;
|
||||||
let category;
|
let category;
|
||||||
let productType;
|
let productType;
|
||||||
|
|
||||||
return getDefaultChannel()
|
return createCollection(name)
|
||||||
.then(channel => {
|
|
||||||
defaultChannel = channel;
|
|
||||||
createCollection(name);
|
|
||||||
})
|
|
||||||
.then(collectionResp => {
|
.then(collectionResp => {
|
||||||
collection = collectionResp;
|
collection = collectionResp;
|
||||||
createTypeAttributeAndCategoryForProduct({ name, attributeValues });
|
createTypeAttributeAndCategoryForProduct({ name, attributeValues });
|
||||||
|
@ -182,7 +202,8 @@ export function createProductWithShipping({
|
||||||
sku = name,
|
sku = name,
|
||||||
productPrice = 10,
|
productPrice = 10,
|
||||||
shippingPrice = 10,
|
shippingPrice = 10,
|
||||||
preorder
|
preorder,
|
||||||
|
newChannel = false
|
||||||
}) {
|
}) {
|
||||||
let address;
|
let address;
|
||||||
let warehouse;
|
let warehouse;
|
||||||
|
@ -194,7 +215,11 @@ export function createProductWithShipping({
|
||||||
.fixture("addresses")
|
.fixture("addresses")
|
||||||
.then(addresses => {
|
.then(addresses => {
|
||||||
address = addresses.usAddress;
|
address = addresses.usAddress;
|
||||||
getDefaultChannel();
|
if (!newChannel) {
|
||||||
|
getDefaultChannel();
|
||||||
|
} else {
|
||||||
|
createChannel({ name });
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.then(channelResp => {
|
.then(channelResp => {
|
||||||
defaultChannel = channelResp;
|
defaultChannel = channelResp;
|
||||||
|
@ -214,13 +239,14 @@ export function createProductWithShipping({
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
shippingMethod = shippingMethodResp;
|
shippingMethod = shippingMethodResp;
|
||||||
shippingZone = shippingZoneResp;
|
shippingZone = shippingZoneResp;
|
||||||
createNewProductWithNewDataAndDefaultChannel({
|
createNewProductWithNewDataAndChannel({
|
||||||
name,
|
name,
|
||||||
warehouseId: warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
productPrice,
|
productPrice,
|
||||||
preorder,
|
preorder,
|
||||||
attributeValues,
|
attributeValues,
|
||||||
sku
|
sku,
|
||||||
|
defaultChannel
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue