diff --git a/cypress/integration/checkout/purchaseWithProductTypes.js b/cypress/integration/checkout/purchaseWithProductTypes.js
index 95ec7dea7..da44a72a3 100644
--- a/cypress/integration/checkout/purchaseWithProductTypes.js
+++ b/cypress/integration/checkout/purchaseWithProductTypes.js
@@ -120,9 +120,9 @@ filterTests({ definedTags: ["all", "refactored"] }, () => {
.then(() => {
addPayment(checkout.id);
})
- .then(({ paymentErrors }) => {
+ .then(({ errors }) => {
expect(
- paymentErrors,
+ errors,
"Should be not possible to add payment without shipping"
).to.have.lengthOf(1);
updateShippingInCheckout(checkout.token, shippingMethod.name);
diff --git a/cypress/integration/preorders/createAndEditVariantsInPreorder.js b/cypress/integration/preorders/createAndEditVariantsInPreorder.js
index 7381bf8b0..772c6e496 100644
--- a/cypress/integration/preorders/createAndEditVariantsInPreorder.js
+++ b/cypress/integration/preorders/createAndEditVariantsInPreorder.js
@@ -1,6 +1,8 @@
///
///
+import faker from "faker";
+
import { PRODUCT_DETAILS } from "../../elements/catalog/products/product-details";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
@@ -24,7 +26,7 @@ import {
filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
describe("Creating variants in preorder", () => {
- const startsWith = "CreatePreOrder";
+ const name = `CreatePreOrder${faker.datatype.number()}`;
const attributeValues = ["value1", "value2", "value3"];
const threshold = 100;
const futureDate = new Date().setDate(new Date().getDate() + 14);
@@ -38,19 +40,17 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
before(() => {
cy.clearSessionData().loginUserViaRequest();
- createProductWithShipping({ name: startsWith, attributeValues }).then(
- resp => {
- checkoutData = {
- address: resp.address,
- channelSlug: resp.defaultChannel.slug,
- email: "example@example.com",
- shippingMethodName: resp.shippingMethod.name
- };
- defaultChannel = resp.defaultChannel;
- product = resp.product;
- variantsList = resp.variantsList;
- }
- );
+ createProductWithShipping({ name, attributeValues }).then(resp => {
+ checkoutData = {
+ address: resp.address,
+ channelSlug: resp.defaultChannel.slug,
+ email: "example@example.com",
+ shippingMethodName: resp.shippingMethod.name
+ };
+ defaultChannel = resp.defaultChannel;
+ product = resp.product;
+ variantsList = resp.variantsList;
+ });
});
beforeEach(() => {
diff --git a/cypress/support/api/requests/Attribute.js b/cypress/support/api/requests/Attribute.js
index fcd971507..187aa6832 100644
--- a/cypress/support/api/requests/Attribute.js
+++ b/cypress/support/api/requests/Attribute.js
@@ -59,7 +59,7 @@ export function getAttributes(first, search) {
export function deleteAttribute(attributeId) {
const mutation = `mutation{
attributeDelete(id:"${attributeId}"){
- attributeErrors{
+ errors{
field
message
}
diff --git a/cypress/support/api/requests/Category.js b/cypress/support/api/requests/Category.js
index e87b4ba94..a25ea009a 100644
--- a/cypress/support/api/requests/Category.js
+++ b/cypress/support/api/requests/Category.js
@@ -7,7 +7,7 @@ export function createCategory({ name, slug = name, parent }) {
const parentLine = getValueWithDefault(parent, `parent:"${parent}"`);
const mutation = `mutation{
categoryCreate(input:{name:"${name}", slug: "${slug}"} ${parentLine}){
- productErrors{
+ errors{
field
message
}
@@ -78,7 +78,7 @@ export function getCategories(first, search) {
export function deleteCategory(categoryId) {
const mutation = `mutation{
categoryDelete(id:"${categoryId}"){
- productErrors{
+ errors{
field
message
}
diff --git a/cypress/support/api/requests/Channels.js b/cypress/support/api/requests/Channels.js
index fcdd9a642..6ad140eb8 100644
--- a/cypress/support/api/requests/Channels.js
+++ b/cypress/support/api/requests/Channels.js
@@ -50,7 +50,7 @@ export function deleteChannel(channelId, targetChannelId) {
channel{
name
}
- channelErrors{
+ errors{
message
}
}
diff --git a/cypress/support/api/requests/Checkout.js b/cypress/support/api/requests/Checkout.js
index 9bf027243..bf7768da8 100644
--- a/cypress/support/api/requests/Checkout.js
+++ b/cypress/support/api/requests/Checkout.js
@@ -126,7 +126,7 @@ export function addPayment({ checkoutId, gateway, token, amount }) {
${amountLine}
returnUrl: "https://qa.storefront.staging.saleor.cloud/checkout/payment-confirm"
}){
- paymentErrors{
+ errors{
field
message
}
diff --git a/cypress/support/api/requests/Collections.js b/cypress/support/api/requests/Collections.js
index 8f763e1f4..95193e333 100644
--- a/cypress/support/api/requests/Collections.js
+++ b/cypress/support/api/requests/Collections.js
@@ -4,7 +4,7 @@ export function createCollection(name, slug = name) {
name:"${name}",
slug:"${name}"
}){
- collectionErrors{
+ errors{
field
message
}
@@ -46,7 +46,7 @@ export function deleteCollection(collectionId) {
collection{
id
}
- collectionErrors{
+ errors{
field
message
}
diff --git a/cypress/support/api/requests/Customer.js b/cypress/support/api/requests/Customer.js
index cb17adc54..40e12d7ef 100644
--- a/cypress/support/api/requests/Customer.js
+++ b/cypress/support/api/requests/Customer.js
@@ -23,7 +23,7 @@ export function createCustomer(email, customerName, address, isActive = false) {
id
email
}
- accountErrors{
+ errors{
code
message
}
@@ -48,7 +48,7 @@ export function deleteCustomersStartsWith(startsWith) {
export function deleteCustomer(customerId) {
const mutation = `mutation{
customerDelete(id:"${customerId}"){
- accountErrors{
+ errors{
code
message
}
diff --git a/cypress/support/api/requests/Discounts/Sales.js b/cypress/support/api/requests/Discounts/Sales.js
index b8ec14daf..560308ceb 100644
--- a/cypress/support/api/requests/Discounts/Sales.js
+++ b/cypress/support/api/requests/Discounts/Sales.js
@@ -29,7 +29,7 @@ export function getSales(first, searchQuery) {
export function deleteSale(saleId) {
const mutation = `mutation{
saleDelete(id:"${saleId}"){
- discountErrors{
+ errors{
field
message
}
diff --git a/cypress/support/api/requests/Discounts/Vouchers.js b/cypress/support/api/requests/Discounts/Vouchers.js
index c30279050..0cfd016af 100644
--- a/cypress/support/api/requests/Discounts/Vouchers.js
+++ b/cypress/support/api/requests/Discounts/Vouchers.js
@@ -21,7 +21,7 @@ export function getVouchers(first, startsWith) {
export function deleteVouchers(voucherId) {
const mutation = `mutation deleteVouchers{
voucherDelete(id:"${voucherId}"){
- discountErrors{
+ errors{
field
message
}
diff --git a/cypress/support/api/requests/Order.js b/cypress/support/api/requests/Order.js
index a9e3a1724..29bca17f4 100644
--- a/cypress/support/api/requests/Order.js
+++ b/cypress/support/api/requests/Order.js
@@ -3,7 +3,7 @@ import { getDefaultAddress, getValueWithDefault } from "./utils/Utils";
export function markOrderAsPaid(orderId) {
const mutation = `mutation{
orderMarkAsPaid(id:"${orderId}"){
- orderErrors{
+ errors{
message
}
}
@@ -31,7 +31,7 @@ export function addProductToOrder(orderId, variantId, quantity = 1) {
quantity:${quantity}
variantId: "${variantId}"
}){
- orderErrors{
+ errors{
message
}
}
diff --git a/cypress/support/api/requests/Product.js b/cypress/support/api/requests/Product.js
index 8c833fc79..29d6c792c 100644
--- a/cypress/support/api/requests/Product.js
+++ b/cypress/support/api/requests/Product.js
@@ -33,7 +33,7 @@ export function getFirstProducts(first, search) {
export function updateProduct(productId, input) {
const mutation = `mutation {
productUpdate(id:"${productId}", input:${stringify(input)} ){
- productErrors{
+ errors{
field
message
}
@@ -85,7 +85,7 @@ export function updateChannelPriceInVariant(variantId, channelId) {
price: 10
costPrice: 10
}){
- productChannelListingErrors{
+ errors{
message
}
}
@@ -133,7 +133,7 @@ export function createProduct({
id
name
}
- productErrors{
+ errors{
field
message
}
@@ -218,7 +218,7 @@ export function createVariant({
export function deleteProduct(productId) {
const mutation = `mutation{
productDelete(id: "${productId}"){
- productErrors{
+ errors{
field
message
}
diff --git a/cypress/support/api/requests/ProductType.js b/cypress/support/api/requests/ProductType.js
index d205d2b66..f64574613 100644
--- a/cypress/support/api/requests/ProductType.js
+++ b/cypress/support/api/requests/ProductType.js
@@ -66,7 +66,7 @@ export function getProductTypes(first, search) {
export function deleteProductType(productTypeId) {
const mutation = `mutation{
productTypeDelete(id:"${productTypeId}"){
- productErrors{
+ errors{
field
message
}
diff --git a/cypress/support/api/requests/ShippingMethod.js b/cypress/support/api/requests/ShippingMethod.js
index dffaab7ff..ea672926c 100644
--- a/cypress/support/api/requests/ShippingMethod.js
+++ b/cypress/support/api/requests/ShippingMethod.js
@@ -68,7 +68,7 @@ export function addChannelToShippingZone(shippingZoneId, channelId) {
shippingZoneUpdate(id:"${shippingZoneId}", input:{
addChannels:["${channelId}"]
}){
- shippingErrors{
+ errors{
field
message
}
@@ -106,7 +106,7 @@ export function addChannelToShippingMethod(
export function deleteShippingZone(shippingZoneId) {
const mutation = `mutation{
shippingZoneDelete(id:"${shippingZoneId}"){
- shippingErrors{
+ errors{
message
}
}
diff --git a/cypress/support/api/requests/Warehouse.js b/cypress/support/api/requests/Warehouse.js
index b052924df..dabc0c8f1 100644
--- a/cypress/support/api/requests/Warehouse.js
+++ b/cypress/support/api/requests/Warehouse.js
@@ -12,7 +12,7 @@ export function createWarehouse({ name, shippingZone, address, slug = name }) {
${shippingZoneLine}
${getDefaultAddress(address, "address", false)}
}){
- warehouseErrors{
+ errors{
field
message
}
@@ -48,7 +48,7 @@ export function getWarehouses(first, search) {
export function deleteWarehouse(warehouseId) {
const mutation = `mutation{
deleteWarehouse(id:"${warehouseId}"){
- warehouseErrors{
+ errors{
field
message
}
diff --git a/cypress/support/customCommands/user/index.js b/cypress/support/customCommands/user/index.js
index bfdb5f79d..0ff960dce 100644
--- a/cypress/support/customCommands/user/index.js
+++ b/cypress/support/customCommands/user/index.js
@@ -23,7 +23,7 @@ Cypress.Commands.add(
token
csrfToken
refreshToken
- errors: accountErrors {
+ errors: errors {
code
field
message
diff --git a/cypress/support/index.js b/cypress/support/index.js
index 0b60eb0bc..5b075f8ba 100644
--- a/cypress/support/index.js
+++ b/cypress/support/index.js
@@ -46,17 +46,25 @@ Cypress.Commands.add("addAliasToGraphRequest", operationName => {
Cypress.Commands.add(
"sendRequestWithQuery",
(query, authorization = "auth", variables = "") =>
- cy.request({
- body: {
- variables,
- query
- },
- headers: {
- Authorization: `JWT ${window.sessionStorage.getItem(authorization)}`
- },
- method: "POST",
- url: urlList.apiUri
- })
+ cy
+ .request({
+ body: {
+ variables,
+ query
+ },
+ headers: {
+ Authorization: `JWT ${window.sessionStorage.getItem(authorization)}`
+ },
+ method: "POST",
+ url: urlList.apiUri,
+ log: true
+ })
+ .then(response => {
+ const respInSting = JSON.stringify(response.body);
+ if (respInSting.includes(`"errors":[{`)) {
+ cy.log(query).log(JSON.stringify(response.body));
+ }
+ })
);
Cypress.on(
"uncaught:exception",