mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Sketch cypress test to hide posts from the public
This commit is contained in:
parent
fe99629fe8
commit
370748ce55
@ -151,7 +151,9 @@ When('I press {string}', label => {
|
||||
})
|
||||
|
||||
Given('we have the following posts in our database:', table => {
|
||||
table.hashes().forEach(({ Author, id, title, content }) => {
|
||||
table.hashes().forEach(({ Author, ...postAttributes}) => {
|
||||
postAttributes.deleted = Boolean(postAttributes.deleted)
|
||||
postAttributes.disabled = Boolean(postAttributes.disabled)
|
||||
cy.factory()
|
||||
.create('User', {
|
||||
name: Author,
|
||||
@ -162,7 +164,7 @@ Given('we have the following posts in our database:', table => {
|
||||
email: `${Author}@example.org`,
|
||||
password: '1234'
|
||||
})
|
||||
.create('Post', { id, title, content })
|
||||
.create('Post', postAttributes)
|
||||
})
|
||||
})
|
||||
|
||||
@ -212,3 +214,15 @@ Then('the post was saved successfully', () => {
|
||||
cy.get('.ds-card-header > .ds-heading').should('contain', lastPost.title)
|
||||
cy.get('.content').should('contain', lastPost.content)
|
||||
})
|
||||
|
||||
Then(/^I should see only ([0-9]+) posts? on the landing page/, (postCount) => {
|
||||
cy.get('.post-card').should('have.length', postCount)
|
||||
})
|
||||
|
||||
Then('the first post on the landing page has the title:', (title) => {
|
||||
cy.get('.post-card:first').should('contain', title)
|
||||
})
|
||||
|
||||
Then('I see a 404 error with the following message:', (message) => {
|
||||
cy.get('.error').should('contain', message)
|
||||
})
|
||||
|
||||
27
cypress/integration/moderation/HidePosts.feature
Normal file
27
cypress/integration/moderation/HidePosts.feature
Normal file
@ -0,0 +1,27 @@
|
||||
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:
|
||||
| title | deleted | disabled |
|
||||
| This post should be visible | | |
|
||||
| This post is disabled | | x |
|
||||
| This post is deleted | x | |
|
||||
|
||||
Scenario: Disabled posts don't show up on the landing page
|
||||
Given I am logged in with a "user" role
|
||||
Then I should see only 1 post on the landing page
|
||||
And the first post on the landing page 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
|
||||
When I visit the "/post/this-post-is-disabled" page
|
||||
Then I see a 404 error with the following message:
|
||||
"""
|
||||
We cannot find that post :(
|
||||
"""
|
||||
Loading…
x
Reference in New Issue
Block a user