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

[cypress] Fail in case of SMTP problems with a clear message #43492

Merged
merged 7 commits into from
Jun 20, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Test in backend that the application configuration', () => {
cy.task('getMails').then((mails) => {
cy.get('#system-message-container').should('contain.text', 'The email was sent to');

cy.wrap(mails).should('have.lengthOf', 1);
expect(mails.length).to.equal(1);
laoneo marked this conversation as resolved.
Show resolved Hide resolved
cy.wrap(mails[0].body).should('have.string', 'This is a test mail sent using');
cy.wrap(mails[0].sender).should('equal', Cypress.env('email'));
cy.wrap(mails[0].receivers).should('have.property', Cypress.env('email'));
Expand Down
2 changes: 1 addition & 1 deletion tests/System/integration/api/com_contact/Contacts.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('Test that contacts API endpoint', () => {
.should('equal', 200));

cy.task('getMails').then((mails) => {
cy.wrap(mails).should('have.lengthOf', 1);
expect(mails.length).to.equal(1);
cy.wrap(mails[0].sender).should('equal', Cypress.env('email'));
cy.wrap(mails[0].receivers).should('have.property', Cypress.env('email'));
cy.wrap(mails[0].headers.subject).should('equal', `${Cypress.env('sitename')}: automated test subject`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Test in frontend that the privacy request view', () => {

cy.task('getMails').then((mails) => {
cy.get('.alert-message').should('contain.text', 'Your information request has been created. Before it can be processed, you must verify this request. An email has been sent to your address with additional instructions to complete this verification.');
cy.wrap(mails).should('have.lengthOf', 2);
expect(mails.length).to.equal(2);
cy.wrap(mails[0].sender).should('equal', Cypress.env('email'));
cy.wrap(mails[0].body).should('have.string', `A new information request has been submitted by ${Cypress.env('email')}.`);
cy.wrap(mails[1].body).should('have.string', 'Someone has created a request to export all personal information related to this email address at ');
Expand All @@ -29,7 +29,7 @@ describe('Test in frontend that the privacy request view', () => {

cy.task('getMails').then((mails) => {
cy.get('.alert-message').should('contain.text', 'Your information request has been created. Before it can be processed, you must verify this request. An email has been sent to your address with additional instructions to complete this verification.');
cy.wrap(mails).should('have.lengthOf', 2);
expect(mails.length).to.equal(2);
cy.wrap(mails[0].sender).should('equal', Cypress.env('email'));
cy.wrap(mails[0].body).should('have.string', `A new information request has been submitted by ${Cypress.env('email')}.`);
cy.wrap(mails[1].body).should('have.string', 'Someone has created a request to export all personal information related to this email address at ');
Expand All @@ -44,7 +44,7 @@ describe('Test in frontend that the privacy request view', () => {

cy.task('getMails').then((mails) => {
cy.get('.alert-message').should('contain.text', 'Your information request has been created. Before it can be processed, you must verify this request. An email has been sent to your address with additional instructions to complete this verification.');
cy.wrap(mails).should('have.lengthOf', 2);
expect(mails.length).to.equal(2);
cy.wrap(mails[0].sender).should('equal', Cypress.env('email'));
cy.wrap(mails[0].body).should('have.string', `A new information request has been submitted by ${Cypress.env('email')}.`);
cy.wrap(mails[1].body).should('have.string', 'Someone has created a request to remove all personal information related to this email address at ');
Expand All @@ -61,7 +61,7 @@ describe('Test in frontend that the privacy request view', () => {

cy.task('getMails').then((mails) => {
cy.get('.alert-message').should('contain.text', 'Your information request has been created. Before it can be processed, you must verify this request. An email has been sent to your address with additional instructions to complete this verification.');
cy.wrap(mails).should('have.lengthOf', 2);
expect(mails.length).to.equal(2);
cy.wrap(mails[0].sender).should('equal', Cypress.env('email'));
cy.wrap(mails[0].body).should('have.string', `A new information request has been submitted by ${Cypress.env('email')}.`);
cy.wrap(mails[1].body).should('have.string', 'Someone has created a request to remove all personal information related to this email address at ');
Expand All @@ -75,6 +75,7 @@ describe('Test in frontend that the privacy request view', () => {
cy.get('.controls > .btn').click();

cy.task('getMails').then((mails) => {
expect(mails.length).to.equal(2);
const str = mails[1].body;

const firstSplit = str.split('URL: ')[1];
Expand All @@ -93,6 +94,7 @@ describe('Test in frontend that the privacy request view', () => {
cy.get('.controls > .btn').click();

cy.task('getMails').then((mails) => {
expect(mails.length).to.equal(2);
const str = mails[1].body;

const firstSplitURL = str.split('paste your token into the form.\n')[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Test in frontend that the users remind view', () => {
cy.task('getMails').then((mails) => {
cy.get('#system-message-container').should('contain.text', 'If the email address you entered is registered on this site you will shortly receive an email with a reminder.');

cy.wrap(mails).should('have.lengthOf', 1);
expect(mails.length).to.equal(1);
cy.wrap(mails[0].body).should('have.string', 'A username reminder has been requested');
cy.wrap(mails[0].body).should('have.string', '/test-reminder');
cy.wrap(mails[0].sender).should('equal', Cypress.env('email'));
Expand All @@ -34,7 +34,7 @@ describe('Test in frontend that the users remind view', () => {
cy.task('getMails').then((mails) => {
cy.get('#system-message-container').should('contain.text', 'If the email address you entered is registered on this site you will shortly receive an email with a reminder.');

cy.wrap(mails).should('have.lengthOf', 1);
expect(mails.length).to.equal(1);
cy.wrap(mails[0].body).should('have.string', 'A username reminder has been requested');
cy.wrap(mails[0].body).should('have.string', '/component/users/login');
cy.wrap(mails[0].sender).should('equal', Cypress.env('email'));
Expand All @@ -51,7 +51,7 @@ describe('Test in frontend that the users remind view', () => {
cy.task('getMails').then((mails) => {
cy.get('#system-message-container').should('contain.text', 'If the email address you entered is registered on this site you will shortly receive an email with a reminder.');

cy.wrap(mails).should('have.lengthOf', 0);
expect(mails.length).to.equal(0);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Test in frontend that the users reset view', () => {
cy.task('getMails').then((mails) => {
cy.get('#system-message-container').should('contain.text', 'If the email address you entered is registered on this site you will shortly receive an email with a link to reset the password for your account.');

cy.wrap(mails).should('have.lengthOf', 1);
expect(mails.length).to.equal(1);
cy.wrap(mails[0].body).should('have.string', 'To reset your password, you will need to submit this verification code');
cy.wrap(mails[0].body).should('have.string', '/component/users/reset');
cy.wrap(mails[0].sender).should('equal', Cypress.env('email'));
Expand All @@ -34,7 +34,7 @@ describe('Test in frontend that the users reset view', () => {
cy.task('getMails').then((mails) => {
cy.get('#system-message-container').should('contain.text', 'If the email address you entered is registered on this site you will shortly receive an email with a link to reset the password for your account.');

cy.wrap(mails).should('have.lengthOf', 1);
expect(mails.length).to.equal(1);
cy.wrap(mails[0].body).should('have.string', 'To reset your password, you will need to submit this verification code');
cy.wrap(mails[0].body).should('have.string', '/test-reset');
cy.wrap(mails[0].sender).should('equal', Cypress.env('email'));
Expand All @@ -51,7 +51,7 @@ describe('Test in frontend that the users reset view', () => {
cy.task('getMails').then((mails) => {
cy.get('#system-message-container').should('contain.text', 'If the email address you entered is registered on this site you will shortly receive an email with a link to reset the password for your account.');

cy.wrap(mails).should('have.lengthOf', 0);
expect(mails.length).to.equal(0);
});
});

Expand Down