diff --git a/cypress/apiRequests/Checkout.js b/cypress/apiRequests/Checkout.js
index 1e1ec147d..96bc4f7f4 100644
--- a/cypress/apiRequests/Checkout.js
+++ b/cypress/apiRequests/Checkout.js
@@ -1,18 +1,24 @@
-export function createCheckout(
+import { getDefaultAddress } from "./utils/Utils";
+export function createCheckout({
channelSlug,
email,
- productQuantity,
- variantsList
-) {
+ productQuantity = 1,
+ variantsList,
+ address,
+ auth = "auth"
+}) {
const lines = variantsList.map(
variant => `{quantity:${productQuantity}
variantId:"${variant.id}"}`
);
+ const shippingAddress = getDefaultAddress(address, "shippingAddress");
+
const mutation = `mutation{
checkoutCreate(input:{
channel:"${channelSlug}"
email:"${email}"
lines: [${lines.join()}]
+ ${shippingAddress}
}){
checkoutErrors{
field
@@ -24,7 +30,7 @@ export function createCheckout(
}
}
}`;
- return cy.sendRequestWithQuery(mutation);
+ return cy.sendRequestWithQuery(mutation, auth);
}
export function addShippingMethod(checkoutId, shippingMethodId) {
const mutation = `mutation{
@@ -69,3 +75,24 @@ export function completeCheckout(checkoutId) {
}`;
return cy.sendRequestWithQuery(mutation);
}
+
+export function addVoucher(checkoutId, voucherCode) {
+ const mutation = `mutation addVoucher{
+ checkoutAddPromoCode(checkoutId:"${checkoutId}",
+ promoCode:"${voucherCode}"
+ ){
+ checkoutErrors{
+ field
+ message
+ }
+ checkout{
+ totalPrice{
+ gross{
+ amount
+ }
+ }
+ }
+ }
+ }`;
+ return cy.sendRequestWithQuery(mutation);
+}
diff --git a/cypress/apiRequests/Customer.js b/cypress/apiRequests/Customer.js
index 11ffc4c36..9fb0c3207 100644
--- a/cypress/apiRequests/Customer.js
+++ b/cypress/apiRequests/Customer.js
@@ -1,3 +1,4 @@
+import { getDefaultAddress } from "./utils/Utils";
export function createCustomer(email, customerName, address, isActive = false) {
const mutation = `
mutation{
@@ -6,24 +7,8 @@ export function createCustomer(email, customerName, address, isActive = false) {
lastName: "${customerName}"
email: "${email}"
isActive: ${isActive}
- defaultBillingAddress: {
- companyName: "${address.companyName}"
- streetAddress1: "${address.streetAddress1}"
- streetAddress2: "${address.streetAddress2}"
- city: "${address.city}"
- postalCode: "${address.postalCode}"
- country: ${address.country}
- phone: "${address.phone}"
- }
- defaultShippingAddress: {
- companyName: "${address.companyName}"
- streetAddress1: "${address.streetAddress1}"
- streetAddress2: "${address.streetAddress2}"
- city: "${address.city}"
- postalCode: "${address.postalCode}"
- country: ${address.country}
- phone: "${address.phone}"
- }
+ ${getDefaultAddress(address, "defaultBillingAddress")}
+ ${getDefaultAddress(address, "defaultShippingAddress")}
}){
user{
id
diff --git a/cypress/apiRequests/Sales.js b/cypress/apiRequests/Discounts/Sales.js
similarity index 92%
rename from cypress/apiRequests/Sales.js
rename to cypress/apiRequests/Discounts/Sales.js
index e409fb18f..e5b7913c2 100644
--- a/cypress/apiRequests/Sales.js
+++ b/cypress/apiRequests/Discounts/Sales.js
@@ -1,4 +1,4 @@
-import { getValueWithDefault } from "./utils/Utils";
+import { getValueWithDefault } from "../utils/Utils";
export function getSales(first, searchQuery) {
const filter = getValueWithDefault(
diff --git a/cypress/apiRequests/Discounts/Vouchers.js b/cypress/apiRequests/Discounts/Vouchers.js
new file mode 100644
index 000000000..e9e99e800
--- /dev/null
+++ b/cypress/apiRequests/Discounts/Vouchers.js
@@ -0,0 +1,28 @@
+export function getVouchers(first, startsWith) {
+ const query = `query getVouchers{
+ vouchers(first:${first}, filter:{
+ search:"${startsWith}"
+ }){
+ edges{
+ node{
+ id
+ code
+ }
+ }
+ }
+ }`;
+ return cy
+ .sendRequestWithQuery(query)
+ .then(resp => resp.body.data.vouchers.edges);
+}
+export function deleteVouchers(voucherId) {
+ const mutation = `mutation deleteVouchers{
+ voucherDelete(id:"${voucherId}"){
+ discountErrors{
+ field
+ message
+ }
+ }
+ }`;
+ return cy.sendRequestWithQuery(mutation);
+}
diff --git a/cypress/apiRequests/Warehouse.js b/cypress/apiRequests/Warehouse.js
index 2b7457ea8..4c31e3ac6 100644
--- a/cypress/apiRequests/Warehouse.js
+++ b/cypress/apiRequests/Warehouse.js
@@ -1,17 +1,12 @@
+import { getDefaultAddress } from "./utils/Utils";
+
export function createWarehouse(name, shippingZone, address, slug = name) {
const mutation = `mutation{
createWarehouse(input:{
name:"${name}"
slug:"${slug}"
shippingZones:"${shippingZone}"
- address:{
- streetAddress1: "${address.streetAddress1}"
- streetAddress2: "${address.streetAddress2}"
- city: "${address.city}"
- postalCode: "${address.postalCode}"
- country: ${address.country}
- phone: "${address.phone}"
- }
+ ${getDefaultAddress(address, "address", false)}
}){
warehouseErrors{
field
diff --git a/cypress/apiRequests/utils/Utils.js b/cypress/apiRequests/utils/Utils.js
index 33373f8d1..c848f889c 100644
--- a/cypress/apiRequests/utils/Utils.js
+++ b/cypress/apiRequests/utils/Utils.js
@@ -1,2 +1,21 @@
export const getValueWithDefault = (condition, value, defaultValue = "") =>
condition ? value : defaultValue;
+
+export function getDefaultAddress(address, addressType, withName = true) {
+ if (!address) {
+ return "";
+ }
+ const defaultAddress = `city: "${address.city}"
+ country: ${address.country}
+ countryArea: "${address.countryArea}"
+ phone: "${address.phone}"
+ postalCode: "${address.postalCode}"
+ streetAddress1: "${address.streetAddress1}"
+ streetAddress2: "${address.streetAddress2}"`;
+ if (withName) {
+ defaultAddress.concat(`firstName: "Test"
+ lastName: "Test"
+ companyName: "${address.companyName}"`);
+ }
+ return `${addressType}:{${defaultAddress}}`;
+}
diff --git a/cypress/elements/channels/menage-channel-availability.js b/cypress/elements/channels/menage-channel-availability.js
index d0dd7d04c..f74bd8ef4 100644
--- a/cypress/elements/channels/menage-channel-availability.js
+++ b/cypress/elements/channels/menage-channel-availability.js
@@ -12,5 +12,6 @@ export const MENAGE_CHANNEL_AVAILABILITY = {
radioButtonsValueTrue: "[value='true']",
radioButtonsValueFalse: "[value='false']",
visibleInListingsButton: "[name*='visibleInListings']",
- allChannelsInput: "[name='allChannels']"
+ allChannelsInput: "[name='allChannels']",
+ dialog: "[role='dialog']"
};
diff --git a/cypress/elements/discounts/vouchers.js b/cypress/elements/discounts/vouchers.js
new file mode 100644
index 000000000..c14dff4ea
--- /dev/null
+++ b/cypress/elements/discounts/vouchers.js
@@ -0,0 +1,9 @@
+export const VOUCHERS_SELECTORS = {
+ createVoucherButton: "[data-test-id='create-voucher']",
+ voucherCodeInput: "[name='code']",
+ discountRadioButtons: "[name='discountType']",
+ percentageDiscountRadioButton: "[name='discountType'][value='PERCENTAGE']",
+ fixedDiscountRadioButton: "[name='discountType'][value='FIXED']",
+ shippingDiscountRadioButton: "[name='discountType'][value='SHIPPING']",
+ discountValueInputs: "[name='value']"
+};
diff --git a/cypress/elements/shared/button-selectors.js b/cypress/elements/shared/button-selectors.js
index 66f60a439..a71e4c0ee 100644
--- a/cypress/elements/shared/button-selectors.js
+++ b/cypress/elements/shared/button-selectors.js
@@ -1,5 +1,6 @@
export const BUTTON_SELECTORS = {
back: '[data-test="back"]',
submit: '[data-test="submit"]',
+ confirm: '[data-test="button-bar-confirm"]',
checkbox: "[type='checkbox']"
};
diff --git a/cypress/integration/discounts/sales.js b/cypress/integration/discounts/sales.js
index ab0c3f2a9..f516600ec 100644
--- a/cypress/integration/discounts/sales.js
+++ b/cypress/integration/discounts/sales.js
@@ -7,11 +7,11 @@ import {
assignProducts,
createSale,
discountOptions
-} from "../../steps/salesSteps";
+} from "../../steps/discounts/salesSteps";
import { urlList } from "../../url/urlList";
import * as channelsUtils from "../../utils/channelsUtils";
+import { deleteSalesStartsWith } from "../../utils/discounts/salesUtils";
import * as productsUtils from "../../utils/productsUtils";
-import { deleteSalesStartsWith } from "../../utils/salesUtils";
import {
createShipping,
deleteShippingStartsWith
diff --git a/cypress/integration/discounts/vouchers.js b/cypress/integration/discounts/vouchers.js
new file mode 100644
index 000000000..46000e1ca
--- /dev/null
+++ b/cypress/integration/discounts/vouchers.js
@@ -0,0 +1,172 @@
+//
+import faker from "faker";
+
+import {
+ createVoucher,
+ discountOptions
+} from "../../steps/discounts/vouchersSteps";
+import { urlList } from "../../url/urlList";
+import * as channelsUtils from "../../utils/channelsUtils";
+import { deleteVouchersStartsWith } from "../../utils/discounts/vouchersUtils";
+import { createCheckoutWithVoucher } from "../../utils/ordersUtils";
+import * as productsUtils from "../../utils/productsUtils";
+import {
+ createShipping,
+ deleteShippingStartsWith
+} from "../../utils/shippingUtils";
+
+describe("Vouchers discounts", () => {
+ const startsWith = "Cy-";
+ const productPrice = 100;
+ const shippingPrice = 100;
+
+ let defaultChannel;
+ let productType;
+ let attribute;
+ let category;
+ let shippingMethod;
+ let variants;
+ let address;
+
+ before(() => {
+ cy.clearSessionData().loginUserViaRequest();
+ channelsUtils.deleteChannelsStartsWith(startsWith);
+ productsUtils.deleteProductsStartsWith(startsWith);
+ deleteShippingStartsWith(startsWith);
+ deleteVouchersStartsWith(startsWith);
+
+ const name = `${startsWith}${faker.random.number()}`;
+
+ productsUtils
+ .createTypeAttributeAndCategoryForProduct(name)
+ .then(
+ ({
+ productType: productTypeResp,
+ attribute: attributeResp,
+ category: categoryResp
+ }) => {
+ productType = productTypeResp;
+ attribute = attributeResp;
+ category = categoryResp;
+
+ channelsUtils.getDefaultChannel();
+ }
+ )
+ .then(channel => {
+ defaultChannel = channel;
+ cy.fixture("addresses");
+ })
+ .then(addresses => {
+ address = addresses.plAddress;
+ createShipping({
+ channelId: defaultChannel.id,
+ name,
+ address,
+ price: shippingPrice
+ });
+ })
+ .then(({ shippingMethod: shippingMethodResp, warehouse: warehouse }) => {
+ shippingMethod = shippingMethodResp;
+ productsUtils.createProductInChannel({
+ name,
+ channelId: defaultChannel.id,
+ warehouseId: warehouse.id,
+ productTypeId: productType.id,
+ attributeId: attribute.id,
+ categoryId: category.id,
+ price: productPrice
+ });
+ })
+ .then(({ variants: variantsResp }) => (variants = variantsResp));
+ });
+
+ beforeEach(() => {
+ cy.clearSessionData().loginUserViaRequest();
+ cy.visit(urlList.vouchers);
+ });
+
+ it("should create percentage voucher", () => {
+ const voucherCode = `${startsWith}${faker.random.number()}`;
+ const voucherValue = 50;
+
+ createVoucher({
+ voucherCode,
+ voucherValue,
+ discountOption: discountOptions.PERCENTAGE,
+ channelName: defaultChannel.name
+ });
+ createCheckoutForCreatedVoucher(voucherCode)
+ .its("checkout.totalPrice.gross.amount")
+ .then(amount => {
+ const expectedAmount =
+ (productPrice * voucherValue) / 100 + shippingPrice;
+ expect(amount).to.be.eq(expectedAmount);
+ });
+ });
+ it("should create fixed price voucher", () => {
+ const voucherCode = `${startsWith}${faker.random.number()}`;
+ const voucherValue = 50;
+
+ createVoucher({
+ voucherCode,
+ voucherValue,
+ discountOption: discountOptions.FIXED,
+ channelName: defaultChannel.name
+ });
+ createCheckoutForCreatedVoucher(voucherCode)
+ .its("checkout.totalPrice.gross.amount")
+ .then(amount => {
+ const expectedAmount = productPrice + shippingPrice - voucherValue;
+ expect(amount).to.be.eq(expectedAmount);
+ });
+ });
+
+ // Test should pass after fixing - SALEOR-1629 bug
+ xit("should create free shipping voucher", () => {
+ const voucherCode = `${startsWith}${faker.random.number()}`;
+
+ createVoucher({
+ voucherCode,
+ discountOption: discountOptions.SHIPPING,
+ channelName: defaultChannel.name
+ });
+ createCheckoutForCreatedVoucher(voucherCode)
+ .its("checkout.totalPrice.gross.amount")
+ .then(amount => {
+ const expectedAmount = productPrice;
+ expect(amount).to.be.eq(expectedAmount);
+ });
+ });
+
+ it("should create voucher not available for selected channel", () => {
+ const randomName = `${startsWith}${faker.random.number()}`;
+ const voucherValue = 50;
+
+ channelsUtils
+ .createChannel({ name: randomName })
+ .then(channel => {
+ createVoucher({
+ voucherCode: randomName,
+ voucherValue,
+ discountOption: discountOptions.PERCENTAGE,
+ channelName: channel.name
+ });
+ createCheckoutForCreatedVoucher(randomName);
+ })
+ .then(resp => {
+ const errorField = resp.checkoutErrors[0].field;
+ expect(errorField).to.be.eq("promoCode");
+ });
+ });
+
+ function createCheckoutForCreatedVoucher(voucherCode) {
+ return createCheckoutWithVoucher({
+ channelSlug: defaultChannel.slug,
+ variantsList: variants,
+ address,
+ shippingMethodId: shippingMethod.id,
+ voucherCode,
+ auth: "token"
+ });
+ }
+});
diff --git a/cypress/steps/channelsSteps.js b/cypress/steps/channelsSteps.js
index ec26e3834..e2a8fc2db 100644
--- a/cypress/steps/channelsSteps.js
+++ b/cypress/steps/channelsSteps.js
@@ -1,7 +1,9 @@
import { ADD_CHANNEL_FORM_SELECTORS } from "../elements/channels/add-channel-form-selectors";
import { CHANNEL_FORM_SELECTORS } from "../elements/channels/channel-form-selectors";
import { CHANNELS_SELECTORS } from "../elements/channels/channels-selectors";
+import { MENAGE_CHANNEL_AVAILABILITY } from "../elements/channels/menage-channel-availability";
import { HEADER_SELECTORS } from "../elements/header/header-selectors";
+import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
export function createChannelByView(name, currency, slug = name) {
cy.get(CHANNELS_SELECTORS.createChannelButton)
@@ -36,3 +38,15 @@ export function selectChannelInHeader(channelName) {
.contains(channelName)
.click();
}
+export function selectChannelInDetailsPages(channelName) {
+ cy.get(MENAGE_CHANNEL_AVAILABILITY.availableManageButton)
+ .click()
+ .get(MENAGE_CHANNEL_AVAILABILITY.allChannelsInput)
+ .click()
+ .get(MENAGE_CHANNEL_AVAILABILITY.channelsAvailabilityForm)
+ .contains(channelName)
+ .click()
+ .get(MENAGE_CHANNEL_AVAILABILITY.dialog)
+ .find(BUTTON_SELECTORS.submit)
+ .click();
+}
diff --git a/cypress/steps/salesSteps.js b/cypress/steps/discounts/salesSteps.js
similarity index 60%
rename from cypress/steps/salesSteps.js
rename to cypress/steps/discounts/salesSteps.js
index 2b00201fb..2d5a87791 100644
--- a/cypress/steps/salesSteps.js
+++ b/cypress/steps/discounts/salesSteps.js
@@ -1,8 +1,8 @@
-import { ASSIGN_PRODUCTS_SELECTORS } from "../elements/catalog/assign-products";
-import { MENAGE_CHANNEL_AVAILABILITY } from "../elements/channels/menage-channel-availability";
-import { SALES_SELECTORS } from "../elements/discounts/sales";
-import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
-import { formatDate } from "../support/formatDate";
+import { ASSIGN_PRODUCTS_SELECTORS } from "../../elements/catalog/assign-products";
+import { SALES_SELECTORS } from "../../elements/discounts/sales";
+import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
+import { formatDate } from "../../support/formatDate";
+import { selectChannelInDetailsPages } from "../channelsSteps";
export const discountOptions = {
PERCENTAGE: SALES_SELECTORS.percentageOption,
@@ -22,17 +22,9 @@ export function createSale({
.get(SALES_SELECTORS.nameInput)
.type(saleName)
.get(discountOption)
- .click()
- .get(MENAGE_CHANNEL_AVAILABILITY.availableManageButton)
- .click()
- .get(MENAGE_CHANNEL_AVAILABILITY.allChannelsInput)
- .click()
- .get(MENAGE_CHANNEL_AVAILABILITY.channelsAvailabilityForm)
- .contains(channelName)
- .click()
- .get(BUTTON_SELECTORS.submit)
- .click()
- .get(SALES_SELECTORS.discountValue)
+ .click();
+ selectChannelInDetailsPages(channelName);
+ cy.get(SALES_SELECTORS.discountValue)
.type(discountValue)
.get(SALES_SELECTORS.startDateInput)
.type(todaysDate);
diff --git a/cypress/steps/discounts/vouchersSteps.js b/cypress/steps/discounts/vouchersSteps.js
new file mode 100644
index 000000000..518a3f8a4
--- /dev/null
+++ b/cypress/steps/discounts/vouchersSteps.js
@@ -0,0 +1,27 @@
+import { VOUCHERS_SELECTORS } from "../../elements/discounts/vouchers";
+import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
+import { selectChannelInDetailsPages } from "../channelsSteps";
+
+export const discountOptions = {
+ PERCENTAGE: VOUCHERS_SELECTORS.percentageDiscountRadioButton,
+ FIXED: VOUCHERS_SELECTORS.fixedDiscountRadioButton,
+ SHIPPING: VOUCHERS_SELECTORS.shippingDiscountRadioButton
+};
+
+export function createVoucher({
+ voucherCode,
+ voucherValue,
+ discountOption,
+ channelName
+}) {
+ cy.get(VOUCHERS_SELECTORS.createVoucherButton).click();
+ selectChannelInDetailsPages(channelName);
+ cy.get(VOUCHERS_SELECTORS.voucherCodeInput)
+ .type(voucherCode)
+ .get(discountOption)
+ .click();
+ if (discountOption !== discountOptions.SHIPPING) {
+ cy.get(VOUCHERS_SELECTORS.discountValueInputs).type(voucherValue);
+ }
+ cy.get(BUTTON_SELECTORS.confirm).click();
+}
diff --git a/cypress/support/deleteElement/index.js b/cypress/support/deleteElement/index.js
index 03ad58c8e..44d046684 100644
--- a/cypress/support/deleteElement/index.js
+++ b/cypress/support/deleteElement/index.js
@@ -1,17 +1,17 @@
Cypress.Commands.add(
"handleDeleteElement",
- (element, deleteFunction, startsWith) => {
- if (element.node.name.includes(startsWith)) {
+ (element, deleteFunction, startsWith, name) => {
+ if (element.node[name].includes(startsWith)) {
deleteFunction(element.node.id);
}
}
);
Cypress.Commands.add(
"deleteElementsStartsWith",
- (deleteFunction, getFunction, startsWith, name) => {
+ (deleteFunction, getFunction, startsWith, name = "name") => {
getFunction(100, startsWith).then(elements => {
elements.forEach(element => {
- cy.handleDeleteElement(element, deleteFunction, startsWith);
+ cy.handleDeleteElement(element, deleteFunction, startsWith, name);
});
});
}
diff --git a/cypress/url/urlList.js b/cypress/url/urlList.js
index f91d13c72..d107318da 100644
--- a/cypress/url/urlList.js
+++ b/cypress/url/urlList.js
@@ -8,6 +8,7 @@ export const urlList = {
products: "products/",
warehouses: "warehouses/",
sales: "discounts/sales/",
- collections: "collections/"
+ collections: "collections/",
+ vouchers: "discounts/vouchers/"
};
export const productDetailsUrl = productId => `${urlList.products}${productId}`;
diff --git a/cypress/utils/collectionsUtils.js b/cypress/utils/collectionsUtils.js
index cfe3694b0..36f72a652 100644
--- a/cypress/utils/collectionsUtils.js
+++ b/cypress/utils/collectionsUtils.js
@@ -1,10 +1,5 @@
import { deleteCollection, getCollections } from "../apiRequests/Collections";
export function deleteCollectionsStartsWith(startsWith) {
- cy.deleteElementsStartsWith(
- deleteCollection,
- getCollections,
- startsWith,
- "collection"
- );
+ cy.deleteElementsStartsWith(deleteCollection, getCollections, startsWith);
}
diff --git a/cypress/utils/discounts/salesUtils.js b/cypress/utils/discounts/salesUtils.js
new file mode 100644
index 000000000..15620d37f
--- /dev/null
+++ b/cypress/utils/discounts/salesUtils.js
@@ -0,0 +1,5 @@
+import { deleteSale, getSales } from "../../apiRequests/Discounts/Sales";
+
+export function deleteSalesStartsWith(startsWith) {
+ cy.deleteElementsStartsWith(deleteSale, getSales, startsWith);
+}
diff --git a/cypress/utils/discounts/vouchersUtils.js b/cypress/utils/discounts/vouchersUtils.js
new file mode 100644
index 000000000..083099965
--- /dev/null
+++ b/cypress/utils/discounts/vouchersUtils.js
@@ -0,0 +1,8 @@
+import {
+ deleteVouchers,
+ getVouchers
+} from "../../apiRequests/Discounts/Vouchers";
+
+export function deleteVouchersStartsWith(startsWith) {
+ cy.deleteElementsStartsWith(deleteVouchers, getVouchers, startsWith, "code");
+}
diff --git a/cypress/utils/ordersUtils.js b/cypress/utils/ordersUtils.js
index 17c50e3f7..1610d1ccd 100644
--- a/cypress/utils/ordersUtils.js
+++ b/cypress/utils/ordersUtils.js
@@ -8,7 +8,7 @@ export function createWaitingForCaptureOrder(
shippingMethodId
) {
let checkout;
- return createCheckout(channelSlug, email, variantsList)
+ return createCheckout({ channelSlug, email, variantsList })
.then(checkoutResp => {
checkout = checkoutResp;
checkoutRequest.addShippingMethod(checkout.id, shippingMethodId);
@@ -17,6 +17,27 @@ export function createWaitingForCaptureOrder(
.then(() => checkoutRequest.completeCheckout(checkout.id))
.then(() => checkout);
}
+export function createCheckoutWithVoucher({
+ channelSlug,
+ email = "email@example.com",
+ variantsList,
+ address,
+ shippingMethodId,
+ voucherCode,
+ auth
+}) {
+ let checkout;
+ return createCheckout({ channelSlug, email, variantsList, address, auth })
+ .then(checkoutResp => {
+ checkout = checkoutResp;
+ checkoutRequest.addShippingMethod(checkout.id, shippingMethodId);
+ })
+ .then(() => {
+ checkoutRequest.addVoucher(checkout.id, voucherCode);
+ })
+ .its("body.data.checkoutAddPromoCode");
+}
+
export function createReadyToFulfillOrder(
customerId,
shippingMethodId,
@@ -60,9 +81,22 @@ export function createDraftOrder(customerId, shippingMethodId, channelId) {
.createDraftOrder(customerId, shippingMethodId, channelId)
.its("body.data.draftOrderCreate.order");
}
-export function createCheckout(channelSlug, email, variantsList) {
+export function createCheckout({
+ channelSlug,
+ email,
+ variantsList,
+ address,
+ auth
+}) {
return checkoutRequest
- .createCheckout(channelSlug, email, 1, variantsList)
+ .createCheckout({
+ channelSlug,
+ email,
+ productQuantity: 1,
+ variantsList,
+ address,
+ auth
+ })
.its("body.data.checkoutCreate.checkout");
}
export function addPayment(checkoutId) {
diff --git a/cypress/utils/productsUtils.js b/cypress/utils/productsUtils.js
index cadced175..8bf2e86e2 100644
--- a/cypress/utils/productsUtils.js
+++ b/cypress/utils/productsUtils.js
@@ -109,19 +109,16 @@ export function deleteProductsStartsWith(startsWith) {
cy.deleteElementsStartsWith(
productRequest.deleteProductType,
productRequest.getProductTypes,
- startsWith,
- "productType"
+ startsWith
);
cy.deleteElementsStartsWith(
attributeRequest.deleteAttribute,
attributeRequest.getAttributes,
- startsWith,
- "attributes"
+ startsWith
);
cy.deleteElementsStartsWith(
categoryRequest.deleteCategory,
categoryRequest.getCategories,
- startsWith,
- "categories"
+ startsWith
);
}
diff --git a/cypress/utils/salesUtils.js b/cypress/utils/salesUtils.js
deleted file mode 100644
index 6178380fe..000000000
--- a/cypress/utils/salesUtils.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import { deleteSale, getSales } from "../apiRequests/Sales";
-
-export function deleteSalesStartsWith(startsWith) {
- cy.deleteElementsStartsWith(deleteSale, getSales, startsWith, "sales");
-}
diff --git a/cypress/utils/shippingUtils.js b/cypress/utils/shippingUtils.js
index d297e3f8d..734699c31 100644
--- a/cypress/utils/shippingUtils.js
+++ b/cypress/utils/shippingUtils.js
@@ -46,13 +46,11 @@ export function deleteShippingStartsWith(startsWith) {
cy.deleteElementsStartsWith(
shippingMethodRequest.deleteShippingZone,
shippingMethodRequest.getShippingZones,
- startsWith,
- "shippingZONE"
+ startsWith
);
cy.deleteElementsStartsWith(
warehouseRequest.deleteWarehouse,
warehouseRequest.getWarehouses,
- startsWith,
- "Warehouse"
+ startsWith
);
}
diff --git a/src/discounts/components/VoucherInfo/VoucherInfo.tsx b/src/discounts/components/VoucherInfo/VoucherInfo.tsx
index e773d17a4..3e2dccf3e 100644
--- a/src/discounts/components/VoucherInfo/VoucherInfo.tsx
+++ b/src/discounts/components/VoucherInfo/VoucherInfo.tsx
@@ -46,7 +46,11 @@ const VoucherInfo = ({
title={intl.formatMessage(commonMessages.generalInformations)}
toolbar={
variant === "create" && (
-