User.Mute.feature

This commit is contained in:
Ulf Gebhardt 2021-04-12 01:04:32 +02:00
parent ec6a1f1e4e
commit c6bca8d9fb
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD
14 changed files with 67 additions and 67 deletions

View File

@ -37,7 +37,7 @@ Feature: User - block an user
And I "should" see "Unblock user" from the content menu in the user info box And I "should" see "Unblock user" from the content menu in the user info box
Scenario: Posts of blocked users are not filtered from search results Scenario: Posts of blocked users are not filtered from search results
Given "Harassing User" wrote a post "You can still see my posts" Given "harassing-user" wrote a post "You can still see my posts"
And I block the user "Harassing User" And I block the user "Harassing User"
When I search for "see" When I search for "see"
Then I should see the following posts in the select dropdown: Then I should see the following posts in the select dropdown:

View File

@ -2,39 +2,43 @@ Feature: Mute a User
As a user As a user
I'd like to have a button to mute another user I'd like to have a button to mute another user
To prevent him from seeing and interacting with my contributions To prevent him from seeing and interacting with my contributions
Background: Background:
Given I have a user account Given the following "users" are in the database:
And there is an annoying user called "Spammy Spammer" | email | password | id | name | slug | termsAndConditionsAgreedVersion |
And I am logged in | peterpan@example.org | 123 | id-of-peter-pan | Peter Pan | peter-pan | 0.0.4 |
| user@example.org | 123 | annoying-user | Annoying User | annoying-user | 0.0.4 |
Given the following "posts" are in the database:
| id | title | content | authorId |
| im-not-muted | Post that should be seen | cause I'm not muted | id-of-peter-pan |
| bWBjpkTKZp | previously created post | previously-created-post | id-of-peter-pan |
And I am logged in as "peter-pan"
Scenario: Mute a user Scenario: Mute a user
Given I am on the profile page of the annoying user Given I navigate to page "/profile/annoying-user"
When I click on "Mute user" from the content menu in the user info box When I click on "Mute user" from the content menu in the user info box
And I navigate to my "Muted users" settings page And I navigate to my "Muted users" settings page
Then I can see the following table: Then I can see the following table:
| Avatar | Name | | Avatar | Name |
| | Spammy Spammer | | | Annoying User |
Scenario: Mute a previously followed user Scenario: Mute a previously followed user
Given I follow the user "Spammy Spammer" Given I follow the user "Annoying User"
And "Spammy Spammer" wrote a post "Spam Spam Spam" And "annoying-user" wrote a post "Spam Spam Spam"
When I visit the profile page of the annoying user When I navigate to page "/profile/annoying-user"
And I click on "Mute user" from the content menu in the user info box And I click on "Mute user" from the content menu in the user info box
Then the list of posts of this user is empty Then the list of posts of this user is empty
And I get removed from his follower collection And I get removed from his follower collection
Scenario: Posts of muted users are filtered from search results, users are not Scenario: Posts of muted users are filtered from search results, users are not
Given we have the following posts in our database: Given "annoying-user" wrote a post "Spam Spam Spam"
| id | title | content |
| im-not-muted | Post that should be seen | cause I'm not muted |
Given "Spammy Spammer" wrote a post "Spam Spam Spam"
When I search for "Spam" When I search for "Spam"
Then I should see the following posts in the select dropdown: Then I should see the following posts in the select dropdown:
| title | | title |
| Spam Spam Spam | | Spam Spam Spam |
When I mute the user "Spammy Spammer" When I mute the user "Annoying User"
And I refresh the page And I refresh the page
And I search for "Spam" And I search for "Anno"
Then the search should not contain posts by the annoying user Then the search should not contain posts by the annoying user
But the search should contain the annoying user But the search should contain the annoying user
But I search for "not muted" But I search for "not muted"
@ -43,9 +47,10 @@ Feature: Mute a User
| Post that should be seen | | Post that should be seen |
Scenario: Muted users can still see my posts Scenario: Muted users can still see my posts
Given I previously created a post And I mute the user "Annoying User"
And I mute the user "Spammy Spammer" And I am logged in as "annoying-user"
And the "muted" user searches for "previously created" And I navigate to page "/"
And I search for "previously created"
Then I should see the following posts in the select dropdown: Then I should see the following posts in the select dropdown:
| title | | title |
| previously created post | | previously created post |

