diff --git a/cypress/integration/common/steps.js b/cypress/integration/common/steps.js index 5bd07583b..42932619a 100644 --- a/cypress/integration/common/steps.js +++ b/cypress/integration/common/steps.js @@ -313,3 +313,21 @@ Then('I get to the post page of {string}', path => { cy.url().should('contain', '/post/') cy.url().should('contain', path) }) + +When('I start to write a new post with the title {string} beginning with:', (title, intro) => { + cy.get('.post-add-button').click() + cy.get('input[name="title"]').type(title) + cy.get('.ProseMirror').type(intro) +}) + +When('mention {string} in the text', (mention) => { + cy.get('.ProseMirror').type(' @') + cy.get('.suggestion-list__item').contains(mention).click() + cy.debug() +}) + +Then('the notification gets marked as read', () => { +}) + +Then('there are no notifications in the top menu', () => { +}) diff --git a/cypress/integration/notifications/Mentions.feature b/cypress/integration/notifications/Mentions.feature index ae67111fd..28f7cf456 100644 --- a/cypress/integration/notifications/Mentions.feature +++ b/cypress/integration/notifications/Mentions.feature @@ -7,14 +7,25 @@ Feature: Notifications for a mentions Given we have the following user accounts: | name | slug | email | password | | Wolle aus Hamburg | wolle-aus-hamburg | wolle@example.org | 1234 | - And we have the following posts in our database: - | id | title | content | - | p1 | Hey Wolle | Hey @wolle-aus-hamburg, how do you do? | + | Matt Rider | matt-rider | matt@example.org | 4321 | - Scenario: - When I log in with the following credentials: + Scenario: Mention another user, re-login as this user and see notifications + Given I log in with the following credentials: | email | password | | wolle@example.org | 1234 | + And I start to write a new post with the title "Hey Matt" beginning with: + """ + Big shout to our fellow contributor + """ + And mention "@matt-rider" in the text + And I click on "Save" + When I log out + And I log in with the following credentials: + | email | password | + | matt@example.org | 4321 | And see 1 unread notifications in the top menu And open the notification menu and click on the first item - Then I get to the post page of ".../hey-wolle" + Then I get to the post page of ".../hey-matt" + And the notification gets marked as read + But when I refresh the page + Then there are no notifications in the top menu