Skip to content

Commit

Permalink
Activate plugins before tests (saleor#2477)
Browse files Browse the repository at this point in the history
  • Loading branch information
karola312 authored Oct 27, 2022
1 parent 4dcc38c commit 8a28230
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cypress/e2e/configuration/plugins/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
deleteCustomersStartsWith,
requestPasswordReset,
} from "../../../support/api/requests/Customer";
import { activatePlugin } from "../../../support/api/requests/Plugins";
import {
deleteChannelsStartsWith,
getDefaultChannel,
Expand All @@ -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(() => {
Expand Down
16 changes: 16 additions & 0 deletions cypress/support/api/requests/Plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 8a28230

Please sign in to comment.