Activate plugins before tests (#2477)

This commit is contained in:
Karolina Rakoczy 2022-10-27 11:40:33 +02:00 committed by GitHub
parent 4dcc38cf48
commit 8a28230577
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

View file

@ -12,6 +12,7 @@ import {
deleteCustomersStartsWith,
requestPasswordReset,
} from "../../../support/api/requests/Customer";
import { activatePlugin } from "../../../support/api/requests/Plugins";
import {
deleteChannelsStartsWith,
getDefaultChannel,
@ -31,7 +32,14 @@ describe("As an admin I want to manage plugins", () => {
cy.clearSessionData().loginUserViaRequest();
deleteCustomersStartsWith(startsWith);
deleteChannelsStartsWith(startsWith);
getDefaultChannel().then(channel => (defaultChannel = channel));
getDefaultChannel().then(channel => {
defaultChannel = channel;
activatePlugin({ id: "mirumee.notifications.admin_email" });
activatePlugin({
id: "mirumee.notifications.user_email",
channel: channel.id,
});
});
});
beforeEach(() => {

View file

@ -14,3 +14,19 @@ export function updatePlugin(id, name, value) {
}`;
return cy.sendRequestWithQuery(mutation);
}
export function activatePlugin({ id, channel, active = true }) {
const channelLine = channel ? `channelId: "${channel}"` : "";
const mutation = `mutation{
pluginUpdate(id: "${id}" ${channelLine} input:{
active:${active}
}){
errors{
field
message
}
}
}`;
return cy.sendRequestWithQuery(mutation);
}