Mike Aono d49afc25cf test(cypress): Cover "Pinned post" feature
* Implement cypress tests

- Start implementation of cypress tests for pinned posts

* Test that Admin can pin a post

- Tests the process of an admin pinning a post

* Resolve failing tests

- Fix ordering of posts immediately after pinning posts by reloading page
- Check that tests are pinned posts are displayed first for role user

* Refactor to seperate the initialization

- Of the post data created in the database during setup

* Fix toaster test

* test(cypress): Add missing parts for pin feature

* docs(cucumber): Link to admin 🥒 folder

* Follow @mattwr18's suggestions

* test(backend): Order pinned posts like frontend

@mattwr18 I think this was a false negative.

Co-authored-by: Robert Schäfer <git@roschaefer.de>
2020-01-23 20:30:12 +01:00

37 lines
1.4 KiB
Gherkin

Feature: Pin a post
As an admin
I want to pin a post so that it always appears at the top
In order to make sure all network users read it - e.g. notify people about security incidents, maintenance downtimes
Background:
Given we have the following posts in our database:
| id | title | pinned | createdAt |
| p1 | Some other post | | 2020-01-21 |
| p2 | Houston we have a problem | x | 2020-01-20 |
| p3 | Yet another post | | 2020-01-19 |
Scenario: Pinned post always appears on the top of the newsfeed
Given I am logged in with a "user" role
Then the first post on the landing page has the title:
"""
Houston we have a problem
"""
And the post with title "Houston we have a problem" has a ribbon for pinned posts
Scenario: Ordinary users cannot pin a post
Given I am logged in with a "user" role
When I open the content menu of post "Yet another post"
Then there is no button to pin a post
Scenario: Admins are allowed to pin a post
Given I am logged in with a "admin" role
And I open the content menu of post "Yet another post"
When I click on 'Pin post'
Then I see a toaster with "Post pinned successfully"
And the first post on the landing page has the title:
"""
Yet another post
"""
And the post with title "Yet another post" has a ribbon for pinned posts