
* 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
71 lines
1.3 KiB
JavaScript
71 lines
1.3 KiB
JavaScript
export function createChannel({
|
|
isActive = true,
|
|
name,
|
|
slug = name,
|
|
currencyCode = "PLN",
|
|
defaultCountry = "PL"
|
|
}) {
|
|
const createChannelMutation = `mutation{
|
|
channelCreate(input: {
|
|
isActive: ${isActive}
|
|
name: "${name}"
|
|
slug: "${slug}"
|
|
currencyCode: "${currencyCode}"
|
|
defaultCountry: ${defaultCountry}
|
|
}){
|
|
channel{
|
|
id
|
|
name
|
|
slug
|
|
}
|
|
errors{
|
|
code
|
|
message
|
|
}
|
|
}
|
|
}`;
|
|
return cy
|
|
.sendRequestWithQuery(createChannelMutation)
|
|
.its("body.data.channelCreate.channel");
|
|
}
|
|
|
|
export function getChannels() {
|
|
const getChannelsInfoQuery = `query{
|
|
channels{
|
|
name
|
|
id
|
|
isActive
|
|
slug
|
|
currencyCode
|
|
}
|
|
}`;
|
|
return cy.sendRequestWithQuery(getChannelsInfoQuery);
|
|
}
|
|
|
|
export function deleteChannel(channelId, targetChannelId) {
|
|
const deleteChannelMutation = `mutation{
|
|
channelDelete(id: "${channelId}", input:{
|
|
channelId: "${targetChannelId}"
|
|
}){
|
|
channel{
|
|
name
|
|
}
|
|
channelErrors{
|
|
message
|
|
}
|
|
}
|
|
}`;
|
|
return cy.sendRequestWithQuery(deleteChannelMutation);
|
|
}
|
|
|
|
export function activateChannel(channelId) {
|
|
const mutation = `mutation{
|
|
channelActivate(id:"${channelId}"){
|
|
errors{
|
|
field
|
|
message
|
|
}
|
|
}
|
|
}`;
|
|
return cy.sendRequestWithQuery(mutation);
|
|
}
|