diff --git a/cypress/integration/common/steps.js b/cypress/integration/common/steps.js index 387273eff..5ff64fb1c 100644 --- a/cypress/integration/common/steps.js +++ b/cypress/integration/common/steps.js @@ -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() +}) diff --git a/cypress/integration/user_profile/BlockedUser.feature b/cypress/integration/user_profile/BlockedUser.feature new file mode 100644 index 000000000..41d88226f --- /dev/null +++ b/cypress/integration/user_profile/BlockedUser.feature @@ -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 + Then I see only one post with the 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