saleor-dashboard/cypress/support/api/requests/storeFront/Collections.js

27 lines
587 B
JavaScript
Raw Normal View History

import { getValueWithDefault } from "../utils/Utils";
export function getCollection({ collectionId, channelSlug, auth = "token" }) {
const channelLine = getValueWithDefault(
channelSlug,
`channel: "${channelSlug}"`
);
const query = `query Collection{
collection(id: "${collectionId}" ${channelLine}) {
id
slug
name
description
products(first:100){
totalCount
edges{
node{
id
name
2021-02-24 13:21:19 +00:00
}
}
}
}
}`;
return cy.sendRequestWithQuery(query, auth).its("body.data");
2021-02-24 13:21:19 +00:00
}