
* run critical tests after test env deployment * add cache * add all branches * change workflow name * add run on pull request for testing * change type * add run on deployment * run on copleted * test critical * add quote * change baseUrl * fix base url * fix base url * upload reports * run in parallel * save build folder * remove build from gitignore * remove build * update nide version * last try with parallel * save build * save build * Run critical * change cypress API url * run critical in parallel * check which workflow has lower duration time * save all reports with container in name * add reports on failure * remove reporters * fix jobs * merge * add group name * run critical * Refactor critical tests (#1906) * refactored tag added to purchaseWithProductsTypes, navigation, stocksInCheckout * homePageAnalitics - refactor * refactor home page * refactor creating variants * refactor adding product without sku to order * add script to run critical locally * change tests cases names * fix names, remove comments, add script to run refactored tests * remove workflow for parallel * remove key
84 lines
2.1 KiB
JavaScript
84 lines
2.1 KiB
JavaScript
import * as shippingMethodRequest from "../requests/ShippingMethod";
|
|
import * as warehouseRequest from "../requests/Warehouse";
|
|
import { getDefaultChannel } from "./channelsUtils";
|
|
|
|
export function createShipping({
|
|
channelId,
|
|
name,
|
|
address,
|
|
price = 1,
|
|
minProductPrice = 0
|
|
}) {
|
|
let shippingMethod;
|
|
let shippingZone;
|
|
let warehouse;
|
|
|
|
return shippingMethodRequest
|
|
.createShippingZone(name, address.country, channelId)
|
|
.then(shippingZoneResp => {
|
|
shippingZone = shippingZoneResp;
|
|
warehouseRequest.createWarehouse({
|
|
name,
|
|
shippingZone: shippingZone.id,
|
|
address
|
|
});
|
|
})
|
|
.then(warehouseResp => {
|
|
warehouse = warehouseResp;
|
|
shippingMethodRequest.createShippingRate({
|
|
name,
|
|
shippingZone: shippingZone.id
|
|
});
|
|
})
|
|
.then(({ shippingMethod: sippingMethodResp }) => {
|
|
shippingMethod = sippingMethodResp;
|
|
shippingMethodRequest.addChannelToShippingMethod(
|
|
shippingMethod.id,
|
|
channelId,
|
|
price,
|
|
minProductPrice
|
|
);
|
|
})
|
|
.then(() => ({ shippingMethod, shippingZone, warehouse }));
|
|
}
|
|
|
|
export function createShippingWithDefaultChannelAndAddress(name) {
|
|
let defaultChannel;
|
|
|
|
return getDefaultChannel()
|
|
.then(channel => {
|
|
defaultChannel = channel;
|
|
cy.fixture("addresses");
|
|
})
|
|
.then(fixtureAddresses =>
|
|
createShipping({
|
|
channelId: defaultChannel.id,
|
|
name,
|
|
address: fixtureAddresses.plAddress
|
|
})
|
|
)
|
|
.then(({ shippingMethod, shippingZone, warehouse }) => ({
|
|
shippingMethod,
|
|
shippingZone,
|
|
warehouse,
|
|
defaultChannel
|
|
}));
|
|
}
|
|
|
|
export function createShippingRate({ name, shippingZoneId }) {
|
|
return shippingMethodRequest
|
|
.createShippingRate({ name, shippingZone: shippingZoneId })
|
|
.its("body.data.shippingPriceCreate.shippingMethod");
|
|
}
|
|
|
|
export function deleteShippingStartsWith(startsWith) {
|
|
cy.deleteElementsStartsWith(
|
|
shippingMethodRequest.deleteShippingZone,
|
|
shippingMethodRequest.getShippingZones,
|
|
startsWith
|
|
).deleteElementsStartsWith(
|
|
warehouseRequest.deleteWarehouse,
|
|
warehouseRequest.getWarehouses,
|
|
startsWith
|
|
);
|
|
}
|