Fix cypress tests for plugins and gift cards exports (#3626)

* Fix test for plugins

* remove unused import

* Fix plugins

* decrease limit meaasge

* Fix export gift cards

* remove only
This commit is contained in:
Karolina Rakoczy 2023-05-11 15:44:26 +02:00 committed by GitHub
parent cf4adbc1af
commit b9bf19ddfb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View file

@ -98,7 +98,7 @@ describe("As an admin I want to manage plugins", () => {
.confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear();
requestPasswordReset(Cypress.env("USER_NAME"), defaultChannel.slug); requestPasswordReset(Cypress.env("USER_NAME"), defaultChannel.slug);
getMailWithResetPasswordLink(Cypress.env("USER_NAME"), adminName) getMailWithResetPasswordLink(Cypress.env("USER_NAME"), adminName)
.its("0.Content.Headers.Subject.0") .its("Subject")
.should("contains", adminName); .should("contains", adminName);
}, },
); );

View file

@ -110,7 +110,7 @@ export function getMailWithResetPasswordLink(email, subject, i = 0) {
cy.wait(3000); cy.wait(3000);
getMailWithResetPasswordLink(serverStoredEmail, subject, i + 1); getMailWithResetPasswordLink(serverStoredEmail, subject, i + 1);
} else { } else {
cy.wrap(resetPasswordMails); cy.wrap(resetPasswordMails).mpLatest().mpGetMailDetails();
} }
}); });
} }
@ -144,7 +144,7 @@ export function getMailWithGiftCardExportWithAttachment(
if (i > 5) { if (i > 5) {
throw new Error(`There is no email Gift Card export for user ${email}`); throw new Error(`There is no email Gift Card export for user ${email}`);
} }
return cy.mhGetMailsByRecipient(email).then(mails => { return cy.mpGetMailsByRecipient(email).then(mails => {
if (!mails.length) { if (!mails.length) {
cy.wait(3000); cy.wait(3000);
getMailWithGiftCardExportWithAttachment( getMailWithGiftCardExportWithAttachment(
@ -154,7 +154,7 @@ export function getMailWithGiftCardExportWithAttachment(
i + 1, i + 1,
); );
} else { } else {
cy.mhGetMailsBySubject(subject).then(mailsWithSubject => { cy.mpGetMailsBySubject(subject).then(mailsWithSubject => {
if (!mailsWithSubject.length) { if (!mailsWithSubject.length) {
cy.wait(10000); cy.wait(10000);
getMailWithGiftCardExportWithAttachment( getMailWithGiftCardExportWithAttachment(
@ -165,10 +165,10 @@ export function getMailWithGiftCardExportWithAttachment(
); );
} else { } else {
cy.wrap(mailsWithSubject) cy.wrap(mailsWithSubject)
.mhFirst() .mpLatest()
.mpGetMailDetails()
.should("not.eq", undefined) .should("not.eq", undefined)
.mhGetBody() .its("Text");
.then(body => body);
} }
}); });
} }

View file

@ -12,7 +12,7 @@ Cypress.Commands.add("mpGetAllMails", (fromLast = 60000) =>
cy cy
.request({ .request({
method: "GET", method: "GET",
url: mhApiUrl("/v1/messages?limit=9999"), url: mhApiUrl("/v1/messages?limit=100"),
}) })
.then(response => { .then(response => {
// by default get mails received in last 60000ms // by default get mails received in last 60000ms