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";
|
|
|
|
import { createChannel } from "../../../support/api/requests/Channels";
|
2021-09-10 09:03:42 +00:00
|
|
|
import {
|
|
|
|
customerRegistration,
|
|
|
|
deleteCustomersStartsWith,
|
|
|
|
requestPasswordReset
|
2021-09-27 10:04:21 +00:00
|
|
|
} from "../../../support/api/requests/Customer";
|
|
|
|
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
|
|
|
import { getMailsForUser } from "../../../support/api/utils/users";
|
|
|
|
import filterTests from "../../../support/filterTests";
|
2021-09-10 09:03:42 +00:00
|
|
|
|
2021-09-27 10:04:21 +00:00
|
|
|
filterTests({ definedTags: ["stagedOnly"], version: "3.1.1" }, () => {
|
2021-09-10 09:03:42 +00:00
|
|
|
describe("Plugins", () => {
|
|
|
|
const startsWith = "Plugins";
|
|
|
|
const randomName = `${startsWith}${faker.datatype.number()}`;
|
|
|
|
let defaultChannel;
|
|
|
|
|
|
|
|
before(() => {
|
|
|
|
cy.clearSessionData().loginUserViaRequest();
|
|
|
|
deleteCustomersStartsWith(startsWith);
|
|
|
|
createChannel({ name: randomName });
|
|
|
|
getDefaultChannel().then(channel => (defaultChannel = channel));
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.clearSessionData()
|
|
|
|
.loginUserViaRequest()
|
|
|
|
.visit(urlList.plugins)
|
|
|
|
.softExpectSkeletonIsVisible();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should change user email", () => {
|
|
|
|
const customerEmail = `${randomName}@example.com`;
|
|
|
|
cy.contains(PLUGINS_LIST.pluginRow, "User emails").click();
|
|
|
|
cy.contains(PLUGINS_DETAILS.channel, defaultChannel.name)
|
|
|
|
.click()
|
|
|
|
.get(PLUGINS_DETAILS.accountConfirmationSubjectInput)
|
|
|
|
.clearAndType(randomName)
|
|
|
|
.get(BUTTON_SELECTORS.confirm)
|
2021-09-27 10:04:21 +00:00
|
|
|
.click()
|
|
|
|
.confirmationMessageShouldDisappear();
|
2021-09-10 09:03:42 +00:00
|
|
|
customerRegistration({
|
|
|
|
email: customerEmail,
|
|
|
|
channel: defaultChannel.slug
|
|
|
|
})
|
|
|
|
.then(() => {
|
|
|
|
getMailsForUser(customerEmail);
|
|
|
|
})
|
|
|
|
.then(mails => {
|
|
|
|
expect(mails[0].Content.Headers.Subject[0]).to.eq(randomName);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should change admin email plugin", () => {
|
|
|
|
const customerEmail = `${randomName}@example.com`;
|
|
|
|
cy.contains(PLUGINS_LIST.pluginRow, "Admin emails")
|
|
|
|
.click()
|
|
|
|
.get(PLUGINS_DETAILS.staffPasswordResetInput)
|
|
|
|
.click()
|
|
|
|
.clear()
|
|
|
|
.clearAndType(randomName)
|
|
|
|
.get(BUTTON_SELECTORS.confirm)
|
2021-09-27 10:04:21 +00:00
|
|
|
.click()
|
|
|
|
.confirmationMessageShouldDisappear();
|
2021-09-10 09:03:42 +00:00
|
|
|
requestPasswordReset(Cypress.env("USER_NAME"), defaultChannel.slug)
|
|
|
|
.then(() => {
|
|
|
|
getMailsForUser(customerEmail);
|
|
|
|
})
|
|
|
|
.then(mails => {
|
|
|
|
expect(mails[0].Content.Headers.Subject[0]).to.eq(randomName);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|