saleor-dashboard/cypress/utils/collectionsUtils.js

29 lines
826 B
JavaScript
Raw Normal View History

2021-02-18 09:00:08 +00:00
import Collections from "../apiRequests/frontShop/Collections";
class CollectionsUtils {
collectionsRequest = new Collections();
2021-02-19 11:08:10 +00:00
2021-02-18 09:00:08 +00:00
isCollectionVisible(collectionId, channelSlug) {
return this.collectionsRequest
.getCollection(collectionId, channelSlug)
.then(resp => {
const collection = resp.body[0].data.collection;
2021-02-22 12:10:51 +00:00
return collection !== null && collection.id === collectionId;
2021-02-18 09:00:08 +00:00
});
}
2021-02-22 12:10:51 +00:00
waitForCreateCollectionRequest() {
2021-02-18 09:00:08 +00:00
return cy
.wait(`@CreateCollection`)
.its("response.body.data.collectionCreate.collection");
}
2021-02-19 11:08:10 +00:00
deleteProperCollections(startsWith) {
cy.deleteProperElements(
this.collectionsRequest.deleteCollection,
this.collectionsRequest.getCollections,
startsWith,
"collection"
);
}
2021-02-18 09:00:08 +00:00
}
export default CollectionsUtils;