saleor-dashboard/cypress/support/api/requests/Apps.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

63 lines
1.1 KiB
JavaScript

export function createApp(name, permission) {
const mutation = `mutation{
appCreate(input:{name:"${name}" permissions:${permission}}){
authToken
errors{
field
message
}
app{
id
}
}
}`;
return cy.sendRequestWithQuery(mutation).its("body.data.appCreate.app");
}
export function getApps(first, search) {
const mutation = `query{
apps(filter:{ search: "${search}"} first: ${first}){
edges{
node{
name
id
}
}
}
}`;
return cy
.sendRequestWithQuery(mutation)
.then(resp => resp.body.data.apps.edges);
}
export function deleteApp(appId) {
const mutation = `mutation{
appDelete(id:"${appId}"){
errors{
field
message
}
}
}`;
return cy.sendRequestWithQuery(mutation);
}
export function getApp(appId) {
const query = `query{
app(id:"${appId}"){
name
permissions{
code
}
tokens{
name
authToken
}
webhooks{
name
targetUrl
}
}
}`;
return cy.sendRequestWithQuery(query).its("body.data.app");
}