saleor-dashboard/cypress/utils/collectionsUtils.js
Karolina Rakoczy 2ea9035e9c
2021-02-19 12:08:10 +01:00

28 lines
807 B
JavaScript

import Collections from "../apiRequests/frontShop/Collections";
class CollectionsUtils {
collectionsRequest = new Collections();
isCollectionVisible(collectionId, channelSlug) {
return this.collectionsRequest
.getCollection(collectionId, channelSlug)
.then(resp => {
const collection = resp.body[0].data.collection;
return collection && collection.id === collectionId;
});
}
getCreatedCollection() {
return cy
.wait(`@CreateCollection`)
.its("response.body.data.collectionCreate.collection");
}
deleteProperCollections(startsWith) {
cy.deleteProperElements(
this.collectionsRequest.deleteCollection,
this.collectionsRequest.getCollections,
startsWith,
"collection"
);
}
}
export default CollectionsUtils;