refactor c&c tests (#2542)
This commit is contained in:
parent
6efd73230b
commit
b0cdfb7545
1 changed files with 29 additions and 26 deletions
|
@ -34,7 +34,6 @@ describe("Warehouses in checkout", () => {
|
||||||
let defaultChannel;
|
let defaultChannel;
|
||||||
let usAddress;
|
let usAddress;
|
||||||
let secondUsAddress;
|
let secondUsAddress;
|
||||||
let plAddress;
|
|
||||||
let productData;
|
let productData;
|
||||||
let checkoutData;
|
let checkoutData;
|
||||||
let variantsInOtherWarehouse;
|
let variantsInOtherWarehouse;
|
||||||
|
@ -47,7 +46,7 @@ describe("Warehouses in checkout", () => {
|
||||||
.then(addresses => {
|
.then(addresses => {
|
||||||
usAddress = addresses.usAddress;
|
usAddress = addresses.usAddress;
|
||||||
secondUsAddress = addresses.secondUsAddress;
|
secondUsAddress = addresses.secondUsAddress;
|
||||||
plAddress = addresses.plAddress;
|
|
||||||
getDefaultChannel();
|
getDefaultChannel();
|
||||||
})
|
})
|
||||||
.then(channelResp => {
|
.then(channelResp => {
|
||||||
|
@ -78,6 +77,7 @@ describe("Warehouses in checkout", () => {
|
||||||
.then(({ warehouse: warehouseResp }) => {
|
.then(({ warehouse: warehouseResp }) => {
|
||||||
productData.name = startsWith;
|
productData.name = startsWith;
|
||||||
productData.warehouseId = warehouseResp.id;
|
productData.warehouseId = warehouseResp.id;
|
||||||
|
|
||||||
updateWarehouse({ id: productData.warehouseId, isPrivate: false });
|
updateWarehouse({ id: productData.warehouseId, isPrivate: false });
|
||||||
createProductInChannel(productData);
|
createProductInChannel(productData);
|
||||||
})
|
})
|
||||||
|
@ -90,9 +90,9 @@ describe("Warehouses in checkout", () => {
|
||||||
cy.clearSessionData().loginUserViaRequest();
|
cy.clearSessionData().loginUserViaRequest();
|
||||||
});
|
});
|
||||||
|
|
||||||
xit(
|
it(
|
||||||
"should create warehouse with all warehouses pickup and private stock",
|
"should create warehouse with all warehouses pickup and private stock",
|
||||||
{ tags: ["@checkout", "@allEnv"] },
|
{ tags: ["@checkout", "@allEnv", "@stable"] },
|
||||||
() => {
|
() => {
|
||||||
const name = `${startsWith}${faker.datatype.number()}`;
|
const name = `${startsWith}${faker.datatype.number()}`;
|
||||||
let warehouse;
|
let warehouse;
|
||||||
|
@ -104,9 +104,10 @@ describe("Warehouses in checkout", () => {
|
||||||
})
|
})
|
||||||
.then(({ warehouse: warehouseResp }) => {
|
.then(({ warehouse: warehouseResp }) => {
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
visitAndEnablePickup(warehouse.id);
|
|
||||||
productData.name = name;
|
productData.name = name;
|
||||||
productData.warehouseId = warehouse.id;
|
productData.warehouseId = warehouse.id;
|
||||||
|
|
||||||
|
visitAndEnablePickup(warehouse.id);
|
||||||
createProductInChannel(productData);
|
createProductInChannel(productData);
|
||||||
})
|
})
|
||||||
.then(({ variantsList }) => {
|
.then(({ variantsList }) => {
|
||||||
|
@ -127,9 +128,9 @@ describe("Warehouses in checkout", () => {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
xit(
|
it(
|
||||||
"should create warehouse with all warehouses pickup and public stock",
|
"should create warehouse with all warehouses pickup and public stock",
|
||||||
{ tags: ["@checkout", "@allEnv"] },
|
{ tags: ["@checkout", "@allEnv", "@stable"] },
|
||||||
() => {
|
() => {
|
||||||
const name = `${startsWith}${faker.datatype.number()}`;
|
const name = `${startsWith}${faker.datatype.number()}`;
|
||||||
let warehouse;
|
let warehouse;
|
||||||
|
@ -141,9 +142,10 @@ describe("Warehouses in checkout", () => {
|
||||||
})
|
})
|
||||||
.then(({ warehouse: warehouseResp }) => {
|
.then(({ warehouse: warehouseResp }) => {
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
visitSetPublicStockAndEnablePickup(warehouse.id);
|
|
||||||
productData.name = name;
|
productData.name = name;
|
||||||
productData.warehouseId = warehouse.id;
|
productData.warehouseId = warehouse.id;
|
||||||
|
|
||||||
|
visitSetPublicStockAndEnablePickup(warehouse.id);
|
||||||
createProductInChannel(productData);
|
createProductInChannel(productData);
|
||||||
})
|
})
|
||||||
.then(({ variantsList }) => {
|
.then(({ variantsList }) => {
|
||||||
|
@ -164,9 +166,9 @@ describe("Warehouses in checkout", () => {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
xit(
|
it(
|
||||||
"should create warehouse with local stock only pickup and public stock",
|
"should create warehouse with local stock only pickup and public stock",
|
||||||
{ tags: ["@checkout", "@allEnv"] },
|
{ tags: ["@checkout", "@allEnv", "@stable"] },
|
||||||
() => {
|
() => {
|
||||||
const name = `${startsWith}${faker.datatype.number()}`;
|
const name = `${startsWith}${faker.datatype.number()}`;
|
||||||
let warehouse;
|
let warehouse;
|
||||||
|
@ -179,9 +181,10 @@ describe("Warehouses in checkout", () => {
|
||||||
})
|
})
|
||||||
.then(({ warehouse: warehouseResp }) => {
|
.then(({ warehouse: warehouseResp }) => {
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
visitSetPublicStockAndEnablePickup(warehouse.id, pickupOptions.local);
|
|
||||||
productData.name = name;
|
productData.name = name;
|
||||||
productData.warehouseId = warehouse.id;
|
productData.warehouseId = warehouse.id;
|
||||||
|
|
||||||
|
visitSetPublicStockAndEnablePickup(warehouse.id, pickupOptions.local);
|
||||||
createProductInChannel(productData);
|
createProductInChannel(productData);
|
||||||
})
|
})
|
||||||
.then(({ variantsList }) => {
|
.then(({ variantsList }) => {
|
||||||
|
@ -196,24 +199,25 @@ describe("Warehouses in checkout", () => {
|
||||||
1,
|
1,
|
||||||
"there should be no available collection point for local stock",
|
"there should be no available collection point for local stock",
|
||||||
);
|
);
|
||||||
|
|
||||||
checkoutData.variantsList = variantsInLocalStock;
|
checkoutData.variantsList = variantsInLocalStock;
|
||||||
createCheckout(checkoutData);
|
|
||||||
})
|
createCheckout(checkoutData)
|
||||||
.then(({ checkout }) => {
|
.its("checkout.availableCollectionPoints.0")
|
||||||
const clickAndCollectOption = checkout.availableCollectionPoints[0];
|
.should("include", { id: warehouse.id })
|
||||||
expect(clickAndCollectOption.clickAndCollectOption).to.eq("LOCAL");
|
.and("include", { isPrivate: false })
|
||||||
expect(clickAndCollectOption.id).to.eq(warehouse.id);
|
.and("include", { name: warehouse.name })
|
||||||
expect(clickAndCollectOption.isPrivate).to.eq(false);
|
.and("include", { clickAndCollectOption: "LOCAL" });
|
||||||
expect(clickAndCollectOption.name).to.eq(warehouse.name);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
xit(
|
it(
|
||||||
"should not be possible to set local pickup when private stock",
|
"should not be possible to set local pickup when private stock",
|
||||||
{ tags: ["@checkout", "@allEnv"] },
|
{ tags: ["@checkout", "@allEnv", "@stable"] },
|
||||||
() => {
|
() => {
|
||||||
const name = `${startsWith}${faker.datatype.number()}`;
|
const name = `${startsWith}${faker.datatype.number()}`;
|
||||||
|
|
||||||
createWarehouse({ name, address: usAddress });
|
createWarehouse({ name, address: usAddress });
|
||||||
cy.get(WAREHOUSES_DETAILS.clickAndCollectLocalStockRadioButton).should(
|
cy.get(WAREHOUSES_DETAILS.clickAndCollectLocalStockRadioButton).should(
|
||||||
"not.exist",
|
"not.exist",
|
||||||
|
@ -223,20 +227,19 @@ describe("Warehouses in checkout", () => {
|
||||||
|
|
||||||
it(
|
it(
|
||||||
"should create order with warehouse address",
|
"should create order with warehouse address",
|
||||||
{ tags: ["@checkout", "@allEnv"] },
|
{ tags: ["@checkout", "@allEnv", "@stable"] },
|
||||||
() => {
|
() => {
|
||||||
let checkout;
|
let checkout;
|
||||||
|
|
||||||
checkoutData.variantsList = variantsInOtherWarehouse;
|
checkoutData.variantsList = variantsInOtherWarehouse;
|
||||||
|
|
||||||
createCheckout(checkoutData)
|
createCheckout(checkoutData)
|
||||||
.then(({ checkout: checkoutResp }) => {
|
.then(({ checkout: checkoutResp }) => {
|
||||||
checkout = checkoutResp;
|
checkout = checkoutResp;
|
||||||
const clickAndCollectOption = checkout.availableCollectionPoints[0];
|
const clickAndCollectOption = checkout.availableCollectionPoints[0];
|
||||||
|
|
||||||
deliveryMethodUpdate(clickAndCollectOption.id, checkout.token);
|
deliveryMethodUpdate(clickAndCollectOption.id, checkout.token);
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
addPayment(checkout.id);
|
addPayment(checkout.id);
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
completeCheckout(checkout.id);
|
completeCheckout(checkout.id);
|
||||||
})
|
})
|
||||||
.then(({ order }) => {
|
.then(({ order }) => {
|
||||||
|
|
Loading…
Reference in a new issue