Fix for tests connected with changes for relation between channel-warehouse-shippingzone (#2189)
This commit is contained in:
parent
6cd42b0ae8
commit
8a07f226e6
12 changed files with 268 additions and 175 deletions
|
@ -31,7 +31,7 @@ describe("As a staff user I want have different shipping method prices for each
|
|||
|
||||
it(
|
||||
"should be able to display different price for each channel. TC: SALEOR_0805",
|
||||
{ tags: ["@shipping", "@allEnv"] },
|
||||
{ tags: ["@shipping", "@allEnv", "@stable"] },
|
||||
() => {
|
||||
const shippingName = `${startsWith}${faker.datatype.number()}`;
|
||||
const defaultChannelPrice = 11;
|
||||
|
|
|
@ -5,6 +5,7 @@ import faker from "faker";
|
|||
|
||||
import { urlList } from "../../../fixtures/urlList";
|
||||
import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
|
||||
import { updateChannelWarehouses } from "../../../support/api/requests/Channels";
|
||||
import { createCheckout } from "../../../support/api/requests/Checkout";
|
||||
import { createVariant } from "../../../support/api/requests/Product";
|
||||
import { createWarehouse } from "../../../support/api/requests/Warehouse";
|
||||
|
@ -44,14 +45,18 @@ describe("As a staff user I want to create shipping zone and rate", () => {
|
|||
.getDefaultChannel()
|
||||
.then(channel => {
|
||||
defaultChannel = channel;
|
||||
|
||||
cy.fixture("addresses");
|
||||
})
|
||||
.then(addresses => {
|
||||
address = addresses.usAddress;
|
||||
|
||||
createWarehouse({ name, address });
|
||||
})
|
||||
.then(warehouseResp => {
|
||||
warehouse = warehouseResp;
|
||||
|
||||
updateChannelWarehouses(defaultChannel.id, warehouse.id);
|
||||
productsUtils.createTypeAttributeAndCategoryForProduct({
|
||||
name: startsWith,
|
||||
});
|
||||
|
@ -103,7 +108,7 @@ describe("As a staff user I want to create shipping zone and rate", () => {
|
|||
|
||||
it(
|
||||
"should be able to create price based shipping method. TC: SALEOR_0803",
|
||||
{ tags: ["@shipping", "@allEnv"] },
|
||||
{ tags: ["@shipping", "@allEnv", "@stable"] },
|
||||
() => {
|
||||
const shippingName = `${startsWith}${faker.datatype.number()}`;
|
||||
cy.clearSessionData().loginUserViaRequest(
|
||||
|
@ -153,7 +158,7 @@ describe("As a staff user I want to create shipping zone and rate", () => {
|
|||
|
||||
it(
|
||||
"should be able to create weight based shipping method. TC: SALEOR_0804",
|
||||
{ tags: ["@shipping", "@allEnv"] },
|
||||
{ tags: ["@shipping", "@allEnv", "@stable"] },
|
||||
() => {
|
||||
const shippingName = `${startsWith}${faker.datatype.number()}`;
|
||||
cy.clearSessionData().loginUserViaRequest(
|
||||
|
|
|
@ -4,12 +4,14 @@
|
|||
import faker from "faker";
|
||||
|
||||
import { shippingRateUrl } from "../../../fixtures/urlList";
|
||||
import { updateChannelWarehouses } from "../../../support/api/requests/Channels";
|
||||
import {
|
||||
addChannelToShippingMethod,
|
||||
createShippingRate,
|
||||
createShippingZone,
|
||||
getShippingZone,
|
||||
} from "../../../support/api/requests/ShippingMethod";
|
||||
import { createWarehouse } from "../../../support/api/requests/Warehouse";
|
||||
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
||||
import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
|
||||
import {
|
||||
|
@ -25,6 +27,8 @@ describe("As a user I should be able to update and delete shipping method", () =
|
|||
let defaultChannel;
|
||||
let shippingZone;
|
||||
let shippingMethod;
|
||||
let usAddress;
|
||||
let warehouse;
|
||||
|
||||
before(() => {
|
||||
cy.clearSessionData().loginUserViaRequest();
|
||||
|
@ -33,10 +37,22 @@ describe("As a user I should be able to update and delete shipping method", () =
|
|||
getDefaultChannel()
|
||||
.then(channel => {
|
||||
defaultChannel = channel;
|
||||
createShippingZone(name, "US", defaultChannel.id);
|
||||
|
||||
cy.fixture("addresses");
|
||||
})
|
||||
.then(shippingZoneResp => {
|
||||
shippingZone = shippingZoneResp;
|
||||
.then(({ usAddress: usAddressResp }) => {
|
||||
usAddress = usAddressResp;
|
||||
|
||||
createWarehouse({ name, address: usAddress }).then(warehouseResp => {
|
||||
warehouse = warehouseResp;
|
||||
|
||||
updateChannelWarehouses(defaultChannel.id, warehouse.id);
|
||||
createShippingZone(name, "US", defaultChannel.id, warehouse.id).then(
|
||||
shippingZoneResp => {
|
||||
shippingZone = shippingZoneResp;
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import faker from "faker";
|
|||
|
||||
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
|
||||
import { shippingZoneDetailsUrl } from "../../../fixtures/urlList";
|
||||
import { updateChannelWarehouses } from "../../../support/api/requests/Channels";
|
||||
import {
|
||||
createShippingZone,
|
||||
getShippingZone,
|
||||
|
@ -22,6 +23,7 @@ describe("As a user I should be able to update and delete shipping zone", () =>
|
|||
let defaultChannel;
|
||||
let shippingZone;
|
||||
let plAddress;
|
||||
let warehouse;
|
||||
|
||||
before(() => {
|
||||
cy.clearSessionData().loginUserViaRequest();
|
||||
|
@ -34,7 +36,11 @@ describe("As a user I should be able to update and delete shipping zone", () =>
|
|||
})
|
||||
.then(addresses => {
|
||||
plAddress = addresses.plAddress;
|
||||
createWarehouse({ name, address: plAddress });
|
||||
createWarehouse({ name, address: plAddress }).then(warehouseResp => {
|
||||
warehouse = warehouseResp;
|
||||
|
||||
updateChannelWarehouses(defaultChannel.id, warehouse.id);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -42,14 +48,16 @@ describe("As a user I should be able to update and delete shipping zone", () =>
|
|||
const rateName = `${startsWith}${faker.datatype.number()}`;
|
||||
|
||||
cy.clearSessionData().loginUserViaRequest();
|
||||
createShippingZone(name, "US", defaultChannel.id).then(shippingZoneResp => {
|
||||
shippingZone = shippingZoneResp;
|
||||
});
|
||||
createShippingZone(name, "US", defaultChannel.id, warehouse.id).then(
|
||||
shippingZoneResp => {
|
||||
shippingZone = shippingZoneResp;
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it(
|
||||
"should be able to update shipping zone. TC: SALEOR_0808",
|
||||
{ tags: ["@shipping", "@allEnv"] },
|
||||
{ tags: ["@shipping", "@allEnv", "@stable"] },
|
||||
() => {
|
||||
const updatedName = `${startsWith}Updated`;
|
||||
|
||||
|
@ -64,7 +72,7 @@ describe("As a user I should be able to update and delete shipping zone", () =>
|
|||
expect(shippingZone.channels).to.have.length(0);
|
||||
expect(shippingZone.name).to.eq(updatedName);
|
||||
expect(shippingZone.description).to.eq(updatedName);
|
||||
expect(shippingZone.warehouses[0].name).to.eq(name);
|
||||
expect(shippingZone.warehouses).to.have.length(0);
|
||||
expect(shippingZone.countries.find(el => el.code === "PL")).to.be.ok;
|
||||
});
|
||||
},
|
||||
|
@ -72,7 +80,7 @@ describe("As a user I should be able to update and delete shipping zone", () =>
|
|||
|
||||
it(
|
||||
"should be able to delete shipping zone. TC: SALEOR_0809",
|
||||
{ tags: ["@shipping", "@allEnv"] },
|
||||
{ tags: ["@shipping", "@allEnv", "@stable"] },
|
||||
() => {
|
||||
cy.visit(
|
||||
shippingZoneDetailsUrl(shippingZone.id),
|
||||
|
@ -83,24 +91,27 @@ describe("As a user I should be able to update and delete shipping zone", () =>
|
|||
|
||||
it(
|
||||
"should be able to delete several shipping zones on shipping zones list page. TC: SALEOR_0810",
|
||||
{ tags: ["@shipping", "@allEnv"] },
|
||||
{ tags: ["@shipping", "@allEnv", "@stable"] },
|
||||
() => {
|
||||
let secondShippingZone;
|
||||
|
||||
createShippingZone(`${startsWith}Second`, "US", defaultChannel.id).then(
|
||||
shippingZoneResp => {
|
||||
secondShippingZone = shippingZoneResp;
|
||||
enterAndSelectShippings([shippingZone.id, secondShippingZone.id]);
|
||||
cy.get(BUTTON_SELECTORS.deleteSelectedElementsButton)
|
||||
.click()
|
||||
.addAliasToGraphRequest("BulkDeleteShippingZone")
|
||||
.get(BUTTON_SELECTORS.submit)
|
||||
.click()
|
||||
.wait("@BulkDeleteShippingZone");
|
||||
getShippingZone(shippingZone.id).should("be.null");
|
||||
getShippingZone(secondShippingZone.id).should("be.null");
|
||||
},
|
||||
);
|
||||
createShippingZone(
|
||||
`${startsWith}Second`,
|
||||
"US",
|
||||
defaultChannel.id,
|
||||
warehouse.id,
|
||||
).then(shippingZoneResp => {
|
||||
secondShippingZone = shippingZoneResp;
|
||||
enterAndSelectShippings([shippingZone.id, secondShippingZone.id]);
|
||||
cy.get(BUTTON_SELECTORS.deleteSelectedElementsButton)
|
||||
.click()
|
||||
.addAliasToGraphRequest("BulkDeleteShippingZone")
|
||||
.get(BUTTON_SELECTORS.submit)
|
||||
.click()
|
||||
.wait("@BulkDeleteShippingZone");
|
||||
getShippingZone(shippingZone.id).should("be.null");
|
||||
getShippingZone(secondShippingZone.id).should("be.null");
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
|
|
|
@ -43,6 +43,7 @@ describe("As a user I want to create shipping method with postal codes", () => {
|
|||
getDefaultChannel()
|
||||
.then(channel => {
|
||||
defaultChannel = channel;
|
||||
|
||||
cy.fixture("addresses");
|
||||
})
|
||||
.then(
|
||||
|
@ -52,22 +53,24 @@ describe("As a user I want to create shipping method with postal codes", () => {
|
|||
}) => {
|
||||
usAddress = usAddressResp;
|
||||
secondUsAddress = secondUsAddressResp;
|
||||
createShippingZone(name, "US", defaultChannel.id);
|
||||
|
||||
createWarehouse({ name, address: usAddress }).then(warehouseResp => {
|
||||
warehouse = warehouseResp;
|
||||
|
||||
updateChannelWarehouses(defaultChannel.id, warehouse.id);
|
||||
createShippingZone(
|
||||
name,
|
||||
"US",
|
||||
defaultChannel.id,
|
||||
warehouse.id,
|
||||
).then(shippingZoneResp => {
|
||||
shippingZone = shippingZoneResp;
|
||||
|
||||
createTypeAttributeAndCategoryForProduct({ name });
|
||||
});
|
||||
});
|
||||
},
|
||||
)
|
||||
.then(shippingZoneResp => {
|
||||
shippingZone = shippingZoneResp;
|
||||
createWarehouse({
|
||||
name,
|
||||
shippingZone: shippingZone.id,
|
||||
address: usAddress,
|
||||
});
|
||||
})
|
||||
.then(warehouseResp => {
|
||||
warehouse = warehouseResp;
|
||||
updateChannelWarehouses(defaultChannel.id, warehouse.id);
|
||||
createTypeAttributeAndCategoryForProduct({ name });
|
||||
})
|
||||
.then(({ attribute, productType, category }) => {
|
||||
createProductInChannel({
|
||||
name,
|
||||
|
|
|
@ -42,25 +42,25 @@ describe("As a staff user I want to manage shipping weights", () => {
|
|||
getDefaultChannel()
|
||||
.then(channel => {
|
||||
defaultChannel = channel;
|
||||
|
||||
cy.fixture("addresses");
|
||||
})
|
||||
.then(({ usAddress: usAddressResp }) => {
|
||||
usAddress = usAddressResp;
|
||||
createShippingZone(name, "US", defaultChannel.id);
|
||||
})
|
||||
.then(shippingZoneResp => {
|
||||
shippingZone = shippingZoneResp;
|
||||
createWarehouse({
|
||||
name,
|
||||
shippingZone: shippingZone.id,
|
||||
address: usAddress,
|
||||
|
||||
createWarehouse({ name, address: usAddress }).then(warehouseResp => {
|
||||
warehouse = warehouseResp;
|
||||
|
||||
updateChannelWarehouses(defaultChannel.id, warehouse.id);
|
||||
createShippingZone(name, "US", defaultChannel.id, warehouse.id).then(
|
||||
shippingZoneResp => {
|
||||
shippingZone = shippingZoneResp;
|
||||
|
||||
createTypeAttributeAndCategoryForProduct({ name });
|
||||
},
|
||||
);
|
||||
});
|
||||
})
|
||||
.then(warehouseResp => {
|
||||
warehouse = warehouseResp;
|
||||
updateChannelWarehouses(defaultChannel.id, warehouse.id);
|
||||
createTypeAttributeAndCategoryForProduct({ name });
|
||||
})
|
||||
.then(({ attribute, productType, category }) => {
|
||||
createProductInChannel({
|
||||
name,
|
||||
|
|
|
@ -6,23 +6,26 @@ import faker from "faker";
|
|||
import { SHARED_ELEMENTS } from "../../../../elements/shared/sharedElements";
|
||||
import { SHIPPING_RATE_DETAILS } from "../../../../elements/shipping/shipping-rate-details";
|
||||
import { shippingRateUrl, urlList } from "../../../../fixtures/urlList";
|
||||
import { updateChannelWarehouses } from "../../../../support/api/requests/Channels";
|
||||
import {
|
||||
createShippingRate as createShippingRateViaApi,
|
||||
createShippingZone,
|
||||
} from "../../../../support/api/requests/ShippingMethod";
|
||||
import { updateShopWeightUnit } from "../../../../support/api/requests/ShopSettings";
|
||||
import { createWarehouse } from "../../../../support/api/requests/Warehouse";
|
||||
import { getDefaultChannel } from "../../../../support/api/utils/channelsUtils";
|
||||
import { deleteProductsStartsWith } from "../../../../support/api/utils/products/productsUtils";
|
||||
import { deleteShippingStartsWith } from "../../../../support/api/utils/shippingUtils";
|
||||
import { changeWeightUnit } from "../../../../support/pages/shippingMethodPage";
|
||||
|
||||
xdescribe("As a staff user I want to change shop default weight unit", () => {
|
||||
describe("As a staff user I want to change shop default weight unit", () => {
|
||||
const startsWith = "RecalculateWeight";
|
||||
const name = `${startsWith}${faker.datatype.number()}`;
|
||||
|
||||
let defaultChannel;
|
||||
let usAddress;
|
||||
let shippingZone;
|
||||
let warehouse;
|
||||
|
||||
before(() => {
|
||||
cy.clearSessionData().loginUserViaRequest();
|
||||
|
@ -38,14 +41,19 @@ xdescribe("As a staff user I want to change shop default weight unit", () => {
|
|||
})
|
||||
.then(({ usAddress: usAddressResp }) => {
|
||||
usAddress = usAddressResp;
|
||||
createShippingZone(name, "US", defaultChannel.id);
|
||||
|
||||
createWarehouse({ name, address: usAddress }).then(warehouseResp => {
|
||||
warehouse = warehouseResp;
|
||||
|
||||
updateChannelWarehouses(defaultChannel.id, warehouse.id);
|
||||
createShippingZone(name, "US", defaultChannel.id, warehouse.id);
|
||||
});
|
||||
})
|
||||
.then(shippingZoneResp => {
|
||||
shippingZone = shippingZoneResp;
|
||||
});
|
||||
});
|
||||
|
||||
// Log in as user with shipping permissions after resolving SALEOR-3407 bug
|
||||
it(
|
||||
"should recalculate weight after changing shipping weight unit. TC: SALEOR_0901",
|
||||
{ tags: ["@shipping", "@allEnv", "@stable"] },
|
||||
|
@ -79,9 +87,8 @@ xdescribe("As a staff user I want to change shop default weight unit", () => {
|
|||
.its("response.body");
|
||||
})
|
||||
.then(responseArray => {
|
||||
const shippingMethods = responseArray.find(
|
||||
element => element.data.shippingZone,
|
||||
).data.shippingZone.shippingMethods;
|
||||
const shippingMethods =
|
||||
responseArray.data.shippingZone.shippingMethods;
|
||||
const rate = shippingMethods.find(
|
||||
element => element.id === shippingMethod.id,
|
||||
);
|
||||
|
|
|
@ -12,7 +12,11 @@ import {
|
|||
urlList,
|
||||
warehouseDetailsUrl,
|
||||
} from "../../../fixtures/urlList";
|
||||
import { createShippingZone } from "../../../support/api/requests/ShippingMethod";
|
||||
import { updateChannelWarehouses } from "../../../support/api/requests/Channels";
|
||||
import {
|
||||
createShippingZone,
|
||||
createShippingZoneWithoutWarehouse,
|
||||
} from "../../../support/api/requests/ShippingMethod";
|
||||
import {
|
||||
createWarehouse as createWarehouseViaApi,
|
||||
getWarehouse,
|
||||
|
@ -20,7 +24,7 @@ import {
|
|||
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
||||
import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
|
||||
|
||||
describe("Warehouse settings", () => {
|
||||
describe("As an admin I want to manage warehouses", () => {
|
||||
const startsWith = "CyWarehouse";
|
||||
let usAddress;
|
||||
let secondUsAddress;
|
||||
|
@ -38,32 +42,36 @@ describe("Warehouse settings", () => {
|
|||
cy.clearSessionData().loginUserViaRequest();
|
||||
});
|
||||
|
||||
it("should create warehouse", { tags: ["@warehouse", "@allEnv"] }, () => {
|
||||
const name = `${startsWith}${faker.datatype.number()}`;
|
||||
cy.visit(urlList.warehouses)
|
||||
.get(WAREHOUSES_LIST.createNewButton)
|
||||
.click()
|
||||
.get(WAREHOUSES_DETAILS.nameInput)
|
||||
.type(name)
|
||||
.fillUpBasicAddress(usAddress)
|
||||
.addAliasToGraphRequest("WarehouseCreate")
|
||||
.get(BUTTON_SELECTORS.confirm)
|
||||
.click()
|
||||
.waitForRequestAndCheckIfNoErrors("@WarehouseCreate")
|
||||
.its("response.body.data.createWarehouse.warehouse")
|
||||
.then(warehouse => {
|
||||
getWarehouse(warehouse.id);
|
||||
})
|
||||
.then(warehouse => {
|
||||
const addressResp = warehouse.address;
|
||||
expect(warehouse.name).to.be.eq(name);
|
||||
cy.expectCorrectBasicAddress(addressResp, usAddress);
|
||||
});
|
||||
});
|
||||
it(
|
||||
"should be able to create warehouse. TC: SALEOR_1101",
|
||||
{ tags: ["@warehouse", "@allEnv", "@stable"] },
|
||||
() => {
|
||||
const name = `${startsWith}${faker.datatype.number()}`;
|
||||
cy.visit(urlList.warehouses)
|
||||
.get(WAREHOUSES_LIST.createNewButton)
|
||||
.click()
|
||||
.get(WAREHOUSES_DETAILS.nameInput)
|
||||
.type(name)
|
||||
.fillUpBasicAddress(usAddress)
|
||||
.addAliasToGraphRequest("WarehouseCreate")
|
||||
.get(BUTTON_SELECTORS.confirm)
|
||||
.click()
|
||||
.waitForRequestAndCheckIfNoErrors("@WarehouseCreate")
|
||||
.its("response.body.data.createWarehouse.warehouse")
|
||||
.then(warehouse => {
|
||||
getWarehouse(warehouse.id);
|
||||
})
|
||||
.then(warehouse => {
|
||||
const addressResp = warehouse.address;
|
||||
expect(warehouse.name).to.be.eq(name);
|
||||
cy.expectCorrectBasicAddress(addressResp, usAddress);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
it(
|
||||
"should add warehouse to shipping zone",
|
||||
{ tags: ["@warehouse", "@allEnv"] },
|
||||
"should be able to add warehouse to shipping zone. TC: SALEOR_1102",
|
||||
{ tags: ["@warehouse", "@allEnv", "@stable"] },
|
||||
() => {
|
||||
const name = `${startsWith}${faker.datatype.number()}`;
|
||||
let defaultChannel;
|
||||
|
@ -73,6 +81,7 @@ describe("Warehouse settings", () => {
|
|||
getDefaultChannel()
|
||||
.then(channelResp => {
|
||||
defaultChannel = channelResp;
|
||||
|
||||
createWarehouseViaApi({
|
||||
name,
|
||||
address: usAddress,
|
||||
|
@ -80,10 +89,13 @@ describe("Warehouse settings", () => {
|
|||
})
|
||||
.then(warehouseResp => {
|
||||
warehouse = warehouseResp;
|
||||
createShippingZone(name, "US", defaultChannel.id);
|
||||
|
||||
updateChannelWarehouses(defaultChannel.id, warehouse.id);
|
||||
createShippingZoneWithoutWarehouse(name, "US", defaultChannel.id);
|
||||
})
|
||||
.then(shippingZoneResp => {
|
||||
shippingZone = shippingZoneResp;
|
||||
|
||||
cy.visit(shippingZoneDetailsUrl(shippingZone.id))
|
||||
.fillAutocompleteSelect(
|
||||
SHIPPING_ZONE_DETAILS.warehouseSelector,
|
||||
|
@ -103,26 +115,30 @@ describe("Warehouse settings", () => {
|
|||
},
|
||||
);
|
||||
|
||||
it("should delete warehouse", { tags: ["@warehouse", "@allEnv"] }, () => {
|
||||
const name = `${startsWith}${faker.datatype.number()}`;
|
||||
createWarehouseViaApi({
|
||||
name,
|
||||
address: usAddress,
|
||||
}).then(warehouse => {
|
||||
cy.visit(warehouseDetailsUrl(warehouse.id))
|
||||
.get(BUTTON_SELECTORS.deleteButton)
|
||||
.click()
|
||||
.addAliasToGraphRequest("WarehouseDelete")
|
||||
.get(BUTTON_SELECTORS.submit)
|
||||
.click()
|
||||
.waitForRequestAndCheckIfNoErrors("@WarehouseDelete");
|
||||
getWarehouse(warehouse.id).should("be.null");
|
||||
});
|
||||
});
|
||||
it(
|
||||
"should be able to delete warehouse. TC: SALEOR_1103",
|
||||
{ tags: ["@warehouse", "@allEnv", "@stable"] },
|
||||
() => {
|
||||
const name = `${startsWith}${faker.datatype.number()}`;
|
||||
createWarehouseViaApi({
|
||||
name,
|
||||
address: usAddress,
|
||||
}).then(warehouse => {
|
||||
cy.visit(warehouseDetailsUrl(warehouse.id))
|
||||
.get(BUTTON_SELECTORS.deleteButton)
|
||||
.click()
|
||||
.addAliasToGraphRequest("WarehouseDelete")
|
||||
.get(BUTTON_SELECTORS.submit)
|
||||
.click()
|
||||
.waitForRequestAndCheckIfNoErrors("@WarehouseDelete");
|
||||
getWarehouse(warehouse.id).should("be.null");
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
it(
|
||||
"should remove warehouse from shipping zone",
|
||||
{ tags: ["@warehouse", "@allEnv"] },
|
||||
"should be able to remove warehouse from shipping zone. TC: SALEOR_1104",
|
||||
{ tags: ["@warehouse", "@allEnv", "@stable"] },
|
||||
() => {
|
||||
const name = `${startsWith}${faker.datatype.number()}`;
|
||||
let defaultChannel;
|
||||
|
@ -132,18 +148,20 @@ describe("Warehouse settings", () => {
|
|||
getDefaultChannel()
|
||||
.then(channelResp => {
|
||||
defaultChannel = channelResp;
|
||||
createShippingZone(name, "US", defaultChannel.id);
|
||||
|
||||
createWarehouseViaApi({
|
||||
name,
|
||||
address: usAddress,
|
||||
}).then(warehouseResp => {
|
||||
warehouse = warehouseResp;
|
||||
|
||||
updateChannelWarehouses(defaultChannel.id, warehouse.id);
|
||||
createShippingZone(name, "US", defaultChannel.id, warehouse.id);
|
||||
});
|
||||
})
|
||||
.then(shippingZoneResp => {
|
||||
shippingZone = shippingZoneResp;
|
||||
createWarehouseViaApi({
|
||||
name,
|
||||
shippingZone: shippingZone.id,
|
||||
address: usAddress,
|
||||
});
|
||||
})
|
||||
.then(warehouseResp => {
|
||||
warehouse = warehouseResp;
|
||||
|
||||
cy.visit(shippingZoneDetailsUrl(shippingZone.id))
|
||||
.get(SHIPPING_ZONE_DETAILS.removeWarehouseButton)
|
||||
.click()
|
||||
|
@ -151,39 +169,42 @@ describe("Warehouse settings", () => {
|
|||
.get(BUTTON_SELECTORS.confirm)
|
||||
.click()
|
||||
.waitForRequestAndCheckIfNoErrors("@UpdateShippingZone");
|
||||
getWarehouse(warehouse.id);
|
||||
})
|
||||
.then(warehouseResp => {
|
||||
expect(warehouseResp.shippingZones.edges).to.be.empty;
|
||||
getWarehouse(warehouse.id).then(warehouseResp => {
|
||||
expect(warehouseResp.shippingZones.edges).to.be.empty;
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
it("should update warehouse", { tags: ["@warehouse", "@allEnv"] }, () => {
|
||||
const name = `${startsWith}${faker.datatype.number()}`;
|
||||
const updatedName = `${startsWith}${faker.datatype.number()}`;
|
||||
let warehouse;
|
||||
it(
|
||||
"should be able to update warehouse. TC: SALEOR_1105",
|
||||
{ tags: ["@warehouse", "@allEnv", "@stable"] },
|
||||
() => {
|
||||
const name = `${startsWith}${faker.datatype.number()}`;
|
||||
const updatedName = `${startsWith}${faker.datatype.number()}`;
|
||||
let warehouse;
|
||||
|
||||
createWarehouseViaApi({
|
||||
name,
|
||||
address: usAddress,
|
||||
})
|
||||
.then(warehouseResp => {
|
||||
warehouse = warehouseResp;
|
||||
cy.visit(warehouseDetailsUrl(warehouse.id))
|
||||
.get(WAREHOUSES_DETAILS.nameInput)
|
||||
.clearAndType(updatedName)
|
||||
.fillUpBasicAddress(secondUsAddress)
|
||||
.addAliasToGraphRequest("WarehouseUpdate")
|
||||
.get(BUTTON_SELECTORS.confirm)
|
||||
.click()
|
||||
.waitForRequestAndCheckIfNoErrors("@WarehouseUpdate");
|
||||
getWarehouse(warehouse.id);
|
||||
createWarehouseViaApi({
|
||||
name,
|
||||
address: usAddress,
|
||||
})
|
||||
.then(warehouseResp => {
|
||||
const addressResp = warehouseResp.address;
|
||||
expect(warehouseResp.name).to.be.eq(updatedName);
|
||||
cy.expectCorrectBasicAddress(addressResp, secondUsAddress);
|
||||
});
|
||||
});
|
||||
.then(warehouseResp => {
|
||||
warehouse = warehouseResp;
|
||||
cy.visit(warehouseDetailsUrl(warehouse.id))
|
||||
.get(WAREHOUSES_DETAILS.nameInput)
|
||||
.clearAndType(updatedName)
|
||||
.fillUpBasicAddress(secondUsAddress)
|
||||
.addAliasToGraphRequest("WarehouseUpdate")
|
||||
.get(BUTTON_SELECTORS.confirm)
|
||||
.click()
|
||||
.waitForRequestAndCheckIfNoErrors("@WarehouseUpdate");
|
||||
getWarehouse(warehouse.id);
|
||||
})
|
||||
.then(warehouseResp => {
|
||||
const addressResp = warehouseResp.address;
|
||||
expect(warehouseResp.name).to.be.eq(updatedName);
|
||||
cy.expectCorrectBasicAddress(addressResp, secondUsAddress);
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
|
|
|
@ -5,15 +5,15 @@ export function createShippingRate({
|
|||
shippingZone,
|
||||
type = "PRICE",
|
||||
maxWeight,
|
||||
minWeight
|
||||
minWeight,
|
||||
}) {
|
||||
const maxOrderWeight = getValueWithDefault(
|
||||
maxWeight,
|
||||
`maximumOrderWeight: ${maxWeight}`
|
||||
`maximumOrderWeight: ${maxWeight}`,
|
||||
);
|
||||
const minOrderWeight = getValueWithDefault(
|
||||
minWeight,
|
||||
`minimumOrderWeight: ${minWeight}`
|
||||
`minimumOrderWeight: ${minWeight}`,
|
||||
);
|
||||
|
||||
const mutation = `mutation{
|
||||
|
@ -37,10 +37,37 @@ export function createShippingRate({
|
|||
return cy.sendRequestWithQuery(mutation).its("body.data.shippingPriceCreate");
|
||||
}
|
||||
|
||||
export function createShippingZone(name, country, channelId) {
|
||||
export function createShippingZone(name, country, channelId, warehouseId) {
|
||||
const channelsLines = getValueWithDefault(
|
||||
channelId,
|
||||
`addChannels:["${channelId}"]`
|
||||
`addChannels:["${channelId}"]`,
|
||||
);
|
||||
const mutation = `mutation{
|
||||
shippingZoneCreate(input:{
|
||||
name: "${name}"
|
||||
countries: "${country}"
|
||||
${channelsLines}
|
||||
addWarehouses: ["${warehouseId}"]
|
||||
}){
|
||||
shippingZone{
|
||||
id
|
||||
name
|
||||
}
|
||||
errors{
|
||||
field
|
||||
message
|
||||
}
|
||||
}
|
||||
}`;
|
||||
return cy
|
||||
.sendRequestWithQuery(mutation)
|
||||
.its("body.data.shippingZoneCreate.shippingZone");
|
||||
}
|
||||
|
||||
export function createShippingZoneWithoutWarehouse(name, country, channelId) {
|
||||
const channelsLines = getValueWithDefault(
|
||||
channelId,
|
||||
`addChannels:["${channelId}"]`,
|
||||
);
|
||||
const mutation = `mutation{
|
||||
shippingZoneCreate(input:{
|
||||
|
@ -81,7 +108,7 @@ export function addChannelToShippingMethod(
|
|||
shippingRateId,
|
||||
channelId,
|
||||
price,
|
||||
minProductPrice = 0
|
||||
minProductPrice = 0,
|
||||
) {
|
||||
const mutation = `mutation{
|
||||
shippingMethodChannelListingUpdate(id:"${shippingRateId}", input:{
|
||||
|
|
|
@ -14,23 +14,25 @@ export function createShipping({
|
|||
let shippingZone;
|
||||
let warehouse;
|
||||
|
||||
return shippingMethodRequest
|
||||
.createShippingZone(name, address.country, channelId)
|
||||
.then(shippingZoneResp => {
|
||||
shippingZone = shippingZoneResp;
|
||||
warehouseRequest.createWarehouse({
|
||||
name,
|
||||
shippingZone: shippingZone.id,
|
||||
address,
|
||||
});
|
||||
return warehouseRequest
|
||||
.createWarehouse({
|
||||
name,
|
||||
address,
|
||||
})
|
||||
.then(warehouseResp => {
|
||||
warehouse = warehouseResp;
|
||||
|
||||
updateChannelWarehouses(channelId, warehouse.id);
|
||||
shippingMethodRequest.createShippingRate({
|
||||
name,
|
||||
shippingZone: shippingZone.id,
|
||||
});
|
||||
shippingMethodRequest
|
||||
.createShippingZone(name, address.country, channelId, warehouse.id)
|
||||
.then(shippingZoneResp => {
|
||||
shippingZone = shippingZoneResp;
|
||||
|
||||
shippingMethodRequest.createShippingRate({
|
||||
name,
|
||||
shippingZone: shippingZone.id,
|
||||
});
|
||||
});
|
||||
})
|
||||
.then(({ shippingMethod: sippingMethodResp }) => {
|
||||
shippingMethod = sippingMethodResp;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
|
||||
import {
|
||||
selectorWithDataValue,
|
||||
SHARED_ELEMENTS
|
||||
SHARED_ELEMENTS,
|
||||
} from "../../../elements/shared/sharedElements";
|
||||
|
||||
Cypress.Commands.add("createNewOption", (selectSelector, newOption) => {
|
||||
|
@ -26,6 +26,7 @@ Cypress.Commands.add("fillMultiSelect", (selectSelector, option) => {
|
|||
|
||||
Cypress.Commands.add("fillBaseSelect", (selectSelector, value) => {
|
||||
cy.get(selectSelector)
|
||||
.should("not.have.attr", "aria-disabled", "true")
|
||||
.click()
|
||||
.get(selectorWithDataValue(value))
|
||||
.click();
|
||||
|
|
|
@ -9,14 +9,14 @@ export function createShippingZone(
|
|||
shippingName,
|
||||
warehouseName,
|
||||
country,
|
||||
channelName
|
||||
channelName,
|
||||
) {
|
||||
cy.get(SHIPPING_ZONES_LIST.addShippingZone).click();
|
||||
fillUpShippingZoneData({
|
||||
shippingName,
|
||||
warehouseName,
|
||||
country,
|
||||
channelName
|
||||
channelName,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ export function fillUpShippingZoneData({
|
|||
shippingName,
|
||||
warehouseName,
|
||||
country,
|
||||
channelName
|
||||
channelName,
|
||||
}) {
|
||||
cy.get(SHIPPING_ZONE_DETAILS.nameInput)
|
||||
.clearAndType(shippingName)
|
||||
|
@ -79,7 +79,7 @@ export function createShippingRate({
|
|||
rateOption,
|
||||
weightLimits,
|
||||
deliveryTime,
|
||||
priceLimits
|
||||
priceLimits,
|
||||
}) {
|
||||
enterAndFillUpShippingRate({
|
||||
rateName,
|
||||
|
@ -87,7 +87,7 @@ export function createShippingRate({
|
|||
rateOption,
|
||||
weightLimits,
|
||||
deliveryTime,
|
||||
priceLimits
|
||||
priceLimits,
|
||||
});
|
||||
return saveRate();
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ export function enterAndFillUpShippingRate({
|
|||
rateOption,
|
||||
weightLimits,
|
||||
priceLimits,
|
||||
deliveryTime
|
||||
deliveryTime,
|
||||
}) {
|
||||
cy.get(rateOption).click();
|
||||
fillUpShippingRate({
|
||||
|
@ -106,7 +106,7 @@ export function enterAndFillUpShippingRate({
|
|||
price,
|
||||
weightLimits,
|
||||
priceLimits,
|
||||
deliveryTime
|
||||
deliveryTime,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ export function fillUpShippingRate({
|
|||
price,
|
||||
weightLimits,
|
||||
priceLimits,
|
||||
deliveryTime
|
||||
deliveryTime,
|
||||
}) {
|
||||
cy.waitForProgressBarToNotBeVisible()
|
||||
.get(SHARED_ELEMENTS.richTextEditor.empty)
|
||||
|
@ -142,7 +142,7 @@ export function createRateWithPostalCode({
|
|||
rateOption = rateOptions.PRICE_OPTION,
|
||||
minPostalCode,
|
||||
maxPostalCode,
|
||||
postalCodeOption
|
||||
postalCodeOption,
|
||||
}) {
|
||||
enterAndFillUpShippingRate({ rateName, price, rateOption });
|
||||
cy.get(postalCodeOption)
|
||||
|
@ -195,10 +195,10 @@ export function fillUpDeliveryTime({ min, max }) {
|
|||
|
||||
export const rateOptions = {
|
||||
PRICE_OPTION: SHIPPING_ZONE_DETAILS.addPriceRateButton,
|
||||
WEIGHT_OPTION: SHIPPING_ZONE_DETAILS.addWeightRateButton
|
||||
WEIGHT_OPTION: SHIPPING_ZONE_DETAILS.addWeightRateButton,
|
||||
};
|
||||
|
||||
export const postalCodesOptions = {
|
||||
INCLUDE_OPTION: SHIPPING_RATE_DETAILS.includePostalCodesCheckbox,
|
||||
EXCLUDE_OPTION: SHIPPING_RATE_DETAILS.excludePostalCodesCheckbox
|
||||
EXCLUDE_OPTION: SHIPPING_RATE_DETAILS.excludePostalCodesCheckbox,
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue