From 8a28230577dd406e17d870ea95e8de4d4293a7f2 Mon Sep 17 00:00:00 2001 From: Karolina Rakoczy Date: Thu, 27 Oct 2022 11:40:33 +0200 Subject: [PATCH] Activate plugins before tests (#2477) --- cypress/e2e/configuration/plugins/plugins.js | 10 +++++++++- cypress/support/api/requests/Plugins.js | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/configuration/plugins/plugins.js b/cypress/e2e/configuration/plugins/plugins.js index eac0b4fca..5615ec77d 100644 --- a/cypress/e2e/configuration/plugins/plugins.js +++ b/cypress/e2e/configuration/plugins/plugins.js @@ -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(() => { diff --git a/cypress/support/api/requests/Plugins.js b/cypress/support/api/requests/Plugins.js index b4e952627..402ddded1 100644 --- a/cypress/support/api/requests/Plugins.js +++ b/cypress/support/api/requests/Plugins.js @@ -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); +}