Implement mentioning in cypress test

This commit is contained in:
Robert Schäfer 2019-04-17 21:00:05 +02:00
parent a127239988
commit 408c95a96c
2 changed files with 35 additions and 6 deletions

View File

@ -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', () => {
})

View File

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