All cucumbers implemented

This commit is contained in:
roschaefer 2019-08-13 19:46:01 +02:00
parent b017203c64
commit 073185d424
6 changed files with 92 additions and 46 deletions

View File

@ -11,6 +11,13 @@ Then("I should have one post in the select dropdown", () => {
});
});
Then("the search has no results", () => {
cy.get(".input .ds-select-dropdown").should($li => {
expect($li).to.have.length(1);
});
cy.get(".ds-select-dropdown").should("contain", 'Nothing found');
});
Then("I should see the following posts in the select dropdown:", table => {
table.hashes().forEach(({ title }) => {
cy.get(".ds-select-dropdown").should("contain", title);

View File

@ -376,7 +376,7 @@ Given("there is an annoying user called {string}", (name) => {
})
Given("I am on the profile page of the annoying user", (name) => {
cy.openPage('/profile/annoying-user');
cy.openPage('/profile/annoying-user/spammy-spammer');
})
When("I visit the profile page of the annoying user", (name) => {
@ -429,3 +429,29 @@ Then("nobody is following the user profile anymore", () => {
cy.get('.ds-card-content').not('.post-link')
cy.get('.main-container').contains('.ds-card-content', 'is not followed by anyone')
})
Given("I wrote a post {string}", (title) => {
cy.factory()
.authenticateAs(loginCredentials)
.create("Post", { title })
})
When("I block the user {string}", (name) => {
cy.neode()
.first('User', { name }).then((blocked) => {
cy.neode()
.first('User', {name: narratorParams.name})
.relateTo(blocked, 'blocked')
})
})
When("I log in with:", (table) => {
const [firstRow] = table.hashes()
const { Email, Password } = firstRow
cy.login({email: Email, password: Password})
})
Then("I see only one post with the title {string}", (title) => {
cy.get('.main-container').find('.post-link').should('have.length', 1)
cy.get('.main-container').contains('.post-link', title)
})

View File

@ -1,44 +0,0 @@
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

View File

@ -0,0 +1,36 @@
Feature: Block a 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: Block a previously followed user
Given I follow the user "Spammy Spammer"
And "Spammy Spammer" wrote a post "Spam Spam Spam"
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 |
When I block the user "Spammy Spammer"
And I refresh the page
And I search for "Spam"
Then the search has no results

View File

@ -0,0 +1,22 @@
Feature: Block a 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"
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:
| Email | Password |
| <email> | <password> |
Then I see only one post with the title "<expected_title>"
Examples:
| email | password | expected_title |
| peterpan@example.org | 1234 | I hate spammers |
| spammy-spammer@example.org | 1234 | Spam Spam Spam |

View File

@ -23,7 +23,6 @@ Cypress.Commands.add(
'first',
{ prevSubject: true },
async (neode, model, properties) => {
console.log(neode)
return neode.first(model, properties)
}
)