Sketch cucumber scenarios for blocked user feature

.. first scenario already passing
This commit is contained in:
roschaefer 2019-08-13 17:58:31 +02:00
parent d2a6d8c047
commit fffd29e867
2 changed files with 72 additions and 0 deletions

View File

@ -362,3 +362,31 @@ Then("the notification gets marked as read", () => {
Then("there are no notifications in the top menu", () => {
cy.get(".notifications-menu").should("contain", "0");
});
Given("there is an annoying user called {string}", (name) => {
cy.factory().create('User', { id: 'annoying-user', name })
})
Given("I am on the profile page of the annoying user", (name) => {
cy.openPage('/profile/annoying-user');
})
When("I ", (name) => {
cy.openPage('/profile/annoying-user');
})
When("I click on {string} from the content menu in the user info box", (button) => {
cy.get('.user-content-menu .content-menu-trigger')
.click()
cy.get('.popover .ds-menu-item-link')
.contains(button)
.click()
})
When ("I navigate to my {string} settings page", (settingsPage) => {
cy.get(".avatar-menu").click();
cy.get(".avatar-menu-popover")
.find('a[href]').contains("Settings").click()
cy.contains('.ds-menu-item-link', settingsPage).click()
})

View File

@ -0,0 +1,44 @@
Feature: Block another user
As a user
I'd like to have a button to block another user
To prevent him to see and interact with my contributions and also to avoid to see his/her posts
Background:
Given I have a user account
And there is an annoying user called "Spammy Spammer"
And I am logged in
Scenario: Block a user
Given I am on the profile page of the annoying user
When I click on "Block User" from the content menu in the user info box
And I navigate to my "Blocked users" settings page
Then I can see the following table:
| Avatar | Name |
| | Spammy Spammer |
Scenario Outline: Blocked users cannot see each others posts
Given "Spammy Spammer" wrote a post "Spam Spam Spam"
And I wrote a post "I hate spammers"
And I block the user "Spammy Spammer"
When I log in with <account>
Then I see only one post with the title <expected_title>
Examples:
| accout | expected_title |
| my own account | I hate spammers |
| spammy spammers account | Spam Spam Spam |
Scenario: Block a previously followed user
Given I follow the user "Spammy Spammer"
When I visit the profile page of the annoying user
And I click on "Block User" from the content menu in the user info box
Then the list of posts of this user is empty
And nobody is following the user profile anymore
Scenario: Posts of blocked users are filtered from search results
Given "Spammy Spammer" wrote a post "Spam Spam Spam"
When I search for "Spam"
Then I should see the following posts in the select dropdown:
| title |
| Spam Spam Spam |
But if I block the user "Spammy Spammer"
Then the search has no results