saleor-dashboard/cypress/apiRequests/Page.js
Karolina Rakoczy 283e714202
tests for pages (#1222)
* tests for pages

* fix tests

* fix imports

* tests for pages

* add wait

* tests for pages

* fix weight recalculate
2021-07-27 10:57:17 +02:00

38 lines
712 B
JavaScript

export function getPage(pageId, auth = "auth") {
const query = `query{
page(id:"${pageId}"){
title
isPublished
attributes{
values{
inputType
name
}
attribute{
id
inputType
}
}
}
}`;
return cy.sendRequestWithQuery(query, auth).its("body.data.page");
}
export function createPage({ title, pageTypeId }) {
const mutation = `mutation{
pageCreate(input:{
title:"${title}"
pageType:"${pageTypeId}"
}){
errors{
field
message
}
page{
title
id
}
}
}`;
return cy.sendRequestWithQuery(mutation).its("body.data.pageCreate");
}