mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Admin.PinPost.feature
This commit is contained in:
parent
c782005ee5
commit
ab8e6a005f
43
cypress/integration/Admin.PinPost.feature
Normal file
43
cypress/integration/Admin.PinPost.feature
Normal file
@ -0,0 +1,43 @@
|
||||
Feature: Admin pins a post
|
||||
As an admin
|
||||
I want to pin a post so that it always appears at the top
|
||||
In order to make sure all network users read it
|
||||
e.g. notify people about security incidents, maintenance downtimes
|
||||
|
||||
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 |
|
||||
| admin | admin@example.org | 1234 | admin | Admin-Man | admin | 0.0.4 |
|
||||
Given the following "posts" are in the database:
|
||||
| id | title | pinned | createdAt |
|
||||
| p1 | Some other post | | 2020-01-21 |
|
||||
| p2 | Houston we have a problem | x | 2020-01-20 |
|
||||
| p3 | Yet another post | | 2020-01-19 |
|
||||
|
||||
Scenario: Pinned post always appears on the top of the newsfeed
|
||||
When I am logged in as "user"
|
||||
And I navigate to page "/"
|
||||
Then the first post on the newsfeed has the title:
|
||||
"""
|
||||
Houston we have a problem
|
||||
"""
|
||||
And the post with title "Houston we have a problem" has a ribbon for pinned posts
|
||||
|
||||
Scenario: Ordinary users cannot pin a post
|
||||
When I am logged in as "user"
|
||||
And I navigate to page "/"
|
||||
And I open the content menu of post "Yet another post"
|
||||
Then there is no button to pin a post
|
||||
|
||||
Scenario: Admins are allowed to pin a post
|
||||
When I am logged in as "admin"
|
||||
And I navigate to page "/"
|
||||
And I open the content menu of post "Yet another post"
|
||||
And I click on "pin post"
|
||||
Then I see a toaster with "Post pinned successfully"
|
||||
And the first post on the newsfeed has the title:
|
||||
"""
|
||||
Yet another post
|
||||
"""
|
||||
And the post with title "Yet another post" has a ribbon for pinned posts
|
||||
@ -0,0 +1,7 @@
|
||||
import { When } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
When("I open the content menu of post {string}", (title)=> {
|
||||
cy.contains('.post-teaser', title)
|
||||
.find('.content-menu .base-button')
|
||||
.click()
|
||||
})
|
||||
@ -0,0 +1,6 @@
|
||||
import { Then } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
Then("the first post on the newsfeed has the title:", title => {
|
||||
cy.get(".post-teaser:first")
|
||||
.should("contain", title);
|
||||
});
|
||||
@ -0,0 +1,9 @@
|
||||
import { Then } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
Then("the post with title {string} has a ribbon for pinned posts", (title) => {
|
||||
cy.get(".post-teaser").contains(title)
|
||||
.parent()
|
||||
.parent()
|
||||
.find(".ribbon.--pinned")
|
||||
.should("contain", "Announcement")
|
||||
})
|
||||
@ -0,0 +1,7 @@
|
||||
import { Then } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
Then("there is no button to pin a post", () => {
|
||||
cy.get("a.ds-menu-item-link")
|
||||
.should('contain', "Report Post") // sanity check
|
||||
.should('not.contain', "Pin post")
|
||||
})
|
||||
@ -10,31 +10,11 @@ Then("I click on the {string} button", text => {
|
||||
.click();
|
||||
});
|
||||
|
||||
When("I open the content menu of post {string}", (title)=> {
|
||||
cy.contains('.post-teaser', title)
|
||||
.find('.content-menu .base-button')
|
||||
.click()
|
||||
})
|
||||
|
||||
When("I click on 'Pin post'", (string)=> {
|
||||
cy.get("a.ds-menu-item-link").contains("Pin post")
|
||||
.click()
|
||||
})
|
||||
|
||||
Then("there is no button to pin a post", () => {
|
||||
cy.get("a.ds-menu-item-link")
|
||||
.should('contain', "Report Post") // sanity check
|
||||
.should('not.contain', "Pin post")
|
||||
})
|
||||
|
||||
And("the post with title {string} has a ribbon for pinned posts", (title) => {
|
||||
cy.get(".post-teaser").contains(title)
|
||||
.parent()
|
||||
.parent()
|
||||
.find(".ribbon.--pinned")
|
||||
.should("contain", "Announcement")
|
||||
})
|
||||
|
||||
/* Then('confirm crop', () => {
|
||||
cy.get('.crop-confirm')
|
||||
.click()
|
||||
|
||||
@ -165,10 +165,6 @@ Then(/^I should see only ([0-9]+) posts? on the newsfeed/, postCount => {
|
||||
cy.get(".post-teaser").should("have.length", postCount);
|
||||
});
|
||||
|
||||
Then("the first post on the newsfeed has the title:", title => {
|
||||
cy.get(".post-teaser:first").should("contain", title);
|
||||
});
|
||||
|
||||
Then(
|
||||
"the page {string} returns a 404 error with a message:",
|
||||
(route, message) => {
|
||||
|
||||
@ -9,6 +9,7 @@ When("I click on {string}", element => {
|
||||
'comment button': 'button[type=submit]',
|
||||
'reply button': '.reply-button',
|
||||
'security menu': 'a[href="/settings/security"]',
|
||||
'pin post': '.ds-menu-item:first-child',
|
||||
}
|
||||
|
||||
cy.get(elementSelectors[element])
|
||||
|
||||
@ -10,10 +10,10 @@ Feature: Hide Posts
|
||||
| p2 | This post is disabled | | x |
|
||||
| p3 | This post is deleted | x | |
|
||||
|
||||
Scenario: Disabled posts don't show up on the landing page
|
||||
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 landing page
|
||||
And the first post on the landing page has the title:
|
||||
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
|
||||
"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user