View File

@ -0,0 +1,13 @@
import { When } from "cypress-cucumber-preprocessor/steps";
When("I mute the user {string}", name => {
cy.neode()
.first("User", { name })
.then(mutedUser => {
cy.neode()
.first("User", {
name: "Peter Pan"
})
.relateTo(mutedUser, "muted");
});
});

View File

@ -0,0 +1,6 @@
import { Then } from "cypress-cucumber-preprocessor/steps";
Then("the list of posts of this user is empty", () => {
cy.get(".base-card").not(".post-link");
cy.get(".main-container").find(".ds-space.hc-empty");
});

View File

@ -0,0 +1,13 @@
import { Then } from "cypress-cucumber-preprocessor/steps";
Then("the search should contain the annoying user", () => {
cy.get(".searchable-input .ds-select-dropdown")
.should($li => {
expect($li).to.have.length(1);
})
cy.get(".ds-select-dropdown .user-teaser .slug")
.should("contain", '@annoying-user');
cy.get(".searchable-input .ds-select input")
.focus()
.type("{esc}");
})

View File

@ -0,0 +1,10 @@
import { Then } from "cypress-cucumber-preprocessor/steps";
Then("the search should not contain posts by the annoying user", () => {
cy.get(".searchable-input .ds-select-dropdown").should($li => {
expect($li).to.have.length(1);
})
cy.get(".ds-select-dropdown")
.should("not.have.class", '.search-post')
.should("not.contain", 'Spam')
});

View File

@ -1,20 +0,0 @@
import { When, Then } from "cypress-cucumber-preprocessor/steps";
Then("the search should not contain posts by the annoying user", () => {
cy.get(".searchable-input .ds-select-dropdown").should($li => {
expect($li).to.have.length(1);
})
cy.get(".ds-select-dropdown")
.should("not.have.class", '.search-post')
.should("not.contain", 'Spam')
});
Then("the search should contain the annoying user", () => {
cy.get(".searchable-input .ds-select-dropdown").should($li => {
expect($li).to.have.length(1);
})
cy.get(".ds-select-dropdown .user-teaser .slug").should("contain", '@spammy-spammer');
cy.get(".searchable-input .ds-select input")
.focus()
.type("{esc}");
})

View File

@ -66,19 +66,6 @@ Given("there is an annoying user who has muted me", () => {
}); });
}); });
Given("I am on the profile page of the annoying user", name => {
cy.openPage("profile/annoying-user/spammy-spammer");
});
When("I ", name => {
cy.openPage("profile/annoying-user");
});
Then("the list of posts of this user is empty", () => {
cy.get(".base-card").not(".post-link");
cy.get(".main-container").find(".ds-space.hc-empty");
});
Given("I wrote a post {string}", title => { Given("I wrote a post {string}", title => {
cy.factory() cy.factory()
.build("post", { .build("post", {
@ -88,20 +75,6 @@ Given("I wrote a post {string}", title => {
}); });
}); });
When("I mute the user {string}", name => {
cy.neode()
.first("User", {
name
})
.then(mutedUser => {
cy.neode()
.first("User", {
name: narratorParams.name
})
.relateTo(mutedUser, "muted");
});
});
Then("I see only one post with the title {string}", title => { Then("I see only one post with the title {string}", title => {
cy.get(".main-container") cy.get(".main-container")
.find(".post-link") .find(".post-link")

View File

@ -1,10 +1,10 @@
import { Given } from "cypress-cucumber-preprocessor/steps"; import { Given } from "cypress-cucumber-preprocessor/steps";
Given('{string} wrote a post {string}', (_, title) => { Given('{string} wrote a post {string}', (author, title) => {
cy.factory() cy.factory()
.build("post", { .build("post", {
title, title,
}, { }, {
authorId: 'harassing-user', authorId: author,
}); });
}); });