diff --git a/cypress/e2e/Chat.Message.Notification.feature b/cypress/e2e/Chat.Message.Notification.feature index 0603f4faa..50abad1f8 100644 --- a/cypress/e2e/Chat.Message.Notification.feature +++ b/cypress/e2e/Chat.Message.Notification.feature @@ -28,8 +28,8 @@ Feature: Notifications for Chat Messages via E-Mail When I am logged in as "billy-block" And I send a chat message to "Anna Absent" And I log out - # Then "Anna Absent" should receive "1" chat notification email referencing "Chilly Chatter" - # When I am logged in as "anna-absent" + Then "Anna Absent" should receive "1" chat notification email referencing "Chilly Chatter" + When I am logged in as "anna-absent" # And "Chilly Chatter" sends a chat message to "Anna Absent" # And "Michi Mute" sends a chat message to "Anna Absent" # And "Billy Block" sends a chat message to "Anna Absent" diff --git a/cypress/support/step_definitions/email.js b/cypress/support/step_definitions/email.js index a0e51e22a..c4cce478b 100644 --- a/cypress/support/step_definitions/email.js +++ b/cypress/support/step_definitions/email.js @@ -9,6 +9,24 @@ defineStep('the mailserver inbox is empty', () => { .should('equal', 200) }) +defineStep('{string} should receive {string} chat notification email referencing {string}', (recipientName, emailCount, senderName) => { + cy.request('GET', 'http://localhost:1080/email').then( + (response) => { + expect(response.status).to.eq(200) + cy.log(response.body) + console.log + expect(response.body).to.have.length(emailCount) + const email = response.body[0] + expect(email.read).to.be.false + expect(email.subject).to.eq('ocelot.social – Notification: New chat message') + const assertedString = `Hello ${recipientName}` + expect(email.text.toLowerCase()).to.include(assertedString.toLowerCase()) + expect(email.text).to.include(`from ${senderName}`) + expect(email.html).to.include('/chat') + } + ) +}) + defineStep('{string} should receive no chat notification email', (recipientEmailAddress) => { const emailTitle = 'Neue Chat-Nachricht | New chat message'