saleor-dashboard/cypress/apiRequests/Channels.js

54 lines
1.3 KiB
JavaScript
Raw Normal View History

2021-02-04 11:15:27 +00:00
class Channels {
createChannel(isActive, name, slug, currencyCode) {
const createChannelMutation = `mutation{
channelCreate(input: {
isActive: ${isActive}
name: "${name}"
slug: "${slug}"
currencyCode: "${currencyCode}"
}){
channel{
id
2021-02-04 11:15:27 +00:00
name
slug
}
channelErrors{
code
message
}
}
}`;
return cy.sendRequestWithQuery(createChannelMutation);
}
getChannels() {
const getChannelsInfoQuery = `query{
2021-02-15 09:44:50 +00:00
channels{
name
id
isActive
slug
currencyCode
2021-02-04 11:15:27 +00:00
}
2021-02-15 09:44:50 +00:00
}
`;
2021-02-04 11:15:27 +00:00
return cy.sendRequestWithQuery(getChannelsInfoQuery);
}
2021-02-15 09:44:50 +00:00
deleteChannel(channelId, targetChannelId) {
2021-02-04 11:15:27 +00:00
const deleteChannelMutation = `mutation{
channelDelete(id: "${channelId}", input:{
2021-02-15 09:44:50 +00:00
targetChannel: "${targetChannelId}"
}){
channel{
name
}
channelErrors{
message
2021-02-04 11:15:27 +00:00
}
2021-02-18 19:32:35 +00:00
}
}`;
2021-02-04 11:15:27 +00:00
return cy.sendRequestWithQuery(deleteChannelMutation);
}
}
export default Channels;