2021-03-12 12:14:18 +00:00
|
|
|
export function getSalesForChannel(channelSlug, period) {
|
|
|
|
const query = `query{
|
2021-03-12 14:57:02 +00:00
|
|
|
ordersTotal(period: ${period}, channel:"${channelSlug}"){
|
|
|
|
gross{
|
|
|
|
amount
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}`;
|
2021-03-12 12:14:18 +00:00
|
|
|
return cy.sendRequestWithQuery(query);
|
|
|
|
}
|
2021-04-26 07:49:55 +00:00
|
|
|
export function getOrdersForChannel(channelSlug, { gte, lte }) {
|
2021-03-12 12:14:18 +00:00
|
|
|
const query = `query{
|
2021-04-26 07:49:55 +00:00
|
|
|
orders(filter: { created: { gte: "${gte}", lte: "${lte}" } }, channel:"${channelSlug}"){
|
2021-03-12 14:57:02 +00:00
|
|
|
totalCount
|
|
|
|
}
|
|
|
|
}`;
|
2021-03-12 12:14:18 +00:00
|
|
|
return cy.sendRequestWithQuery(query);
|
|
|
|
}
|
|
|
|
export function getOrdersWithStatus(status, channelSlug) {
|
|
|
|
const query = `query{
|
2021-04-26 07:49:55 +00:00
|
|
|
orders(filter: { status: ${status} }, channel:"${channelSlug}"){
|
2021-03-12 14:57:02 +00:00
|
|
|
totalCount
|
|
|
|
}
|
|
|
|
}`;
|
2021-03-12 12:14:18 +00:00
|
|
|
return cy.sendRequestWithQuery(query);
|
|
|
|
}
|
|
|
|
export function getProductsOutOfStock(channelSlug) {
|
|
|
|
const query = `query{
|
2021-07-05 13:05:13 +00:00
|
|
|
products(filter: { stockAvailability: OUT_OF_STOCK} channel:"${channelSlug}" ){
|
2021-03-12 14:57:02 +00:00
|
|
|
totalCount
|
|
|
|
}
|
|
|
|
}`;
|
2021-03-12 12:14:18 +00:00
|
|
|
return cy.sendRequestWithQuery(query);
|
2021-02-15 09:44:50 +00:00
|
|
|
}
|