Update tests check if all data created in before are correct (#2917)
* add commend to check if data are correct * Add command for checking created data
This commit is contained in:
parent
92539ae968
commit
39ce183583
53 changed files with 168 additions and 19 deletions
|
@ -84,7 +84,10 @@ describe("As a staff user I want to manage apps", () => {
|
|||
categoryId: category.id,
|
||||
});
|
||||
})
|
||||
.then(({ variantsList: variants }) => (variantsList = variants));
|
||||
.then(({ variantsList: variants }) => {
|
||||
variantsList = variants
|
||||
cy.checkIfDataAreNotNull({createdApp,defaultChannel,address,warehouse,shippingMethod,variantsList,checkout})
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -66,7 +66,16 @@ describe("As an admin I want to manage categories", () => {
|
|||
});
|
||||
},
|
||||
)
|
||||
.then(({ product: productResp }) => (product = productResp));
|
||||
.then(({ product: productResp }) => {
|
||||
product = productResp;
|
||||
cy.checkIfDataAreNotNull({
|
||||
attribute,
|
||||
category,
|
||||
productType,
|
||||
product,
|
||||
defaultChannel,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -70,7 +70,10 @@ describe("As an admin I want to manage collections.", () => {
|
|||
});
|
||||
},
|
||||
)
|
||||
.then(({ product: productResp }) => (product = productResp));
|
||||
.then(({ product: productResp }) => {
|
||||
product = productResp
|
||||
cy.checkIfDataAreNotNull({attribute, category, productType, product, defaultChannel})
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -63,6 +63,7 @@ describe("As a admin I want to use enabled gift card in checkout", () => {
|
|||
shippingMethodName: resp.shippingMethod.name,
|
||||
variantsList: resp.variantsList,
|
||||
};
|
||||
cy.checkIfDataAreNotNull(dataForCheckout);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ describe("As a customer I should be able to purchase gift card as a product", ()
|
|||
})
|
||||
.then(({ variantsList: variantsResp }) => {
|
||||
variants = variantsResp;
|
||||
cy.checkIfDataAreNotNull({defaultChannel, productType, attribute, category, shippingMethod, variants, address})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ describe("Warehouses in checkout", () => {
|
|||
})
|
||||
.then(({ variantsList }) => {
|
||||
variantsInOtherWarehouse = variantsList;
|
||||
cy.checkIfDataAreNotNull({defaultChannel, usAddress, secondUsAddress, productData, checkoutData, variantsInOtherWarehouse})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -84,7 +84,10 @@ describe("Products without shipment option", () => {
|
|||
productTypeId: productTypeResp.id,
|
||||
warehouseId: warehouse.id,
|
||||
}).then(
|
||||
({ variantsList }) => (productWithoutShipping = variantsList),
|
||||
({ variantsList }) => {
|
||||
productWithoutShipping = variantsList
|
||||
cy.checkIfDataAreNotNull({channel, address, warehouse, shippingMethod, productWithShipping, productWithoutShipping})
|
||||
}
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
|
@ -43,6 +43,13 @@ describe("As an unlogged customer I want to order physical and digital products"
|
|||
shippingMethod = resp.shippingMethod;
|
||||
digitalVariants = resp.digitalVariants;
|
||||
physicalVariants = resp.physicalVariants;
|
||||
cy.checkIfDataAreNotNull({
|
||||
defaultChannel,
|
||||
address,
|
||||
shippingMethod,
|
||||
digitalVariants,
|
||||
physicalVariants,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ describe("Manage products stocks in checkout", () => {
|
|||
lastVariantInStock = resp.createdVariants.find(
|
||||
variant => variant.name === "lastVariantInStock",
|
||||
);
|
||||
cy.checkIfDataAreNotNull({defaultChannel, address,shippingMethod, variantsWithLowStock, variantsWithoutTrackInventory, lastVariantInStock})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ describe("As an admin I want to use attributes in variant selection", () => {
|
|||
];
|
||||
let channel;
|
||||
let category;
|
||||
let product;
|
||||
|
||||
before(() => {
|
||||
cy.clearSessionData().loginUserViaRequest();
|
||||
|
@ -33,6 +32,7 @@ describe("As an admin I want to use attributes in variant selection", () => {
|
|||
getDefaultChannel().then(defaultChannel => (channel = defaultChannel));
|
||||
createCategory({ name: startsWith }).then(
|
||||
categoryResp => (category = categoryResp),
|
||||
cy.checkIfDataAreNotNull({channel, category})
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -51,6 +51,7 @@ describe("As an admin I want to use attributes in variant selection", () => {
|
|||
const inputType = attributeType.key;
|
||||
const attributeValues = ["1", "2"];
|
||||
let productType;
|
||||
let product;
|
||||
|
||||
createProductTypeWithNewVariantSelectionAttribute({
|
||||
name,
|
||||
|
|
|
@ -29,6 +29,7 @@ describe("As an admin I want to delete and update content attribute", () => {
|
|||
}).then(attributeResp => {
|
||||
attribute = attributeResp;
|
||||
});
|
||||
cy.checkIfDataAreNotNull(attribute)
|
||||
});
|
||||
|
||||
it(
|
||||
|
|
|
@ -39,12 +39,16 @@ describe("Channels", () => {
|
|||
shippingZone = shippingZoneResp;
|
||||
},
|
||||
);
|
||||
cy.fixture("addresses").then(addresses => {
|
||||
cy.fixture("addresses")
|
||||
.then(addresses => {
|
||||
usAddress = addresses.usAddress;
|
||||
createWarehouseViaApi({
|
||||
name: randomName,
|
||||
address: usAddress,
|
||||
});
|
||||
})
|
||||
.then(warehouse => {
|
||||
cy.checkIfDataAreNotNull({ shippingZone, usAddress, warehouse });
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ describe("Tests on inactive channel", () => {
|
|||
currencyCode: currency,
|
||||
}).then(channel => {
|
||||
newChannel = channel;
|
||||
cy.checkIfDataAreNotNull({ address, defaultChannel, newChannel });
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ describe("Tests for customer", () => {
|
|||
address = usAddress;
|
||||
secondAddress = secondUsAddress;
|
||||
});
|
||||
cy.checkIfDataAreNotNull({ address, secondAddress });
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -25,7 +25,10 @@ describe("Tests for menu navigation", () => {
|
|||
cy.clearSessionData().loginUserViaRequest();
|
||||
deleteMenusStartsWith(startsWith);
|
||||
createMenuViaApi(randomName).then(
|
||||
({ menu: menuResp }) => (menu = menuResp),
|
||||
({ menu: menuResp }) => {
|
||||
menu = menuResp
|
||||
cy.checkIfDataAreNotNull(menu)
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -91,7 +91,10 @@ describe("Adyen payments", () => {
|
|||
categoryId: category.id,
|
||||
});
|
||||
})
|
||||
.then(({ variantsList: variants }) => (variantsList = variants));
|
||||
.then(({ variantsList: variants }) => {
|
||||
variantsList = variants
|
||||
cy.checkIfDataAreNotNull({address,defaultChannel,warehouse,shippingMethod,variantsList,checkout,paymentCards,cardData})
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -50,6 +50,7 @@ describe("Stripe payments", () => {
|
|||
defaultChannel = values.defaultChannel;
|
||||
shippingMethod = values.shippingMethod;
|
||||
variantsList = values.variantsList;
|
||||
cy.checkIfDataAreNotNull({address,defaultChannel,shippingMethod,variantsList,checkout,paymentCards,cardData})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ describe("As an admin I want to manage attributes in product types", () => {
|
|||
cy.clearSessionData().loginUserViaRequest();
|
||||
deleteProductsStartsWith(startsWith);
|
||||
createAttribute({ name: startsWith }).then(resp => (attribute = resp));
|
||||
cy.checkIfDataAreNotNull(attribute);
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -29,7 +29,10 @@ describe("As an admin I want to manage product types", () => {
|
|||
deleteProductsStartsWith(startsWith);
|
||||
createAttribute({ name: startsWith }).then(resp => (attribute = resp));
|
||||
createCategory({ name: startsWith }).then(resp => (category = resp));
|
||||
getDefaultChannel().then(resp => (channel = resp));
|
||||
getDefaultChannel().then(resp => {
|
||||
channel = resp
|
||||
cy.checkIfDataAreNotNull({attribute, channel, category})
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -95,6 +95,7 @@ describe("As a staff user I want to create shipping zone and rate", () => {
|
|||
})
|
||||
.then(variantsListResp => {
|
||||
secondVariantsList = variantsListResp;
|
||||
cy.checkIfDataAreNotNull({defaultChannel,address,warehouse,variantsList, secondVariantsList, attribute})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ describe("As a user I should be able to update and delete shipping method", () =
|
|||
createShippingZone(name, "US", defaultChannel.id, warehouse.id).then(
|
||||
shippingZoneResp => {
|
||||
shippingZone = shippingZoneResp;
|
||||
cy.checkIfDataAreNotNull({defaultChannel, shippingZone, shippingMethod, warehouse, usAddress})
|
||||
},
|
||||
);
|
||||
});
|
||||
|
|
|
@ -40,12 +40,12 @@ describe("As a user I should be able to update and delete shipping zone", () =>
|
|||
warehouse = warehouseResp;
|
||||
|
||||
updateChannelWarehouses(defaultChannel.id, warehouse.id);
|
||||
cy.checkIfDataAreNotNull({defaultChannel, shippingZone, plAddress, warehouse})
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
const rateName = `${startsWith}${faker.datatype.number()}`;
|
||||
|
||||
cy.clearSessionData().loginUserViaRequest();
|
||||
createShippingZone(name, "US", defaultChannel.id, warehouse.id).then(
|
||||
|
|
|
@ -83,6 +83,7 @@ describe("As a user I want to create shipping method with postal codes", () => {
|
|||
})
|
||||
.then(({ variantsList: variantsListResp }) => {
|
||||
variantsList = variantsListResp;
|
||||
cy.checkIfDataAreNotNull({defaultChannel,usAddress,secondUsAddress,shippingZone,warehouse,variantsList})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@ describe("As a staff user I want to manage shipping weights", () => {
|
|||
})
|
||||
.then(({ variantsList: variantsListResp }) => {
|
||||
variantsList = variantsListResp;
|
||||
cy.checkIfDataAreNotNull({defaultChannel,usAddress,shippingZone,warehouse,variantsList})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ describe("As a staff user I want to change shop default weight unit", () => {
|
|||
})
|
||||
.then(shippingZoneResp => {
|
||||
shippingZone = shippingZoneResp;
|
||||
cy.checkIfDataAreNotNull({defaultChannel,usAddress,shippingZone,warehouse})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ describe("Tests for site settings", () => {
|
|||
cy.fixture("addresses").then(({ usAddress, plAddress }) => {
|
||||
address = usAddress;
|
||||
updateShopAddress(plAddress);
|
||||
cy.checkIfDataAreNotNull(address)
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ describe("As an admin I want to manage warehouses", () => {
|
|||
cy.fixture("addresses").then(addresses => {
|
||||
usAddress = addresses.usAddress;
|
||||
secondUsAddress = addresses.secondUsAddress;
|
||||
cy.checkIfDataAreNotNull({usAddress,secondUsAddress})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ describe("Tests for customer registration", () => {
|
|||
deleteCustomersStartsWith(startsWith);
|
||||
getDefaultChannel().then(channel => {
|
||||
defaultChannel = channel;
|
||||
cy.checkIfDataAreNotNull({defaultChannel})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ describe("As an admin I want to create sale for products", () => {
|
|||
})
|
||||
.then(({ warehouse: warehouseResp }) => {
|
||||
warehouse = warehouseResp;
|
||||
cy.checkIfDataAreNotNull({productType,attribute,category,defaultChannel,warehouse})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ describe("Sales discounts for variant", () => {
|
|||
warehouseId: warehouse.id,
|
||||
price: productPrice,
|
||||
};
|
||||
cy.checkIfDataAreNotNull({productData, defaultChannel, warehouse, address})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ describe("As an admin I want to update sales", () => {
|
|||
warehouseId: warehouse.id,
|
||||
price: productPrice,
|
||||
};
|
||||
cy.checkIfDataAreNotNull({productData, defaultChannel, warehouse, address, sale, variants})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ describe("As an admin I want to create voucher", () => {
|
|||
auth: "token",
|
||||
};
|
||||
},
|
||||
cy.checkIfDataAreNotNull({createdChannel, dataForCheckout, defaultChannel})
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ describe("As an admin I want to create voucher", () => {
|
|||
shippingMethodName: shippingMethodResp.name,
|
||||
auth: "token",
|
||||
};
|
||||
cy.checkIfDataAreNotNull({dataForCheckout, defaultChannel})
|
||||
cy.clearSessionData();
|
||||
},
|
||||
);
|
||||
|
|
|
@ -51,6 +51,7 @@ describe("As an admin I want to update vouchers", () => {
|
|||
auth: "token",
|
||||
};
|
||||
},
|
||||
cy.checkIfDataAreNotNull({dataForCheckout, defaultChannel, product})
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ describe("Test for metadata", () => {
|
|||
})
|
||||
.then(({ product: productResp }) => {
|
||||
product = productResp;
|
||||
cy.checkIfDataAreNotNull({channel, product})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ xdescribe("Channels in draft orders", () => {
|
|||
})
|
||||
.then(channelResp => {
|
||||
otherChannel = channelResp;
|
||||
cy.checkIfDataAreNotNull({ defaultChannel, otherChannel });
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ xdescribe("Draft orders", () => {
|
|||
categoryId: categoryResp.id,
|
||||
});
|
||||
},
|
||||
cy.checkIfDataAreNotNull({ defaultChannel, warehouse, address }),
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ describe("As an admin I want to manage stock reservation", () => {
|
|||
productType = productTypeResp;
|
||||
},
|
||||
);
|
||||
cy.checkIfDataAreNotNull({defaultChannel,address,warehouse,attribute,category,productType,dataForCheckout})
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -105,6 +105,7 @@ describe("Orders", () => {
|
|||
)
|
||||
.then(({ variantsList: variantsResp }) => {
|
||||
variantsList = variantsResp;
|
||||
cy.checkIfDataAreNotNull({customer,defaultChannel,warehouse,shippingMethod,variantsList,address})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -40,7 +40,10 @@ describe("Tests for pages", () => {
|
|||
attribute = attributeResp;
|
||||
createPageType({ name, attributeId: attribute.id });
|
||||
})
|
||||
.then(({ pageType: pageTypeResp }) => (pageType = pageTypeResp));
|
||||
.then(({ pageType: pageTypeResp }) => {
|
||||
pageType = pageTypeResp;
|
||||
cy.checkIfDataAreNotNull({ attribute, pageType });
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -55,6 +55,7 @@ describe("As an admin I should be able to create product", () => {
|
|||
cy.clearSessionData().loginUserViaRequest();
|
||||
createAttribute({ name }).then(attributeResp => {
|
||||
attribute = attributeResp;
|
||||
cy.checkIfDataAreNotNull({attribute})
|
||||
});
|
||||
});
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -53,6 +53,13 @@ describe("Products available in listings", () => {
|
|||
productType = productTypeResp;
|
||||
attribute = attributeResp;
|
||||
category = categoryResp;
|
||||
cy.checkIfDataAreNotNull({
|
||||
productType,
|
||||
attribute,
|
||||
category,
|
||||
defaultChannel,
|
||||
warehouse,
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
|
|
|
@ -38,6 +38,12 @@ describe("Published products", () => {
|
|||
)
|
||||
.then(channel => {
|
||||
defaultChannel = channel;
|
||||
cy.checkIfDataAreNotNull({
|
||||
productType,
|
||||
attribute,
|
||||
category,
|
||||
defaultChannel,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -37,6 +37,12 @@ describe("Products displayed in listings", () => {
|
|||
)
|
||||
.then(channel => {
|
||||
defaultChannel = channel;
|
||||
cy.checkIfDataAreNotNull({
|
||||
productType,
|
||||
attribute,
|
||||
category,
|
||||
defaultChannel,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -80,6 +80,14 @@ describe("As an admin I should be able to filter products", () => {
|
|||
})
|
||||
.then(({ product: product }) => {
|
||||
updateProduct(product.id, { collections: [collection.id] });
|
||||
cy.checkIfDataAreNotNull({
|
||||
attribute,
|
||||
productType,
|
||||
category,
|
||||
warehouse,
|
||||
channel,
|
||||
collection,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ describe("As an admin I should be able to sort products", () => {
|
|||
cy.clearSessionData().loginUserViaRequest();
|
||||
getDefaultChannel().then(channel => {
|
||||
defaultChannel = channel;
|
||||
cy.checkIfDataAreNotNull({defaultChannel})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -48,7 +48,10 @@ describe("As an admin I should be able to create variant", () => {
|
|||
|
||||
createChannel({ isActive: true, name, currencyCode: "PLN" });
|
||||
})
|
||||
.then(resp => (newChannel = resp));
|
||||
.then(resp => {
|
||||
newChannel = resp
|
||||
cy.checkIfDataAreNotNull({defaultChannel,warehouse,attribute,productType,category,newChannel})
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -86,6 +86,16 @@ describe("Creating variants", () => {
|
|||
)
|
||||
.then(type => {
|
||||
simpleProductType = type;
|
||||
cy.checkIfDataAreNotNull({
|
||||
defaultChannel,
|
||||
warehouse,
|
||||
attribute,
|
||||
productType,
|
||||
simpleProductType,
|
||||
category,
|
||||
shippingMethod,
|
||||
address,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -73,7 +73,20 @@ describe("Updating products without sku", () => {
|
|||
categoryId: category.id,
|
||||
});
|
||||
})
|
||||
.then(productResp => (product = productResp));
|
||||
.then(productResp => {
|
||||
product = productResp;
|
||||
cy.checkIfDataAreNotNull({
|
||||
defaultChannel,
|
||||
address,
|
||||
warehouse,
|
||||
shippingMethod,
|
||||
attribute,
|
||||
category,
|
||||
productTypeWithVariants,
|
||||
productTypeWithoutVariants,
|
||||
product,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -58,6 +58,12 @@ describe("Update products", () => {
|
|||
})
|
||||
.then(({ product: productResp }) => {
|
||||
product = productResp;
|
||||
cy.checkIfDataAreNotNull({
|
||||
defaultChannel,
|
||||
collection,
|
||||
product,
|
||||
attribute,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ describe("Staff members", () => {
|
|||
cy.clearSessionData().visit(urlLink);
|
||||
fillUpSetPassword(password);
|
||||
cy.clearSessionData();
|
||||
cy.checkIfDataAreNotNull({user})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -21,7 +21,10 @@ describe("As an admin I want to manage translations", () => {
|
|||
cy.clearSessionData().loginUserViaRequest();
|
||||
deleteCategoriesStartsWith(startsWith);
|
||||
createCategory({ name: startsWith }).then(
|
||||
categoryResp => (category = categoryResp),
|
||||
categoryResp => {
|
||||
category = categoryResp
|
||||
cy.checkIfDataAreNotNull({category})
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -17,3 +17,17 @@ Cypress.Commands.add("waitForRequestAndCheckIfNoErrors", alias => {
|
|||
return resp;
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("checkIfDataAreNotNull", (data) => {
|
||||
expect(data, "Created data should not be null").to.be.not.null;
|
||||
if(typeof data === "object"){
|
||||
Object.keys(data).forEach(key => {
|
||||
cy.checkIfDataAreNotNull(data[key])
|
||||
})
|
||||
}else if(Array.isArray(data)){
|
||||
expect(data).not.to.be.empty;
|
||||
data.forEach(singleData => {
|
||||
cy.checkIfDataAreNotNull(singleData)
|
||||
})
|
||||
}
|
||||
})
|
Loading…
Reference in a new issue