
* 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
35 lines
681 B
JavaScript
35 lines
681 B
JavaScript
import { getValueWithDefault } from "../utils/Utils";
|
|
|
|
export function getSales(first, searchQuery) {
|
|
const filter = getValueWithDefault(
|
|
searchQuery,
|
|
`, filter:{
|
|
search:"${searchQuery}"
|
|
}`
|
|
);
|
|
const query = `query{
|
|
sales(first:
|
|
${first} ${filter}){
|
|
edges{
|
|
node{
|
|
id
|
|
name
|
|
}
|
|
}
|
|
}
|
|
}`;
|
|
return cy
|
|
.sendRequestWithQuery(query)
|
|
.then(resp => resp.body.data.sales.edges);
|
|
}
|
|
export function deleteSale(saleId) {
|
|
const mutation = `mutation{
|
|
saleDelete(id:"${saleId}"){
|
|
discountErrors{
|
|
field
|
|
message
|
|
}
|
|
}
|
|
}`;
|
|
return cy.sendRequestWithQuery(mutation);
|
|
}
|