saleor-dashboard/cypress/apiRequests/Order.js
Karolina f8d5593fc3
Saleor 1741 tests for orders (#1011)
* first test for draft orders

* tests for channels in draft orders

* tests for channels in draft orders

* tests for channels in draft orders

* test for moving draft order to orders

* test for orders

* test for orders

* tests for draft orders

* tests for draft orders

* tests for draft orders

* tests for draft orders

* test for moving draft order

* tests for orders
2021-03-17 11:00:30 +01:00

56 lines
1.1 KiB
JavaScript

export function markOrderAsPaid(orderId) {
const mutation = `mutation{
orderMarkAsPaid(id:"${orderId}"){
orderErrors{
message
}
}
}`;
return cy.sendRequestWithQuery(mutation);
}
export function addProductToOrder(orderId, variantId, quantity = 1) {
const mutation = `mutation{
draftOrderLinesCreate(id:"${orderId}", input:{
quantity:${quantity}
variantId: "${variantId}"
}){
orderErrors{
message
}
}
}`;
return cy.sendRequestWithQuery(mutation);
}
export function createDraftOrder(customerId, shippingMethodId, channelId) {
const mutation = `mutation{
draftOrderCreate(input:{
user:"${customerId}"
shippingMethod:"${shippingMethodId}"
channel: "${channelId}"
}){
orderErrors{
message
}
order{
id
number
}
}
}`;
return cy.sendRequestWithQuery(mutation);
}
export function completeOrder(orderId) {
const mutation = `mutation{
draftOrderComplete(id:"${orderId}"){
order{
id
}
orderErrors{
message
}
}
}`;
return cy.sendRequestWithQuery(mutation);
}