saleor-dashboard/cypress/support/api/requests/HomePage.js
Karolina Rakoczy 2c64a966cc
Saleor 4437 refactor tests (#1389)
* reference type cypress working

* refactor

* remove screenshots

* add reference

* add slash marker

* run tests based on shop version

* fix run tests based on shop version

* fix run tests based on shop version

* change base url to localhost

* fix plugins

* fix plugins

* fix plugins

* fix plugins

* fix plugins

* fix plugins

* fix yml

* fix yml

* chage file names

* fix files names

* fix broken imports add checking for errors in grpah responses

* fix broken imports add checking for errors in grpah responses

* update jest

* fix snapshot
2021-09-27 12:04:21 +02:00

34 lines
946 B
JavaScript

export function getSalesForChannel(channelSlug, period) {
const query = `query{
ordersTotal(period: ${period}, channel:"${channelSlug}"){
gross{
amount
}
}
}`;
return cy.sendRequestWithQuery(query);
}
export function getOrdersForChannel(channelSlug, { gte, lte }) {
const query = `query{
orders(filter: { created: { gte: "${gte}", lte: "${lte}" } }, channel:"${channelSlug}"){
totalCount
}
}`;
return cy.sendRequestWithQuery(query);
}
export function getOrdersWithStatus(status, channelSlug) {
const query = `query{
orders(filter: { status: ${status} }, channel:"${channelSlug}"){
totalCount
}
}`;
return cy.sendRequestWithQuery(query);
}
export function getProductsOutOfStock(channelSlug) {
const query = `query{
products(filter: { stockAvailability: OUT_OF_STOCK} channel:"${channelSlug}" ){
totalCount
}
}`;
return cy.sendRequestWithQuery(query);
}