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

61 lines
1.1 KiB
JavaScript

import { getDefaultAddress } from "./utils/Utils";
export function updateShopWeightUnit(weightUnit) {
const mutation = `mutation{
shopSettingsUpdate(input:{
defaultWeightUnit: ${weightUnit}
}){
errors{
field
message
}
shop{
defaultWeightUnit
}
}
}`;
return cy
.sendRequestWithQuery(mutation)
.wait(5000)
.its("body.data.shopSettingsUpdate");
}
export function updateShopAddress(address) {
const input = getDefaultAddress(address, "input");
const mutation = `mutation{
shopAddressUpdate(${input}){
errors{
field
message
}
}
}`;
return cy.sendRequestWithQuery(mutation);
}
export function getShopInfo() {
const query = `query{
shop{
name
version
domain{
host
}
description
companyAddress{
companyName
streetAddress1
streetAddress2
city
cityArea
postalCode
country{
code
}
countryArea
phone
}
}
}`;
return cy.sendRequestWithQuery(query).its("body.data.shop");
}