mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Moderator.HidePost.feature
This commit is contained in:
parent
8a3af923c6
commit
d719b0c65c
40
cypress/integration/Moderator.HidePost.feature
Normal file
40
cypress/integration/Moderator.HidePost.feature
Normal file
@ -0,0 +1,40 @@
|
||||
Feature: Hide Posts
|
||||
As a moderator
|
||||
I would like to be able to hide posts from the public
|
||||
to enforce our network's code of conduct and/or legal regulations
|
||||
|
||||
Background:
|
||||
Given the following "users" are in the database:
|
||||
| slug | email | password | id | name | role | termsAndConditionsAgreedVersion |
|
||||
| user | user@example.org | abcd | user | User-Chad | user | 0.0.4 |
|
||||
| moderator | moderator@example.org | 1234 | moderator | Mod-Man | moderator | 0.0.4 |
|
||||
Given the following "posts" are in the database:
|
||||
| id | title | deleted | disabled |
|
||||
| p1 | This post should be visible | | |
|
||||
| p2 | This post is disabled | | x |
|
||||
| p3 | This post is deleted | x | |
|
||||
|
||||
Scenario: Disabled posts don't show up on the newsfeed as user
|
||||
When I am logged in as "user"
|
||||
And I navigate to page "/"
|
||||
Then I should see only 1 posts on the newsfeed
|
||||
And the first post on the newsfeed has the title:
|
||||
"""
|
||||
This post should be visible
|
||||
"""
|
||||
|
||||
Scenario: Disabled posts show up on the newsfeed as moderator
|
||||
When I am logged in as "moderator"
|
||||
And I navigate to page "/"
|
||||
Then I should see only 2 posts on the newsfeed
|
||||
And the first post on the newsfeed has the title:
|
||||
"""
|
||||
This post is disabled
|
||||
"""
|
||||
|
||||
Scenario: Visiting a disabled post's page should return 404
|
||||
Given I am logged in as "user"
|
||||
Then the page "/post/this-post-is-disabled" returns a 404 error with a message:
|
||||
"""
|
||||
This post could not be found
|
||||
"""
|
||||
@ -0,0 +1,7 @@
|
||||
import { Then } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
Then("I should see only {int} posts on the newsfeed", posts => {
|
||||
cy.get(".post-teaser")
|
||||
.should("have.length", posts);
|
||||
});
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
import { Then } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
Then("the page {string} returns a 404 error with a message:", (route, message) => {
|
||||
cy.request({
|
||||
url: route,
|
||||
failOnStatusCode: false
|
||||
})
|
||||
.its("status")
|
||||
.should("eq", 404);
|
||||
cy.visit(route, {
|
||||
failOnStatusCode: false
|
||||
});
|
||||
cy.get(".error-message").should("contain", message);
|
||||
});
|
||||
@ -76,26 +76,6 @@ When("I click on the avatar menu in the top right corner", () => {
|
||||
cy.get(".avatar-menu").click();
|
||||
});
|
||||
|
||||
Then(/^I should see only ([0-9]+) posts? on the newsfeed/, postCount => {
|
||||
cy.get(".post-teaser").should("have.length", postCount);
|
||||
});
|
||||
|
||||
Then(
|
||||
"the page {string} returns a 404 error with a message:",
|
||||
(route, message) => {
|
||||
cy.request({
|
||||
url: route,
|
||||
failOnStatusCode: false
|
||||
})
|
||||
.its("status")
|
||||
.should("eq", 404);
|
||||
cy.visit(route, {
|
||||
failOnStatusCode: false
|
||||
});
|
||||
cy.get(".error-message").should("contain", message);
|
||||
}
|
||||
);
|
||||
|
||||
Given("there is an annoying user called {string}", name => {
|
||||
cy.factory().build("user", {
|
||||
id: "annoying-user",
|
||||
|
||||
@ -11,7 +11,7 @@ Given("the following {string} are in the database:", (table,data) => {
|
||||
pinned: Boolean(entry.pinned),
|
||||
},{
|
||||
...entry,
|
||||
tagIds: entry.tagIds.split(',').map(item => item.trim()),
|
||||
tagIds: entry.tagIds ? entry.tagIds.split(',').map(item => item.trim()) : [],
|
||||
});
|
||||
})
|
||||
break
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
Feature: Hide Posts
|
||||
As the moderator team
|
||||
we'd like to be able to hide posts from the public
|
||||
to enforce our network's code of conduct and/or legal regulations
|
||||
|
||||
Background:
|
||||
Given we have the following posts in our database:
|
||||
| id | title | deleted | disabled |
|
||||
| p1 | This post should be visible | | |
|
||||
| p2 | This post is disabled | | x |
|
||||
| p3 | This post is deleted | x | |
|
||||
|
||||
Scenario: Disabled posts don't show up on the newsfeed
|
||||
Given I am logged in with a "user" role
|
||||
Then I should see only 1 post on the newsfeed
|
||||
And the first post on the newsfeed has the title:
|
||||
"""
|
||||
This post should be visible
|
||||
"""
|
||||
|
||||
Scenario: Visiting a disabled post's page should return 404
|
||||
Given I am logged in with a "user" role
|
||||
Then the page "/post/this-post-is-disabled" returns a 404 error with a message:
|
||||
"""
|
||||
This post could not be found
|
||||
"""
|
||||
Loading…
x
Reference in New Issue
Block a user