Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests for exports and plugins - 3.9 #3642

Merged
merged 1 commit into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress/e2e/configuration/plugins/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe("As an admin I want to manage plugins", () => {
.confirmationMessageShouldDisappear();
requestPasswordReset(Cypress.env("USER_NAME"), defaultChannel.slug);
getMailWithResetPasswordLink(Cypress.env("USER_NAME"), adminName)
.its("0.Content.Headers.Subject.0")
.its("Subject")
.should("contains", adminName);
},
);
Expand Down
20 changes: 13 additions & 7 deletions cypress/support/api/utils/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,19 @@ export function getMailWithResetPasswordLink(email, subject, i = 0) {
`There is no email with reset password for user ${serverStoredEmail}`,
);
}
return cy.mpGetMailsByRecipient(serverStoredEmail).should(mails => {
return cy.mpGetMailsByRecipient(serverStoredEmail).then(mails => {
if (!mails.length) {
cy.wait(3000);
getMailWithResetPasswordLink(serverStoredEmail, subject, i + 1);
} else {
cy.mpGetMailsBySubject(subject);
return mails;
cy.mpGetMailsBySubject(subject).then(resetPasswordMails => {
if (!resetPasswordMails.length) {
cy.wait(3000);
getMailWithResetPasswordLink(serverStoredEmail, subject, i + 1);
} else {
cy.wrap(resetPasswordMails).mpLatest().mpGetMailDetails();
}
});
}
});
}
Expand Down Expand Up @@ -138,7 +144,7 @@ export function getMailWithGiftCardExportWithAttachment(
if (i > 5) {
throw new Error(`There is no email Gift Card export for user ${email}`);
}
return cy.mpGetMailsByRecipient(email).should(mails => {
return cy.mpGetMailsByRecipient(email).then(mails => {
if (!mails.length) {
cy.wait(3000);
getMailWithGiftCardExportWithAttachment(
Expand All @@ -148,7 +154,7 @@ export function getMailWithGiftCardExportWithAttachment(
i + 1,
);
} else {
cy.mpGetMailsBySubject(subject).should(mailsWithSubject => {
cy.mpGetMailsBySubject(subject).then(mailsWithSubject => {
if (!mailsWithSubject.length) {
cy.wait(10000);
getMailWithGiftCardExportWithAttachment(
Expand All @@ -160,8 +166,8 @@ export function getMailWithGiftCardExportWithAttachment(
} else {
cy.wrap(mailsWithSubject)
.mpLatest()
.should("not.eq", undefined)
.mpGetMailDetails();
.mpGetMailDetails()
.should("not.eq", undefined);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/customCommands/basicOperations/mailpit.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Cypress.Commands.add("mpGetAllMails", (fromLast = 60000) =>
cy
.request({
method: "GET",
url: mhApiUrl("/v1/messages?limit=9999"),
url: mhApiUrl("/v1/messages?limit=100"),
})
.then(response => {
// by default get mails received in last 60000ms
Expand Down