2021-09-27 10:04:21 +00:00
|
|
|
/// <reference types="cypress"/>
|
|
|
|
/// <reference types="../../../support"/>
|
|
|
|
|
2021-09-10 09:03:42 +00:00
|
|
|
import faker from "faker";
|
|
|
|
|
2021-09-27 10:04:21 +00:00
|
|
|
import { PLUGINS_DETAILS } from "../../../elements/plugins/pluginDetails";
|
|
|
|
import { PLUGINS_LIST } from "../../../elements/plugins/pluginsList";
|
|
|
|
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
|
|
|
|
import { urlList } from "../../../fixtures/urlList";
|
2021-09-10 09:03:42 +00:00
|
|
|
import {
|
|
|
|
customerRegistration,
|
|
|
|
deleteCustomersStartsWith,
|
2022-06-27 16:49:35 +00:00
|
|
|
requestPasswordReset,
|
2021-09-27 10:04:21 +00:00
|
|
|
} from "../../../support/api/requests/Customer";
|
2022-10-27 09:40:33 +00:00
|
|
|
import { activatePlugin } from "../../../support/api/requests/Plugins";
|
2021-09-29 13:24:47 +00:00
|
|
|
import {
|
|
|
|
deleteChannelsStartsWith,
|
2022-06-27 16:49:35 +00:00
|
|
|
getDefaultChannel,
|
2021-09-29 13:24:47 +00:00
|
|
|
} from "../../../support/api/utils/channelsUtils";
|
2021-12-05 15:03:29 +00:00
|
|
|
import {
|
2022-06-27 16:49:35 +00:00
|
|
|
getMailsForUser,
|
2022-09-15 07:34:31 +00:00
|
|
|
getMailWithResetPasswordLink,
|
2021-12-05 15:03:29 +00:00
|
|
|
} from "../../../support/api/utils/users";
|
2021-09-10 09:03:42 +00:00
|
|
|
|
2022-09-15 07:34:31 +00:00
|
|
|
describe("As an admin I want to manage plugins", () => {
|
2022-06-27 09:30:51 +00:00
|
|
|
const startsWith = "Plugins";
|
|
|
|
const randomName = `${startsWith}${faker.datatype.number()}`;
|
2022-09-15 07:34:31 +00:00
|
|
|
|
2022-06-27 09:30:51 +00:00
|
|
|
let defaultChannel;
|
2021-09-10 09:03:42 +00:00
|
|
|
|
2022-06-27 09:30:51 +00:00
|
|
|
before(() => {
|
|
|
|
cy.clearSessionData().loginUserViaRequest();
|
|
|
|
deleteCustomersStartsWith(startsWith);
|
|
|
|
deleteChannelsStartsWith(startsWith);
|
2022-10-27 09:40:33 +00:00
|
|
|
getDefaultChannel().then(channel => {
|
|
|
|
defaultChannel = channel;
|
|
|
|
activatePlugin({ id: "mirumee.notifications.admin_email" });
|
|
|
|
activatePlugin({
|
|
|
|
id: "mirumee.notifications.user_email",
|
|
|
|
channel: channel.id,
|
|
|
|
});
|
|
|
|
});
|
2022-06-27 09:30:51 +00:00
|
|
|
});
|
2021-09-10 09:03:42 +00:00
|
|
|
|
2022-06-27 09:30:51 +00:00
|
|
|
beforeEach(() => {
|
|
|
|
cy.clearSessionData()
|
|
|
|
.loginUserViaRequest()
|
|
|
|
.visit(urlList.plugins)
|
|
|
|
.expectSkeletonIsVisible();
|
|
|
|
});
|
2021-09-10 09:03:42 +00:00
|
|
|
|
2022-09-15 07:34:31 +00:00
|
|
|
it(
|
|
|
|
"should change user email. TC: SALEOR_3601",
|
2023-01-16 14:05:07 +00:00
|
|
|
{ tags: ["@plugins", "@allEnv", "@stable"] },
|
2022-09-15 07:34:31 +00:00
|
|
|
() => {
|
|
|
|
const customerEmail = `${randomName}@example.com`;
|
|
|
|
|
|
|
|
cy.contains(PLUGINS_LIST.pluginRow, "User emails")
|
|
|
|
.click()
|
|
|
|
.waitForProgressBarToNotBeVisible();
|
|
|
|
cy.contains(PLUGINS_DETAILS.channel, defaultChannel.name)
|
|
|
|
.click()
|
|
|
|
.get(PLUGINS_DETAILS.accountConfirmationSubjectInput)
|
|
|
|
.clearAndType(randomName)
|
|
|
|
.get(BUTTON_SELECTORS.confirm)
|
|
|
|
.click()
|
|
|
|
.confirmationMessageShouldDisappear();
|
|
|
|
customerRegistration({
|
|
|
|
email: customerEmail,
|
|
|
|
channel: defaultChannel.slug,
|
2022-06-27 09:30:51 +00:00
|
|
|
});
|
2022-09-15 07:34:31 +00:00
|
|
|
getMailsForUser(customerEmail)
|
|
|
|
.its("0.Content.Headers.Subject.0")
|
|
|
|
.should("eq", randomName);
|
|
|
|
},
|
|
|
|
);
|
2021-09-10 09:03:42 +00:00
|
|
|
|
2022-06-27 09:30:51 +00:00
|
|
|
it(
|
2022-09-15 07:34:31 +00:00
|
|
|
"should change admin email plugin. TC: SALEOR_3602",
|
2023-01-16 14:05:07 +00:00
|
|
|
{ tags: ["@plugins", "@allEnv", "@stable"] },
|
2022-06-27 09:30:51 +00:00
|
|
|
() => {
|
2022-09-15 07:34:31 +00:00
|
|
|
const adminName = `Admin${randomName}`;
|
|
|
|
|
2021-09-10 09:03:42 +00:00
|
|
|
cy.contains(PLUGINS_LIST.pluginRow, "Admin emails")
|
|
|
|
.click()
|
|
|
|
.get(PLUGINS_DETAILS.staffPasswordResetInput)
|
|
|
|
.click()
|
|
|
|
.clear()
|
2022-09-15 07:34:31 +00:00
|
|
|
.clearAndType(adminName)
|
2021-09-10 09:03:42 +00:00
|
|
|
.get(BUTTON_SELECTORS.confirm)
|
2021-09-27 10:04:21 +00:00
|
|
|
.click()
|
|
|
|
.confirmationMessageShouldDisappear();
|
2022-09-15 07:34:31 +00:00
|
|
|
requestPasswordReset(Cypress.env("USER_NAME"), defaultChannel.slug);
|
|
|
|
getMailWithResetPasswordLink(Cypress.env("USER_NAME"), adminName)
|
|
|
|
.its("0.Content.Headers.Subject.0")
|
|
|
|
.should("contains", adminName);
|
2022-06-27 16:49:35 +00:00
|
|
|
},
|
2022-06-27 09:30:51 +00:00
|
|
|
);
|
2021-09-10 09:03:42 +00:00
|
|
|
});
|