tests for products
This commit is contained in:
parent
4fc9fefa74
commit
e8c20ae511
12 changed files with 170 additions and 170 deletions
|
@ -1,4 +1,7 @@
|
||||||
|
import Utils from "./utils/Utils";
|
||||||
|
|
||||||
class Product {
|
class Product {
|
||||||
|
utils = new Utils();
|
||||||
getFirstProducts(first, search) {
|
getFirstProducts(first, search) {
|
||||||
const filter = search
|
const filter = search
|
||||||
? `, filter:{
|
? `, filter:{
|
||||||
|
@ -23,13 +26,13 @@ class Product {
|
||||||
.then(resp => resp.body.data.products.edges);
|
.then(resp => resp.body.data.products.edges);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateChannelInProduct(
|
updateChannelInProduct({
|
||||||
productId,
|
productId,
|
||||||
channelId,
|
channelId,
|
||||||
isPublished = true,
|
isPublished = true,
|
||||||
isAvailableForPurchase = true,
|
isAvailableForPurchase = true,
|
||||||
visibleInListings = true
|
visibleInListings = true
|
||||||
) {
|
}) {
|
||||||
const mutation = `mutation{
|
const mutation = `mutation{
|
||||||
productChannelListingUpdate(id:"${productId}",
|
productChannelListingUpdate(id:"${productId}",
|
||||||
input:{
|
input:{
|
||||||
|
@ -94,19 +97,36 @@ class Product {
|
||||||
price = 1,
|
price = 1,
|
||||||
costPrice = 1
|
costPrice = 1
|
||||||
) {
|
) {
|
||||||
const channelListings = channelId
|
// const channelListings = channelId
|
||||||
? `channelListings:{
|
// ? `channelListings:{
|
||||||
|
// channelId:"${channelId}"
|
||||||
|
// price:"${price}"
|
||||||
|
// costPrice:"${costPrice}"
|
||||||
|
// }`
|
||||||
|
// : "";
|
||||||
|
|
||||||
|
const channelListings = this.utils.getValueWithDefault(
|
||||||
|
channelId,
|
||||||
|
`channelListings:{
|
||||||
channelId:"${channelId}"
|
channelId:"${channelId}"
|
||||||
price:"${price}"
|
price:"${price}"
|
||||||
costPrice:"${costPrice}"
|
costPrice:"${costPrice}"
|
||||||
}`
|
}`
|
||||||
: "";
|
);
|
||||||
const stocks = warehouseId
|
|
||||||
? `stocks:{
|
const stocks = this.utils.getValueWithDefault(
|
||||||
|
warehouseId,
|
||||||
|
`stocks:{
|
||||||
warehouse:"${warehouseId}"
|
warehouse:"${warehouseId}"
|
||||||
quantity:${quantity}
|
quantity:${quantity}
|
||||||
}`
|
}`
|
||||||
: "";
|
);
|
||||||
|
// warehouseId
|
||||||
|
// ? `stocks:{
|
||||||
|
// warehouse:"${warehouseId}"
|
||||||
|
// quantity:${quantity}
|
||||||
|
// }`
|
||||||
|
// : "";
|
||||||
|
|
||||||
const mutation = `mutation{
|
const mutation = `mutation{
|
||||||
productVariantBulkCreate(product: "${productId}", variants: {
|
productVariantBulkCreate(product: "${productId}", variants: {
|
||||||
|
|
6
cypress/apiRequests/utils/Utils.js
Normal file
6
cypress/apiRequests/utils/Utils.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
class Utils {
|
||||||
|
getValueWithDefault(condition, value, defaultValue = "") {
|
||||||
|
return condition ? value : defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export default Utils;
|
|
@ -44,10 +44,13 @@ describe("Channels", () => {
|
||||||
|
|
||||||
it("should create new channel", () => {
|
it("should create new channel", () => {
|
||||||
const randomChannel = `${channelStartsWith} ${faker.random.number()}`;
|
const randomChannel = `${channelStartsWith} ${faker.random.number()}`;
|
||||||
cy.visit(urlList.channels).waitForGraph("Channels");
|
cy.addAliasToGraphRequest("Channels");
|
||||||
|
cy.visit(urlList.channels);
|
||||||
|
cy.wait("@Channels");
|
||||||
|
cy.addAliasToGraphRequest("Channel");
|
||||||
channelsSteps.createChannelByView(randomChannel, currency);
|
channelsSteps.createChannelByView(randomChannel, currency);
|
||||||
// New channel should be visible in channels list
|
// New channel should be visible in channels list
|
||||||
cy.waitForGraph("Channel")
|
cy.wait("@Channel")
|
||||||
.get(ADD_CHANNEL_FORM_SELECTORS.backToChannelsList)
|
.get(ADD_CHANNEL_FORM_SELECTORS.backToChannelsList)
|
||||||
.click()
|
.click()
|
||||||
.get(CHANNELS_SELECTORS.channelsTable)
|
.get(CHANNELS_SELECTORS.channelsTable)
|
||||||
|
@ -62,7 +65,9 @@ describe("Channels", () => {
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
// new channel should be visible at product availability form
|
// new channel should be visible at product availability form
|
||||||
cy.visit(urlList.products).waitForGraph("InitialProductFilterData");
|
cy.addAliasToGraphRequest("InitialProductFilterData");
|
||||||
|
cy.visit(urlList.products);
|
||||||
|
cy.wait("@InitialProductFilterData");
|
||||||
cy.get(PRODUCTS_SELECTORS.productsList)
|
cy.get(PRODUCTS_SELECTORS.productsList)
|
||||||
.first()
|
.first()
|
||||||
.click()
|
.click()
|
||||||
|
@ -103,15 +108,18 @@ describe("Channels", () => {
|
||||||
randomChannelToDelete,
|
randomChannelToDelete,
|
||||||
currency
|
currency
|
||||||
);
|
);
|
||||||
cy.visit(urlList.channels).waitForGraph("Channels");
|
cy.addAliasToGraphRequest("Channels");
|
||||||
|
cy.visit(urlList.channels);
|
||||||
|
cy.wait("@Channels");
|
||||||
cy.get(CHANNELS_SELECTORS.channelName)
|
cy.get(CHANNELS_SELECTORS.channelName)
|
||||||
.contains(randomChannelToDelete)
|
.contains(randomChannelToDelete)
|
||||||
.parentsUntil(CHANNELS_SELECTORS.channelsTable)
|
.parentsUntil(CHANNELS_SELECTORS.channelsTable)
|
||||||
.find("button")
|
.find("button")
|
||||||
.click()
|
.click();
|
||||||
.get(BUTTON_SELECTORS.submit)
|
cy.addAliasToGraphRequest("Channels");
|
||||||
.click()
|
cy.get(BUTTON_SELECTORS.submit).click();
|
||||||
.waitForGraph("Channels");
|
cy.wait("@Channels");
|
||||||
|
|
||||||
cy.get(CHANNELS_SELECTORS.channelName)
|
cy.get(CHANNELS_SELECTORS.channelName)
|
||||||
.contains(randomChannelToDelete)
|
.contains(randomChannelToDelete)
|
||||||
.should("not.exist");
|
.should("not.exist");
|
||||||
|
|
|
@ -48,12 +48,12 @@ describe("Homepage analytics", () => {
|
||||||
)
|
)
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
customerId = resp.body.data.customerCreate.user.id;
|
customerId = resp.body.data.customerCreate.user.id;
|
||||||
shippingUtils.createShipping(
|
shippingUtils.createShipping({
|
||||||
defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
randomName,
|
name: randomName,
|
||||||
addresses.plAddress,
|
address: addresses.plAddress,
|
||||||
shippingPrice
|
price: shippingPrice
|
||||||
);
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
productsUtils.createTypeAttributeAndCategoryForProduct(randomName);
|
productsUtils.createTypeAttributeAndCategoryForProduct(randomName);
|
||||||
|
@ -63,16 +63,16 @@ describe("Homepage analytics", () => {
|
||||||
const productType = productsUtils.getProductType();
|
const productType = productsUtils.getProductType();
|
||||||
const attribute = productsUtils.getAttribute();
|
const attribute = productsUtils.getAttribute();
|
||||||
const category = productsUtils.getCategory();
|
const category = productsUtils.getCategory();
|
||||||
productsUtils.createProductInChannel(
|
productsUtils.createProductInChannel({
|
||||||
randomName,
|
name: randomName,
|
||||||
defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
20,
|
quantityInWarehouse: 20,
|
||||||
productType.id,
|
productTypeId: productType.id,
|
||||||
attribute.id,
|
attributeId: attribute.id,
|
||||||
category.id,
|
categoryId: category.id,
|
||||||
productPrice
|
price: productPrice
|
||||||
);
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -154,16 +154,16 @@ describe("Homepage analytics", () => {
|
||||||
const attribute = productsUtils.getAttribute();
|
const attribute = productsUtils.getAttribute();
|
||||||
const category = productsUtils.getCategory();
|
const category = productsUtils.getCategory();
|
||||||
|
|
||||||
productsOutOfStockUtils.createProductInChannel(
|
productsOutOfStockUtils.createProductInChannel({
|
||||||
productOutOfStockRandomName,
|
name: productOutOfStockRandomName,
|
||||||
defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
0,
|
quantityInWarehouse: 0,
|
||||||
productType.id,
|
productTypeId: productType.id,
|
||||||
attribute.id,
|
attributeId: attribute.id,
|
||||||
category.id,
|
categoryId: category.id,
|
||||||
productPrice
|
price: productPrice
|
||||||
);
|
});
|
||||||
|
|
||||||
cy.get("@productsOutOfStock").then(productsOutOfStockBefore => {
|
cy.get("@productsOutOfStock").then(productsOutOfStockBefore => {
|
||||||
const allProductsOutOfStock = productsOutOfStockBefore + 1;
|
const allProductsOutOfStock = productsOutOfStockBefore + 1;
|
||||||
|
|
|
@ -34,12 +34,11 @@ describe("Products available in listings", () => {
|
||||||
cy.fixture("addresses");
|
cy.fixture("addresses");
|
||||||
})
|
})
|
||||||
.then(addressesFixture => {
|
.then(addressesFixture => {
|
||||||
shippingUtils.createShipping(
|
shippingUtils.createShipping({
|
||||||
defaultChannel,
|
channelId: defaultChannel.id,
|
||||||
name,
|
name,
|
||||||
addressesFixture.plAddress,
|
address: addressesFixture.plAddress
|
||||||
10
|
});
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
warehouse = shippingUtils.getWarehouse();
|
warehouse = shippingUtils.getWarehouse();
|
||||||
|
@ -59,19 +58,15 @@ describe("Products available in listings", () => {
|
||||||
it("should update product to available for purchase", () => {
|
it("should update product to available for purchase", () => {
|
||||||
const productName = `${startsWith}${faker.random.number()}`;
|
const productName = `${startsWith}${faker.random.number()}`;
|
||||||
productsUtils
|
productsUtils
|
||||||
.createProductInChannel(
|
.createProductInChannel({
|
||||||
productName,
|
name: productName,
|
||||||
defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
10,
|
productTypeId: productType.id,
|
||||||
productType.id,
|
attributeId: attribute.id,
|
||||||
attribute.id,
|
categoryId: category.id,
|
||||||
category.id,
|
isAvailableForPurchase: false
|
||||||
1,
|
})
|
||||||
true,
|
|
||||||
false,
|
|
||||||
true
|
|
||||||
)
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const productUrl = `${urlList.products}${
|
const productUrl = `${urlList.products}${
|
||||||
productsUtils.getCreatedProduct().id
|
productsUtils.getCreatedProduct().id
|
||||||
|
@ -92,33 +87,29 @@ describe("Products available in listings", () => {
|
||||||
it("should update product to not available for purchase", () => {
|
it("should update product to not available for purchase", () => {
|
||||||
const productName = `${startsWith}${faker.random.number()}`;
|
const productName = `${startsWith}${faker.random.number()}`;
|
||||||
productsUtils
|
productsUtils
|
||||||
.createProductInChannel(
|
.createProductInChannel({
|
||||||
productName,
|
name: productName,
|
||||||
defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
10,
|
productTypeId: productType.id,
|
||||||
productType.id,
|
attributeId: attribute.id,
|
||||||
attribute.id,
|
categoryId: category.id
|
||||||
category.id,
|
})
|
||||||
1,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true
|
|
||||||
)
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const productUrl = `${urlList.products}${
|
const productUrl = `${urlList.products}${
|
||||||
productsUtils.getCreatedProduct().id
|
productsUtils.getCreatedProduct().id
|
||||||
}`;
|
}`;
|
||||||
productSteps.updateProductIsAvailableForPurchase(productUrl, false);
|
productSteps.updateProductIsAvailableForPurchase(productUrl, false);
|
||||||
frontShopProductUtils
|
})
|
||||||
.isProductAvailableForPurchase(
|
.then(() => {
|
||||||
productsUtils.getCreatedProduct().id,
|
frontShopProductUtils.isProductAvailableForPurchase(
|
||||||
defaultChannel.slug,
|
productsUtils.getCreatedProduct().id,
|
||||||
productName
|
defaultChannel.slug,
|
||||||
)
|
productName
|
||||||
.then(isProductVisible => {
|
);
|
||||||
expect(isProductVisible).to.be.eq(false);
|
})
|
||||||
});
|
.then(isProductVisible => {
|
||||||
|
expect(isProductVisible).to.be.eq(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,19 +39,15 @@ describe("Published products", () => {
|
||||||
.getDefaultChannel()
|
.getDefaultChannel()
|
||||||
.then(channel => {
|
.then(channel => {
|
||||||
defaultChannel = channel;
|
defaultChannel = channel;
|
||||||
productsUtils.createProductInChannel(
|
productsUtils.createProductInChannel({
|
||||||
productName,
|
name: productName,
|
||||||
defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
null,
|
productTypeId: productType.id,
|
||||||
null,
|
attributeId: attribute.id,
|
||||||
productType.id,
|
categoryId: category.id,
|
||||||
attribute.id,
|
isPublished: false,
|
||||||
category.id,
|
isAvailableForPurchase: false
|
||||||
1,
|
});
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const product = productsUtils.getCreatedProduct();
|
const product = productsUtils.getCreatedProduct();
|
||||||
|
@ -76,15 +72,13 @@ describe("Published products", () => {
|
||||||
.getDefaultChannel()
|
.getDefaultChannel()
|
||||||
.then(channel => {
|
.then(channel => {
|
||||||
defaultChannel = channel;
|
defaultChannel = channel;
|
||||||
productsUtils.createProductInChannel(
|
productsUtils.createProductInChannel({
|
||||||
productName,
|
name: productName,
|
||||||
defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
null,
|
productTypeId: productType.id,
|
||||||
null,
|
attributeId: attribute.id,
|
||||||
productType.id,
|
categoryId: category.id
|
||||||
attribute.id,
|
});
|
||||||
category.id
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
product = productsUtils.getCreatedProduct();
|
product = productsUtils.getCreatedProduct();
|
||||||
|
|
|
@ -39,19 +39,15 @@ describe("Products displayed in listings", () => {
|
||||||
.getDefaultChannel()
|
.getDefaultChannel()
|
||||||
.then(channel => {
|
.then(channel => {
|
||||||
defaultChannel = channel;
|
defaultChannel = channel;
|
||||||
productsUtils.createProductInChannel(
|
productsUtils.createProductInChannel({
|
||||||
productName,
|
name: productName,
|
||||||
defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
null,
|
productTypeId: productType.id,
|
||||||
null,
|
attributeId: attribute.id,
|
||||||
productType.id,
|
categoryId: category.id,
|
||||||
attribute.id,
|
visibleInListings: false,
|
||||||
category.id,
|
isAvailableForPurchase: false
|
||||||
1,
|
});
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const product = productsUtils.getCreatedProduct();
|
const product = productsUtils.getCreatedProduct();
|
||||||
|
@ -73,19 +69,14 @@ describe("Products displayed in listings", () => {
|
||||||
.getDefaultChannel()
|
.getDefaultChannel()
|
||||||
.then(channel => {
|
.then(channel => {
|
||||||
defaultChannel = channel;
|
defaultChannel = channel;
|
||||||
productsUtils.createProductInChannel(
|
productsUtils.createProductInChannel({
|
||||||
productName,
|
name: productName,
|
||||||
defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
null,
|
productTypeId: productType.id,
|
||||||
null,
|
attributeId: attribute.id,
|
||||||
productType.id,
|
categoryId: category.id,
|
||||||
attribute.id,
|
visibleInListings: true
|
||||||
category.id,
|
});
|
||||||
1,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const product = productsUtils.getCreatedProduct();
|
const product = productsUtils.getCreatedProduct();
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { HEADER_SELECTORS } from "../elements/header/header-selectors";
|
import { HEADER_SELECTORS } from "../elements/header/header-selectors";
|
||||||
class HomePageSteps {
|
class HomePageSteps {
|
||||||
changeChannel(channelName) {
|
changeChannel(channelName) {
|
||||||
cy.get(HEADER_SELECTORS.channelSelect)
|
cy.get(HEADER_SELECTORS.channelSelect).click();
|
||||||
.click()
|
cy.addAliasToGraphRequest("Home");
|
||||||
.get(HEADER_SELECTORS.channelSelectList)
|
cy.get(HEADER_SELECTORS.channelSelectList)
|
||||||
.contains(channelName)
|
.contains(channelName)
|
||||||
.click()
|
.click();
|
||||||
.waitForGraph("Home");
|
cy.wait("@Home");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default HomePageSteps;
|
export default HomePageSteps;
|
||||||
|
|
|
@ -1,30 +1,20 @@
|
||||||
import { PRODUCTS_SELECTORS } from "../elements/catalog/product-selectors";
|
import { PRODUCTS_SELECTORS } from "../elements/catalog/product-selectors";
|
||||||
|
|
||||||
class ProductSteps {
|
class ProductSteps {
|
||||||
|
valueTrue = PRODUCTS_SELECTORS.radioButtonsValueTrue;
|
||||||
|
valueFalse = PRODUCTS_SELECTORS.radioButtonsValueFalse;
|
||||||
|
|
||||||
updateProductIsAvailableForPurchase(productUrl, isAvailableForPurchase) {
|
updateProductIsAvailableForPurchase(productUrl, isAvailableForPurchase) {
|
||||||
let isAvailableForPurchaseSelector;
|
const isAvailableForPurchaseSelector = isAvailableForPurchase
|
||||||
if (isAvailableForPurchase) {
|
? this.valueTrue
|
||||||
isAvailableForPurchaseSelector = PRODUCTS_SELECTORS.radioButtonsValueTrue;
|
: this.valueFalse;
|
||||||
} else {
|
const availableForPurchaseSelector = `${PRODUCTS_SELECTORS.availableForPurchaseRadioButtons}${isAvailableForPurchaseSelector}`;
|
||||||
isAvailableForPurchaseSelector =
|
this.updateProductMenageInChannel(productUrl, availableForPurchaseSelector);
|
||||||
PRODUCTS_SELECTORS.radioButtonsValueFalse;
|
|
||||||
}
|
|
||||||
this.updateProductMenageInChannel(
|
|
||||||
productUrl,
|
|
||||||
`${PRODUCTS_SELECTORS.availableForPurchaseRadioButtons}${isAvailableForPurchaseSelector}`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
updateProductPublish(productUrl, isPublished) {
|
updateProductPublish(productUrl, isPublished) {
|
||||||
let isPublishedSelector;
|
const isPublishedSelector = isPublished ? this.valueTrue : this.valueFalse;
|
||||||
if (isPublished) {
|
const publishedSelector = `${PRODUCTS_SELECTORS.publishedRadioButtons}${isPublishedSelector}`;
|
||||||
isPublishedSelector = PRODUCTS_SELECTORS.radioButtonsValueTrue;
|
this.updateProductMenageInChannel(productUrl, publishedSelector);
|
||||||
} else {
|
|
||||||
isPublishedSelector = PRODUCTS_SELECTORS.radioButtonsValueFalse;
|
|
||||||
}
|
|
||||||
this.updateProductMenageInChannel(
|
|
||||||
productUrl,
|
|
||||||
`${PRODUCTS_SELECTORS.publishedRadioButtons}${isPublishedSelector}`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
updateProductVisibleInListings(productUrl) {
|
updateProductVisibleInListings(productUrl) {
|
||||||
this.updateProductMenageInChannel(
|
this.updateProductMenageInChannel(
|
||||||
|
@ -37,10 +27,11 @@ class ProductSteps {
|
||||||
.get(PRODUCTS_SELECTORS.assignedChannels)
|
.get(PRODUCTS_SELECTORS.assignedChannels)
|
||||||
.click()
|
.click()
|
||||||
.get(menageSelector)
|
.get(menageSelector)
|
||||||
|
.click();
|
||||||
|
cy.addAliasToGraphRequest("ProductChannelListingUpdate");
|
||||||
|
cy.get(PRODUCTS_SELECTORS.saveBtn)
|
||||||
.click()
|
.click()
|
||||||
.get(PRODUCTS_SELECTORS.saveBtn)
|
.wait("@ProductChannelListingUpdate");
|
||||||
.click()
|
|
||||||
.waitForGraph("ProductChannelListingUpdate");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default ProductSteps;
|
export default ProductSteps;
|
||||||
|
|
|
@ -21,7 +21,7 @@ Cypress.Commands.add("clearSessionData", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("waitForGraph", operationName => {
|
Cypress.Commands.add("addAliasToGraphRequest", operationName => {
|
||||||
cy.intercept("POST", urlList.apiUri, req => {
|
cy.intercept("POST", urlList.apiUri, req => {
|
||||||
req.statusCode = 200;
|
req.statusCode = 200;
|
||||||
const requestBody = req.body;
|
const requestBody = req.body;
|
||||||
|
@ -37,7 +37,6 @@ Cypress.Commands.add("waitForGraph", operationName => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cy.wait(`@${operationName}`);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("sendRequestWithQuery", query => {
|
Cypress.Commands.add("sendRequestWithQuery", query => {
|
||||||
|
|
|
@ -22,28 +22,28 @@ class ProductsUtils {
|
||||||
).then(() => this.createVariant(this.product.id, name));
|
).then(() => this.createVariant(this.product.id, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
createProductInChannel(
|
createProductInChannel({
|
||||||
name,
|
name,
|
||||||
channelId,
|
channelId,
|
||||||
warehouseId,
|
warehouseId = null,
|
||||||
quantityInWarehouse,
|
quantityInWarehouse = 10,
|
||||||
productTypeId,
|
productTypeId,
|
||||||
attributeId,
|
attributeId,
|
||||||
categoryId,
|
categoryId,
|
||||||
price,
|
price = 1,
|
||||||
isPublished = true,
|
isPublished = true,
|
||||||
isAvailableForPurchase = true,
|
isAvailableForPurchase = true,
|
||||||
visibleInListings = true
|
visibleInListings = true
|
||||||
) {
|
}) {
|
||||||
return this.createProduct(attributeId, name, productTypeId, categoryId)
|
return this.createProduct(attributeId, name, productTypeId, categoryId)
|
||||||
.then(() =>
|
.then(() =>
|
||||||
this.productRequest.updateChannelInProduct(
|
this.productRequest.updateChannelInProduct({
|
||||||
this.product.id,
|
productId: this.product.id,
|
||||||
channelId,
|
channelId,
|
||||||
isPublished,
|
isPublished,
|
||||||
isAvailableForPurchase,
|
isAvailableForPurchase,
|
||||||
visibleInListings
|
visibleInListings
|
||||||
)
|
})
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.createVariant(
|
this.createVariant(
|
||||||
|
|
|
@ -8,7 +8,7 @@ class ShippingUtils {
|
||||||
shippingZone;
|
shippingZone;
|
||||||
warehouse;
|
warehouse;
|
||||||
|
|
||||||
createShipping(channelId, name, address, price) {
|
createShipping({ channelId, name, address, price = 1 }) {
|
||||||
return this.createShippingZone(name, address.country)
|
return this.createShippingZone(name, address.country)
|
||||||
.then(() => this.createWarehouse(name, this.shippingZone.id, address))
|
.then(() => this.createWarehouse(name, this.shippingZone.id, address))
|
||||||
.then(() => this.createShippingRate(name, this.shippingZone.id))
|
.then(() => this.createShippingRate(name, this.shippingZone.id))
|
||||||
|
|
Loading…
Reference in a new issue