saleor-dashboard/cypress/apiRequests/Channels.js
Karolina Rakoczy 074c0f7a6c
Saleor 2960 checkout products without shipment (#1075)
* add tests for puchase by type

* add expect for isShippingRequired
2021-04-28 15:10:47 +02:00

56 lines
1.1 KiB
JavaScript

export function createChannel({
isActive = true,
name,
slug = name,
currencyCode = "PLN"
}) {
const createChannelMutation = `mutation{
channelCreate(input: {
isActive: ${isActive}
name: "${name}"
slug: "${slug}"
currencyCode: "${currencyCode}"
}){
channel{
id
name
slug
}
channelErrors{
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:{
targetChannel: "${targetChannelId}"
}){
channel{
name
}
channelErrors{
message
}
}
}`;
return cy.sendRequestWithQuery(deleteChannelMutation);
}