e2e: add email check step to chat notification test

This commit is contained in:
mahula 2025-05-08 23:41:56 +02:00
parent ad1ee8b739
commit df6ea0e1f4
2 changed files with 20 additions and 2 deletions

View File

@ -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"

View File

@ -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'