Activate plugins before tests (#2477)
This commit is contained in:
parent
4dcc38cf48
commit
8a28230577
2 changed files with 25 additions and 1 deletions
|
@ -12,6 +12,7 @@ import {
|
||||||
deleteCustomersStartsWith,
|
deleteCustomersStartsWith,
|
||||||
requestPasswordReset,
|
requestPasswordReset,
|
||||||
} from "../../../support/api/requests/Customer";
|
} from "../../../support/api/requests/Customer";
|
||||||
|
import { activatePlugin } from "../../../support/api/requests/Plugins";
|
||||||
import {
|
import {
|
||||||
deleteChannelsStartsWith,
|
deleteChannelsStartsWith,
|
||||||
getDefaultChannel,
|
getDefaultChannel,
|
||||||
|
@ -31,7 +32,14 @@ describe("As an admin I want to manage plugins", () => {
|
||||||
cy.clearSessionData().loginUserViaRequest();
|
cy.clearSessionData().loginUserViaRequest();
|
||||||
deleteCustomersStartsWith(startsWith);
|
deleteCustomersStartsWith(startsWith);
|
||||||
deleteChannelsStartsWith(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(() => {
|
beforeEach(() => {
|
||||||
|
|
|
@ -14,3 +14,19 @@ export function updatePlugin(id, name, value) {
|
||||||
}`;
|
}`;
|
||||||
return cy.sendRequestWithQuery(mutation);
|
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);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue