Run cypress tests on correct branch (#2196)
This commit is contained in:
parent
437a2130eb
commit
6cd42b0ae8
8 changed files with 87 additions and 95 deletions
10
.github/workflows/tests-nightly.yml
vendored
10
.github/workflows/tests-nightly.yml
vendored
|
@ -151,8 +151,18 @@ jobs:
|
||||||
# run copies of the current job in parallel
|
# run copies of the current job in parallel
|
||||||
containers: [1, 2, 3, 4]
|
containers: [1, 2, 3, 4]
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
|
- name: Get branch
|
||||||
|
id: branch
|
||||||
|
env:
|
||||||
|
version: ${{github.event.client_payload.version}}
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=ref::$(echo $version | grep -ohE "[0-9]\.[0-9]+" )"
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: ${{ steps.branch.outputs.ref }}
|
||||||
|
|
||||||
- name: Get formatted version
|
- name: Get formatted version
|
||||||
id: version
|
id: version
|
||||||
|
|
|
@ -17,7 +17,6 @@ import {
|
||||||
} from "../../../support/api/utils/products/productsUtils";
|
} from "../../../support/api/utils/products/productsUtils";
|
||||||
import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
|
import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
|
||||||
import { isShippingAvailableInCheckout } from "../../../support/api/utils/storeFront/checkoutUtils";
|
import { isShippingAvailableInCheckout } from "../../../support/api/utils/storeFront/checkoutUtils";
|
||||||
import { returnValueDependsOnShopVersion } from "../../../support/formatData/dataDependingOnVersion";
|
|
||||||
import {
|
import {
|
||||||
createRateWithPostalCode,
|
createRateWithPostalCode,
|
||||||
postalCodesOptions,
|
postalCodesOptions,
|
||||||
|
@ -66,9 +65,7 @@ describe("As a user I want to create shipping method with postal codes", () => {
|
||||||
})
|
})
|
||||||
.then(warehouseResp => {
|
.then(warehouseResp => {
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
if (returnValueDependsOnShopVersion("3.5", true, false)) {
|
|
||||||
updateChannelWarehouses(defaultChannel.id, warehouse.id);
|
updateChannelWarehouses(defaultChannel.id, warehouse.id);
|
||||||
}
|
|
||||||
createTypeAttributeAndCategoryForProduct({ name });
|
createTypeAttributeAndCategoryForProduct({ name });
|
||||||
})
|
})
|
||||||
.then(({ attribute, productType, category }) => {
|
.then(({ attribute, productType, category }) => {
|
||||||
|
|
|
@ -17,7 +17,6 @@ import {
|
||||||
} from "../../../../support/api/utils/products/productsUtils";
|
} from "../../../../support/api/utils/products/productsUtils";
|
||||||
import { deleteShippingStartsWith } from "../../../../support/api/utils/shippingUtils";
|
import { deleteShippingStartsWith } from "../../../../support/api/utils/shippingUtils";
|
||||||
import { isShippingAvailableInCheckout } from "../../../../support/api/utils/storeFront/checkoutUtils";
|
import { isShippingAvailableInCheckout } from "../../../../support/api/utils/storeFront/checkoutUtils";
|
||||||
import { returnValueDependsOnShopVersion } from "../../../../support/formatData/dataDependingOnVersion";
|
|
||||||
import {
|
import {
|
||||||
createShippingRate,
|
createShippingRate,
|
||||||
rateOptions,
|
rateOptions,
|
||||||
|
@ -59,9 +58,7 @@ describe("As a staff user I want to manage shipping weights", () => {
|
||||||
})
|
})
|
||||||
.then(warehouseResp => {
|
.then(warehouseResp => {
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
if (returnValueDependsOnShopVersion("3.5", true, false)) {
|
|
||||||
updateChannelWarehouses(defaultChannel.id, warehouse.id);
|
updateChannelWarehouses(defaultChannel.id, warehouse.id);
|
||||||
}
|
|
||||||
createTypeAttributeAndCategoryForProduct({ name });
|
createTypeAttributeAndCategoryForProduct({ name });
|
||||||
})
|
})
|
||||||
.then(({ attribute, productType, category }) => {
|
.then(({ attribute, productType, category }) => {
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import { stringify } from "../.././formatData/formatJson";
|
import { stringify } from "../.././formatData/formatJson";
|
||||||
import { returnValueDependsOnShopVersion } from "../../formatData/dataDependingOnVersion";
|
|
||||||
import {
|
import {
|
||||||
getDataForDescriptionInVariables,
|
getDataForDescriptionInVariables,
|
||||||
getValueWithDefault,
|
getValueWithDefault,
|
||||||
getVariantsListIds
|
getVariantsListIds,
|
||||||
} from "./utils/Utils";
|
} from "./utils/Utils";
|
||||||
|
|
||||||
export function getFirstProducts(first, search) {
|
export function getFirstProducts(first, search) {
|
||||||
|
@ -55,7 +54,7 @@ export function updateChannelInProduct({
|
||||||
variantsIdsToRemove = "[]",
|
variantsIdsToRemove = "[]",
|
||||||
isPublished = true,
|
isPublished = true,
|
||||||
isAvailableForPurchase = true,
|
isAvailableForPurchase = true,
|
||||||
visibleInListings = true
|
visibleInListings = true,
|
||||||
}) {
|
}) {
|
||||||
const mutation = `mutation{
|
const mutation = `mutation{
|
||||||
productChannelListingUpdate(id:"${productId}",
|
productChannelListingUpdate(id:"${productId}",
|
||||||
|
@ -99,24 +98,24 @@ export function createProduct({
|
||||||
productTypeId,
|
productTypeId,
|
||||||
categoryId,
|
categoryId,
|
||||||
collectionId,
|
collectionId,
|
||||||
description
|
description,
|
||||||
}) {
|
}) {
|
||||||
const collection = getValueWithDefault(
|
const collection = getValueWithDefault(
|
||||||
collectionId,
|
collectionId,
|
||||||
`collections:["${collectionId}"]`
|
`collections:["${collectionId}"]`,
|
||||||
);
|
);
|
||||||
const category = getValueWithDefault(categoryId, `category:"${categoryId}"`);
|
const category = getValueWithDefault(categoryId, `category:"${categoryId}"`);
|
||||||
const descriptionData = getDataForDescriptionInVariables(description);
|
const descriptionData = getDataForDescriptionInVariables(description);
|
||||||
const attributeValuesLine = getValueWithDefault(
|
const attributeValuesLine = getValueWithDefault(
|
||||||
attributeValue,
|
attributeValue,
|
||||||
`values:["${attributeValue}"]`
|
`values:["${attributeValue}"]`,
|
||||||
);
|
);
|
||||||
const attributes = getValueWithDefault(
|
const attributes = getValueWithDefault(
|
||||||
attributeId,
|
attributeId,
|
||||||
`attributes:[{
|
`attributes:[{
|
||||||
id:"${attributeId}"
|
id:"${attributeId}"
|
||||||
${attributeValuesLine}
|
${attributeValuesLine}
|
||||||
}]`
|
}]`,
|
||||||
);
|
);
|
||||||
const mutation = `mutation createProduct${descriptionData.mutationVariables}{
|
const mutation = `mutation createProduct${descriptionData.mutationVariables}{
|
||||||
productCreate(input:{
|
productCreate(input:{
|
||||||
|
@ -156,11 +155,11 @@ export function createVariant({
|
||||||
trackInventory = true,
|
trackInventory = true,
|
||||||
weight = 1,
|
weight = 1,
|
||||||
attributeName = "value",
|
attributeName = "value",
|
||||||
preorder
|
preorder,
|
||||||
}) {
|
}) {
|
||||||
const preorderLines = getValueWithDefault(
|
const preorderLines = getValueWithDefault(
|
||||||
preorder,
|
preorder,
|
||||||
`preorder:${stringify(preorder)}`
|
`preorder:${stringify(preorder)}`,
|
||||||
);
|
);
|
||||||
const skuLines = getValueWithDefault(sku, `sku: "${sku}"`);
|
const skuLines = getValueWithDefault(sku, `sku: "${sku}"`);
|
||||||
|
|
||||||
|
@ -170,7 +169,7 @@ export function createVariant({
|
||||||
id:"${attributeId}"
|
id:"${attributeId}"
|
||||||
values: ["${attributeName}"]
|
values: ["${attributeName}"]
|
||||||
}]`,
|
}]`,
|
||||||
"attributes:[]"
|
"attributes:[]",
|
||||||
);
|
);
|
||||||
|
|
||||||
const channelListings = getValueWithDefault(
|
const channelListings = getValueWithDefault(
|
||||||
|
@ -179,7 +178,7 @@ export function createVariant({
|
||||||
channelId:"${channelId}"
|
channelId:"${channelId}"
|
||||||
price:"${price}"
|
price:"${price}"
|
||||||
costPrice:"${costPrice}"
|
costPrice:"${costPrice}"
|
||||||
}`
|
}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
const stocks = getValueWithDefault(
|
const stocks = getValueWithDefault(
|
||||||
|
@ -187,7 +186,7 @@ export function createVariant({
|
||||||
`stocks:{
|
`stocks:{
|
||||||
warehouse:"${warehouseId}"
|
warehouse:"${warehouseId}"
|
||||||
quantity:${quantityInWarehouse}
|
quantity:${quantityInWarehouse}
|
||||||
}`
|
}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
const mutation = `mutation{
|
const mutation = `mutation{
|
||||||
|
@ -248,14 +247,11 @@ export function getVariants(variantsList) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getVariant(id, channelSlug, auth = "auth") {
|
export function getVariant(id, channelSlug, auth = "auth") {
|
||||||
const preorder = returnValueDependsOnShopVersion(
|
const preorder = `preorder{
|
||||||
"3.1",
|
|
||||||
`preorder{
|
|
||||||
globalThreshold
|
globalThreshold
|
||||||
globalSoldUnits
|
globalSoldUnits
|
||||||
endDate
|
endDate
|
||||||
}`
|
}`;
|
||||||
);
|
|
||||||
|
|
||||||
const query = `query{
|
const query = `query{
|
||||||
productVariant(id:"${id}" channel:"${channelSlug}"){
|
productVariant(id:"${id}" channel:"${channelSlug}"){
|
||||||
|
@ -317,11 +313,11 @@ export function deactivatePreorderOnVariant(variantId) {
|
||||||
export function activatePreorderOnVariant({
|
export function activatePreorderOnVariant({
|
||||||
variantId,
|
variantId,
|
||||||
threshold = 50,
|
threshold = 50,
|
||||||
endDate
|
endDate,
|
||||||
}) {
|
}) {
|
||||||
const thresholdLine = getValueWithDefault(
|
const thresholdLine = getValueWithDefault(
|
||||||
threshold,
|
threshold,
|
||||||
`globalThreshold:${threshold}`
|
`globalThreshold:${threshold}`,
|
||||||
);
|
);
|
||||||
const endDateLine = getValueWithDefault(endDate, `endDate:${endDate}`);
|
const endDateLine = getValueWithDefault(endDate, `endDate:${endDate}`);
|
||||||
const mutation = `mutation{
|
const mutation = `mutation{
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { returnValueDependsOnShopVersion } from "../../formatData/dataDependingOnVersion";
|
|
||||||
import { getValueWithDefault } from "./utils/Utils";
|
import { getValueWithDefault } from "./utils/Utils";
|
||||||
|
|
||||||
export function createTypeProduct({
|
export function createTypeProduct({
|
||||||
|
@ -8,16 +7,16 @@ export function createTypeProduct({
|
||||||
slug = name,
|
slug = name,
|
||||||
shippable = true,
|
shippable = true,
|
||||||
kind = "NORMAL",
|
kind = "NORMAL",
|
||||||
productAttributes = true
|
productAttributes = true,
|
||||||
}) {
|
}) {
|
||||||
const kindLines = returnValueDependsOnShopVersion("3.1", `kind: ${kind}`);
|
const kindLines = `kind: ${kind}`;
|
||||||
const productAttributesLine = getValueWithDefault(
|
const productAttributesLine = getValueWithDefault(
|
||||||
productAttributes && attributeId,
|
productAttributes && attributeId,
|
||||||
`productAttributes: "${attributeId}"`
|
`productAttributes: "${attributeId}"`,
|
||||||
);
|
);
|
||||||
const variantAttributesLine = getValueWithDefault(
|
const variantAttributesLine = getValueWithDefault(
|
||||||
hasVariants && attributeId,
|
hasVariants && attributeId,
|
||||||
`variantAttributes: "${attributeId}"`
|
`variantAttributes: "${attributeId}"`,
|
||||||
);
|
);
|
||||||
const mutation = `mutation{
|
const mutation = `mutation{
|
||||||
productTypeCreate(input: {
|
productTypeCreate(input: {
|
||||||
|
@ -78,7 +77,7 @@ export function deleteProductType(productTypeId) {
|
||||||
export function productAttributeAssignmentUpdate({
|
export function productAttributeAssignmentUpdate({
|
||||||
productTypeId,
|
productTypeId,
|
||||||
attributeId,
|
attributeId,
|
||||||
variantSelection = false
|
variantSelection = false,
|
||||||
}) {
|
}) {
|
||||||
const mutation = `mutation {
|
const mutation = `mutation {
|
||||||
productAttributeAssignmentUpdate(
|
productAttributeAssignmentUpdate(
|
||||||
|
@ -152,7 +151,7 @@ export function setProductTypeAsDigital(productTypeId, isDigital = true) {
|
||||||
export function assignAttribute(
|
export function assignAttribute(
|
||||||
productTypeId,
|
productTypeId,
|
||||||
attributeId,
|
attributeId,
|
||||||
attributeType = "VARIANT"
|
attributeType = "VARIANT",
|
||||||
) {
|
) {
|
||||||
const mutation = `mutation{
|
const mutation = `mutation{
|
||||||
productAttributeAssign(productTypeId:"${productTypeId}", operations:{
|
productAttributeAssign(productTypeId:"${productTypeId}", operations:{
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
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 { createChannel } from "../../requests/Channels";
|
||||||
|
@ -10,13 +9,13 @@ import {
|
||||||
deleteProductType,
|
deleteProductType,
|
||||||
getProductTypes,
|
getProductTypes,
|
||||||
productAttributeAssignmentUpdate,
|
productAttributeAssignmentUpdate,
|
||||||
setProductTypeAsDigital
|
setProductTypeAsDigital,
|
||||||
} from "../../requests/ProductType";
|
} from "../../requests/ProductType";
|
||||||
import { deleteAttributesStartsWith } from "../attributes/attributeUtils";
|
import { deleteAttributesStartsWith } from "../attributes/attributeUtils";
|
||||||
import { getDefaultChannel } from "../channelsUtils";
|
import { getDefaultChannel } from "../channelsUtils";
|
||||||
import {
|
import {
|
||||||
createShipping,
|
createShipping,
|
||||||
createShippingWithDefaultChannelAndAddress
|
createShippingWithDefaultChannelAndAddress,
|
||||||
} from "../shippingUtils";
|
} from "../shippingUtils";
|
||||||
|
|
||||||
export function createProductInChannel({
|
export function createProductInChannel({
|
||||||
|
@ -36,7 +35,7 @@ export function createProductInChannel({
|
||||||
trackInventory = true,
|
trackInventory = true,
|
||||||
weight = 1,
|
weight = 1,
|
||||||
preorder,
|
preorder,
|
||||||
sku = name
|
sku = name,
|
||||||
}) {
|
}) {
|
||||||
let product;
|
let product;
|
||||||
let variantsList;
|
let variantsList;
|
||||||
|
@ -50,7 +49,7 @@ export function createProductInChannel({
|
||||||
isAvailableForPurchase,
|
isAvailableForPurchase,
|
||||||
visibleInListings,
|
visibleInListings,
|
||||||
collectionId,
|
collectionId,
|
||||||
description
|
description,
|
||||||
})
|
})
|
||||||
.then(productResp => {
|
.then(productResp => {
|
||||||
product = productResp;
|
product = productResp;
|
||||||
|
@ -64,7 +63,7 @@ export function createProductInChannel({
|
||||||
price,
|
price,
|
||||||
trackInventory,
|
trackInventory,
|
||||||
weight,
|
weight,
|
||||||
preorder
|
preorder,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(variantsResp => {
|
.then(variantsResp => {
|
||||||
|
@ -76,7 +75,7 @@ export function createProductInChannel({
|
||||||
export function createTypeAttributeAndCategoryForProduct({
|
export function createTypeAttributeAndCategoryForProduct({
|
||||||
name,
|
name,
|
||||||
attributeValues,
|
attributeValues,
|
||||||
kind = "NORMAL"
|
kind = "NORMAL",
|
||||||
}) {
|
}) {
|
||||||
let attribute;
|
let attribute;
|
||||||
let productType;
|
let productType;
|
||||||
|
@ -89,14 +88,11 @@ export function createTypeAttributeAndCategoryForProduct({
|
||||||
})
|
})
|
||||||
.then(productTypeResp => {
|
.then(productTypeResp => {
|
||||||
productType = productTypeResp;
|
productType = productTypeResp;
|
||||||
const updateAssign = returnValueDependsOnShopVersion("3.1", true, false);
|
|
||||||
if (updateAssign) {
|
|
||||||
productAttributeAssignmentUpdate({
|
productAttributeAssignmentUpdate({
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
variantSelection: true
|
variantSelection: true,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
categoryRequest.createCategory({ name });
|
categoryRequest.createCategory({ name });
|
||||||
})
|
})
|
||||||
.then(categoryResp => {
|
.then(categoryResp => {
|
||||||
|
@ -111,12 +107,12 @@ export function deleteProductsStartsWith(startsWith) {
|
||||||
cy.deleteElementsStartsWith(
|
cy.deleteElementsStartsWith(
|
||||||
categoryRequest.deleteCategory,
|
categoryRequest.deleteCategory,
|
||||||
categoryRequest.getCategories,
|
categoryRequest.getCategories,
|
||||||
startsWith
|
startsWith,
|
||||||
);
|
);
|
||||||
cy.deleteElementsStartsWith(
|
cy.deleteElementsStartsWith(
|
||||||
productRequest.deleteProduct,
|
productRequest.deleteProduct,
|
||||||
productRequest.getFirstProducts,
|
productRequest.getFirstProducts,
|
||||||
startsWith
|
startsWith,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +123,7 @@ export function createNewProductWithNewDataAndDefaultChannel({
|
||||||
preorder,
|
preorder,
|
||||||
attributeValues = ["value"],
|
attributeValues = ["value"],
|
||||||
sku = name,
|
sku = name,
|
||||||
productPrice = 10
|
productPrice = 10,
|
||||||
}) {
|
}) {
|
||||||
return getDefaultChannel().then(channel => {
|
return getDefaultChannel().then(channel => {
|
||||||
createNewProductWithNewDataAndChannel({
|
createNewProductWithNewDataAndChannel({
|
||||||
|
@ -138,7 +134,7 @@ export function createNewProductWithNewDataAndDefaultChannel({
|
||||||
attributeValues,
|
attributeValues,
|
||||||
sku,
|
sku,
|
||||||
productPrice,
|
productPrice,
|
||||||
defaultChannel: channel
|
defaultChannel: channel,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -151,7 +147,7 @@ export function createNewProductWithNewDataAndChannel({
|
||||||
attributeValues = ["value"],
|
attributeValues = ["value"],
|
||||||
sku = name,
|
sku = name,
|
||||||
productPrice = 10,
|
productPrice = 10,
|
||||||
defaultChannel
|
defaultChannel,
|
||||||
}) {
|
}) {
|
||||||
let collection;
|
let collection;
|
||||||
let attribute;
|
let attribute;
|
||||||
|
@ -167,7 +163,7 @@ export function createNewProductWithNewDataAndChannel({
|
||||||
({
|
({
|
||||||
attribute: attributeResp,
|
attribute: attributeResp,
|
||||||
category: categoryResp,
|
category: categoryResp,
|
||||||
productType: productTypeResp
|
productType: productTypeResp,
|
||||||
}) => {
|
}) => {
|
||||||
attribute = attributeResp;
|
attribute = attributeResp;
|
||||||
category = categoryResp;
|
category = categoryResp;
|
||||||
|
@ -183,16 +179,16 @@ export function createNewProductWithNewDataAndChannel({
|
||||||
warehouseId,
|
warehouseId,
|
||||||
price: productPrice,
|
price: productPrice,
|
||||||
preorder,
|
preorder,
|
||||||
sku
|
sku,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(({ product, variantsList }) => ({
|
.then(({ product, variantsList }) => ({
|
||||||
product,
|
product,
|
||||||
variantsList,
|
variantsList,
|
||||||
attribute,
|
attribute,
|
||||||
category,
|
category,
|
||||||
productType
|
productType,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +199,7 @@ export function createProductWithShipping({
|
||||||
productPrice = 10,
|
productPrice = 10,
|
||||||
shippingPrice = 10,
|
shippingPrice = 10,
|
||||||
preorder,
|
preorder,
|
||||||
newChannel = false
|
newChannel = false,
|
||||||
}) {
|
}) {
|
||||||
let address;
|
let address;
|
||||||
let warehouse;
|
let warehouse;
|
||||||
|
@ -227,14 +223,14 @@ export function createProductWithShipping({
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name,
|
name,
|
||||||
address,
|
address,
|
||||||
price: shippingPrice
|
price: shippingPrice,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(
|
.then(
|
||||||
({
|
({
|
||||||
warehouse: warehouseResp,
|
warehouse: warehouseResp,
|
||||||
shippingZone: shippingZoneResp,
|
shippingZone: shippingZoneResp,
|
||||||
shippingMethod: shippingMethodResp
|
shippingMethod: shippingMethodResp,
|
||||||
}) => {
|
}) => {
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
shippingMethod = shippingMethodResp;
|
shippingMethod = shippingMethodResp;
|
||||||
|
@ -246,9 +242,9 @@ export function createProductWithShipping({
|
||||||
preorder,
|
preorder,
|
||||||
attributeValues,
|
attributeValues,
|
||||||
sku,
|
sku,
|
||||||
defaultChannel
|
defaultChannel,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(({ variantsList, product, attribute, category, productType }) => ({
|
.then(({ variantsList, product, attribute, category, productType }) => ({
|
||||||
variantsList,
|
variantsList,
|
||||||
|
@ -260,7 +256,7 @@ export function createProductWithShipping({
|
||||||
address,
|
address,
|
||||||
attribute,
|
attribute,
|
||||||
category,
|
category,
|
||||||
productType
|
productType,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +270,7 @@ export function createProductInChannelWithoutVariants({
|
||||||
isAvailableForPurchase = true,
|
isAvailableForPurchase = true,
|
||||||
visibleInListings = true,
|
visibleInListings = true,
|
||||||
collectionId = null,
|
collectionId = null,
|
||||||
description = null
|
description = null,
|
||||||
}) {
|
}) {
|
||||||
let product;
|
let product;
|
||||||
return productRequest
|
return productRequest
|
||||||
|
@ -284,7 +280,7 @@ export function createProductInChannelWithoutVariants({
|
||||||
productTypeId,
|
productTypeId,
|
||||||
categoryId,
|
categoryId,
|
||||||
collectionId,
|
collectionId,
|
||||||
description
|
description,
|
||||||
})
|
})
|
||||||
.then(productResp => {
|
.then(productResp => {
|
||||||
product = productResp;
|
product = productResp;
|
||||||
|
@ -293,7 +289,7 @@ export function createProductInChannelWithoutVariants({
|
||||||
channelId,
|
channelId,
|
||||||
isPublished,
|
isPublished,
|
||||||
isAvailableForPurchase,
|
isAvailableForPurchase,
|
||||||
visibleInListings
|
visibleInListings,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => product);
|
.then(() => product);
|
||||||
|
@ -303,7 +299,7 @@ export function addDigitalContentAndUpdateProductType(
|
||||||
variantId,
|
variantId,
|
||||||
productTypeId,
|
productTypeId,
|
||||||
channelId,
|
channelId,
|
||||||
price = 1
|
price = 1,
|
||||||
) {
|
) {
|
||||||
createDigitalContent(variantId);
|
createDigitalContent(variantId);
|
||||||
setProductTypeAsDigital(productTypeId);
|
setProductTypeAsDigital(productTypeId);
|
||||||
|
@ -312,7 +308,7 @@ export function addDigitalContentAndUpdateProductType(
|
||||||
|
|
||||||
export function createDigitalAndPhysicalProductWithNewDataAndDefaultChannel({
|
export function createDigitalAndPhysicalProductWithNewDataAndDefaultChannel({
|
||||||
physicalProductName,
|
physicalProductName,
|
||||||
digitalProductName
|
digitalProductName,
|
||||||
}) {
|
}) {
|
||||||
let physicalVariants;
|
let physicalVariants;
|
||||||
let digitalVariants;
|
let digitalVariants;
|
||||||
|
@ -326,7 +322,7 @@ export function createDigitalAndPhysicalProductWithNewDataAndDefaultChannel({
|
||||||
|
|
||||||
return createProductWithShipping({
|
return createProductWithShipping({
|
||||||
name: physicalProductName,
|
name: physicalProductName,
|
||||||
attributeValues: ["physical"]
|
attributeValues: ["physical"],
|
||||||
})
|
})
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
physicalVariants = resp.variantsList;
|
physicalVariants = resp.variantsList;
|
||||||
|
@ -340,7 +336,7 @@ export function createDigitalAndPhysicalProductWithNewDataAndDefaultChannel({
|
||||||
createTypeProduct({
|
createTypeProduct({
|
||||||
name: digitalProductName,
|
name: digitalProductName,
|
||||||
shippable: false,
|
shippable: false,
|
||||||
attributeId: attribute.id
|
attributeId: attribute.id,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(productType => {
|
.then(productType => {
|
||||||
|
@ -351,7 +347,7 @@ export function createDigitalAndPhysicalProductWithNewDataAndDefaultChannel({
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name: digitalProductName,
|
name: digitalProductName,
|
||||||
warehouseId: warehouse.id
|
warehouseId: warehouse.id,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ variantsList }) => {
|
.then(({ variantsList }) => {
|
||||||
|
@ -359,7 +355,7 @@ export function createDigitalAndPhysicalProductWithNewDataAndDefaultChannel({
|
||||||
addDigitalContentAndUpdateProductType(
|
addDigitalContentAndUpdateProductType(
|
||||||
digitalVariants[0].id,
|
digitalVariants[0].id,
|
||||||
digitalProductType.id,
|
digitalProductType.id,
|
||||||
defaultChannel.id
|
defaultChannel.id,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.then(() => ({
|
.then(() => ({
|
||||||
|
@ -367,7 +363,7 @@ export function createDigitalAndPhysicalProductWithNewDataAndDefaultChannel({
|
||||||
physicalVariants,
|
physicalVariants,
|
||||||
shippingMethod,
|
shippingMethod,
|
||||||
defaultChannel,
|
defaultChannel,
|
||||||
address
|
address,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +388,7 @@ export function createNewProductWithSeveralVariants(name, variantsData) {
|
||||||
createShipping({
|
createShipping({
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name,
|
name,
|
||||||
address
|
address,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(
|
.then(
|
||||||
|
@ -407,15 +403,15 @@ export function createNewProductWithSeveralVariants(name, variantsData) {
|
||||||
|
|
||||||
createTypeAttributeAndCategoryForProduct({
|
createTypeAttributeAndCategoryForProduct({
|
||||||
name,
|
name,
|
||||||
attributeValues
|
attributeValues,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(
|
.then(
|
||||||
({
|
({
|
||||||
attribute: attributeResp,
|
attribute: attributeResp,
|
||||||
category: categoryResp,
|
category: categoryResp,
|
||||||
productType: productTypeResp
|
productType: productTypeResp,
|
||||||
}) => {
|
}) => {
|
||||||
attribute = attributeResp;
|
attribute = attributeResp;
|
||||||
category = categoryResp;
|
category = categoryResp;
|
||||||
|
@ -426,9 +422,9 @@ export function createNewProductWithSeveralVariants(name, variantsData) {
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name
|
name,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(product => {
|
.then(product => {
|
||||||
variantsData.forEach(variant => {
|
variantsData.forEach(variant => {
|
||||||
|
@ -440,7 +436,7 @@ export function createNewProductWithSeveralVariants(name, variantsData) {
|
||||||
attributeName: variant.name,
|
attributeName: variant.name,
|
||||||
trackInventory: variant.trackInventory,
|
trackInventory: variant.trackInventory,
|
||||||
warehouseId: warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
quantityInWarehouse: variant.quantityInWarehouse
|
quantityInWarehouse: variant.quantityInWarehouse,
|
||||||
})
|
})
|
||||||
.then(variants => {
|
.then(variants => {
|
||||||
createdVariants.push(variants[0]);
|
createdVariants.push(variants[0]);
|
||||||
|
@ -452,7 +448,7 @@ export function createNewProductWithSeveralVariants(name, variantsData) {
|
||||||
|
|
||||||
export function createShippingProductTypeAttributeAndCategory(
|
export function createShippingProductTypeAttributeAndCategory(
|
||||||
name,
|
name,
|
||||||
attributeValues
|
attributeValues,
|
||||||
) {
|
) {
|
||||||
let warehouse;
|
let warehouse;
|
||||||
let defaultChannel;
|
let defaultChannel;
|
||||||
|
@ -469,6 +465,6 @@ export function createShippingProductTypeAttributeAndCategory(
|
||||||
productType,
|
productType,
|
||||||
category,
|
category,
|
||||||
warehouse,
|
warehouse,
|
||||||
defaultChannel
|
defaultChannel,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { returnValueDependsOnShopVersion } from "../../formatData/dataDependingOnVersion";
|
|
||||||
import { updateChannelWarehouses } from "../requests/Channels";
|
import { updateChannelWarehouses } from "../requests/Channels";
|
||||||
import * as shippingMethodRequest from "../requests/ShippingMethod";
|
import * as shippingMethodRequest from "../requests/ShippingMethod";
|
||||||
import * as warehouseRequest from "../requests/Warehouse";
|
import * as warehouseRequest from "../requests/Warehouse";
|
||||||
|
@ -27,9 +26,7 @@ export function createShipping({
|
||||||
})
|
})
|
||||||
.then(warehouseResp => {
|
.then(warehouseResp => {
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
if (returnValueDependsOnShopVersion("3.5", true, false)) {
|
|
||||||
updateChannelWarehouses(channelId, warehouse.id);
|
updateChannelWarehouses(channelId, warehouse.id);
|
||||||
}
|
|
||||||
shippingMethodRequest.createShippingRate({
|
shippingMethodRequest.createShippingRate({
|
||||||
name,
|
name,
|
||||||
shippingZone: shippingZone.id,
|
shippingZone: shippingZone.id,
|
||||||
|
|
16
package-lock.json
generated
16
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "saleor-dashboard",
|
"name": "saleor-dashboard",
|
||||||
"version": "3.4.0-dev",
|
"version": "3.6.0-dev",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -10091,7 +10091,7 @@
|
||||||
"buffer-crc32": {
|
"buffer-crc32": {
|
||||||
"version": "0.2.13",
|
"version": "0.2.13",
|
||||||
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
|
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
|
||||||
"integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=",
|
"integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"buffer-equal-constant-time": {
|
"buffer-equal-constant-time": {
|
||||||
|
@ -14970,7 +14970,7 @@
|
||||||
"pify": {
|
"pify": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
|
||||||
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
|
"integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==",
|
||||||
"dev": true
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15453,7 +15453,7 @@
|
||||||
"fd-slicer": {
|
"fd-slicer": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
|
||||||
"integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=",
|
"integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"pend": "~1.2.0"
|
"pend": "~1.2.0"
|
||||||
|
@ -23602,7 +23602,7 @@
|
||||||
"ospath": {
|
"ospath": {
|
||||||
"version": "1.2.2",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/ospath/-/ospath-1.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/ospath/-/ospath-1.2.2.tgz",
|
||||||
"integrity": "sha1-EnZjl3Sj+O8lcvf+QoDg6kVQwHs=",
|
"integrity": "sha512-o6E5qJV5zkAbIDNhGSIlyOhScKXgQrSRMilfph0clDfM0nEnBOlKlH4sWDmG95BW/CvwNz0vmm7dJVtU2KlMiA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"p-cancelable": {
|
"p-cancelable": {
|
||||||
|
@ -24155,7 +24155,7 @@
|
||||||
"pend": {
|
"pend": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
|
||||||
"integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=",
|
"integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"performance-now": {
|
"performance-now": {
|
||||||
|
@ -29949,7 +29949,7 @@
|
||||||
"throttleit": {
|
"throttleit": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz",
|
||||||
"integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=",
|
"integrity": "sha512-rkTVqu6IjfQ/6+uNuuc3sZek4CEYxTJom3IktzgdSxcZqdARuebbA/f4QmAxMQIxqq9ZLEUkSYqvuk1I6VKq4g==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"through": {
|
"through": {
|
||||||
|
@ -32750,7 +32750,7 @@
|
||||||
"yauzl": {
|
"yauzl": {
|
||||||
"version": "2.10.0",
|
"version": "2.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
|
||||||
"integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=",
|
"integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"buffer-crc32": "~0.2.3",
|
"buffer-crc32": "~0.2.3",
|
||||||
|
|
Loading…
Reference in a new issue