saleor-dashboard/cypress/apiRequests/Attribute.js
2021-02-02 12:34:10 +01:00

49 lines
1.1 KiB
JavaScript

class Attribute {
createAttribute(name) {
const mutation = `mutation{
attributeCreate(input:{
name:"${name}"
valueRequired:false
type:PRODUCT_TYPE
}){
attribute{
id
}
attributeErrors{
field
message
}
}
}`;
return cy.sendRequestWithQuery(mutation);
}
getAttributes(first, search) {
const mutation = `query{
attributes(first:${first}, filter:{
search:"${search}"
}){
edges{
node{
id
name
}
}
}
}`;
return cy.sendRequestWithQuery(mutation);
}
deleteAttribute(attributeId) {
const mutation = `mutation{
attributeDelete(id:"${attributeId}"){
attributeErrors{
field
message
}
}
}`;
return cy.sendRequestWithQuery(mutation);
}
}
export default Attribute;