mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Moderation.ReportContent.feature
This commit is contained in:
parent
c6bca8d9fb
commit
af6f45a399
@ -8,51 +8,47 @@ Feature: Report and Moderate
|
||||
So I can look into it and decide what to do
|
||||
|
||||
Background:
|
||||
Given we have the following user accounts:
|
||||
| id | name |
|
||||
| u67 | David Irving |
|
||||
| annoying-user | I'm gonna mute Moderators and Admins HA HA HA |
|
||||
|
||||
Given we have the following posts in our database:
|
||||
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 |
|
||||
| annoying | annoying@example.org | 1234 | annoying-user | I'm gonna mute Moderators and Admins HA HA HA | user | 0.0.4 |
|
||||
And the following "posts" are in the database:
|
||||
| authorId | id | title | content |
|
||||
| u67 | p1 | The Truth about the Holocaust | It never existed! |
|
||||
| annoying-user | p1 | The Truth about the Holocaust | It never existed! |
|
||||
| annoying-user | p2 | Fake news | This content is demonstratably infactual in some way |
|
||||
|
||||
Scenario Outline: Report a post from various pages
|
||||
Given I am logged in with a "user" role
|
||||
When I see David Irving's post on the <Page>
|
||||
When I am logged in as "user"
|
||||
And I navigate to page "<Page>"
|
||||
And I click on "Report Post" from the content menu of the post
|
||||
And I confirm the reporting dialog because it is a criminal act under German law:
|
||||
"""
|
||||
Do you really want to report the contribution "The Truth about the Holocaust"?
|
||||
"""
|
||||
Then I see a success message:
|
||||
"""
|
||||
Thanks for reporting!
|
||||
"""
|
||||
Then I see a toaster with "Thanks for reporting!"
|
||||
Examples:
|
||||
| Page |
|
||||
| newsfeed page|
|
||||
| post page |
|
||||
| Page |
|
||||
| / |
|
||||
| /post/p1 |
|
||||
|
||||
Scenario: Report user
|
||||
Given I am logged in with a "user" role
|
||||
And I see David Irving's post on the post page
|
||||
Given I am logged in as "user"
|
||||
And I navigate to page "/post/the-truth-about-the-holocaust"
|
||||
When I click on the author
|
||||
And I click on "Report User" from the content menu in the user info box
|
||||
And I confirm the reporting dialog because he is a holocaust denier:
|
||||
"""
|
||||
Do you really want to report the user "David Irving"?
|
||||
"""
|
||||
Then I see a success message:
|
||||
"""
|
||||
Thanks for reporting!
|
||||
Do you really want to report the user "I'm gonna mute Moderators and …"?
|
||||
"""
|
||||
Then I see a toaster with "Thanks for reporting!"
|
||||
|
||||
Scenario: Review reported content
|
||||
Given somebody reported the following posts:
|
||||
| submitterEmail | resourceId | reasonCategory | reasonDescription |
|
||||
| p1.submitter@example.org | p1 | discrimination_etc | Offensive content |
|
||||
And I am logged in with a "moderator" role
|
||||
And I am logged in as "moderator"
|
||||
And I navigate to page "/"
|
||||
When I click on the avatar menu in the top right corner
|
||||
And I click on "Moderation"
|
||||
Then I see all the reported posts including the one from above
|
||||
@ -62,7 +58,8 @@ Feature: Report and Moderate
|
||||
Given somebody reported the following posts:
|
||||
| submitterEmail | resourceId | reasonCategory | reasonDescription |
|
||||
| p2.submitter@example.org | p2 | other | Offensive content |
|
||||
And I am logged in with a "moderator" role
|
||||
And I am logged in as "moderator"
|
||||
And I navigate to page "/"
|
||||
And there is an annoying user who has muted me
|
||||
When I click on the avatar menu in the top right corner
|
||||
And I click on "Moderation"
|
||||
@ -70,6 +67,7 @@ Feature: Report and Moderate
|
||||
And I can visit the post page
|
||||
|
||||
Scenario: Normal user can't see the moderation page
|
||||
Given I am logged in with a "user" role
|
||||
Given I am logged in as "user"
|
||||
And I navigate to page "/"
|
||||
When I click on the avatar menu in the top right corner
|
||||
Then I can't see the moderation menu item
|
||||
@ -0,0 +1,11 @@
|
||||
import { Then } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
Then(`I can't see the moderation menu item`, () => {
|
||||
cy.get('.avatar-menu-popover')
|
||||
.find('a[href="/settings"]', 'Settings')
|
||||
.should('exist') // OK, the dropdown is actually open
|
||||
|
||||
cy.get('.avatar-menu-popover')
|
||||
.find('a[href="/moderation"]', 'Moderation')
|
||||
.should('not.exist')
|
||||
})
|
||||
@ -0,0 +1,7 @@
|
||||
import { Then } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
Then('I can visit the post page', () => {
|
||||
cy.contains('Fake news').click()
|
||||
cy.location('pathname').should('contain', '/post')
|
||||
.get('.base-card .title').should('contain', 'Fake news')
|
||||
})
|
||||
@ -0,0 +1,11 @@
|
||||
import { When } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
When('I click on "Report Post" from the content menu of the post', () => {
|
||||
cy.contains('.base-card', 'The Truth about the Holocaust')
|
||||
.find('.content-menu .base-button')
|
||||
.click({force: true})
|
||||
|
||||
cy.get('.popover .ds-menu-item-link')
|
||||
.contains('Report Post')
|
||||
.click()
|
||||
})
|
||||
@ -0,0 +1,7 @@
|
||||
import { When } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
When('I click on the author', () => {
|
||||
cy.get('.user-teaser')
|
||||
.click()
|
||||
.url().should('include', '/profile/')
|
||||
})
|
||||
@ -0,0 +1,5 @@
|
||||
import { When } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
When("I click on the avatar menu in the top right corner", () => {
|
||||
cy.get(".avatar-menu").click();
|
||||
});
|
||||
@ -0,0 +1,16 @@
|
||||
import { When } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
When(/^I confirm the reporting dialog .*:$/, message => {
|
||||
cy.contains(message) // wait for element to become visible
|
||||
cy.get('.ds-modal')
|
||||
.within(() => {
|
||||
cy.get('.ds-radio-option-label')
|
||||
.first()
|
||||
.click({
|
||||
force: true
|
||||
})
|
||||
cy.get('button')
|
||||
.contains('Report')
|
||||
.click()
|
||||
})
|
||||
})
|
||||
@ -0,0 +1,7 @@
|
||||
import { Then } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
Then('I see all the reported posts including from the user who muted me', () => {
|
||||
cy.get('table tbody').within(() => {
|
||||
cy.contains('tr', 'Fake news')
|
||||
})
|
||||
})
|
||||
@ -0,0 +1,7 @@
|
||||
import { Then } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
Then('I see all the reported posts including the one from above', () => {
|
||||
cy.get('table tbody').within(() => {
|
||||
cy.contains('tr', 'The Truth about the Holocaust')
|
||||
})
|
||||
})
|
||||
@ -0,0 +1,6 @@
|
||||
import { Then } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
Then('each list item links to the post page', () => {
|
||||
cy.contains('The Truth about the Holocaust').click();
|
||||
cy.location('pathname').should('contain', '/post')
|
||||
})
|
||||
@ -0,0 +1,23 @@
|
||||
import { Given } from "cypress-cucumber-preprocessor/steps";
|
||||
import { gql } from '../../../backend/src/helpers/jest'
|
||||
|
||||
Given('somebody reported the following posts:', table => {
|
||||
table.hashes().forEach(({ submitterEmail, resourceId, reasonCategory, reasonDescription }) => {
|
||||
const submitter = {
|
||||
email: submitterEmail,
|
||||
password: '1234'
|
||||
}
|
||||
cy.factory()
|
||||
.build('user', {}, submitter)
|
||||
.authenticateAs(submitter)
|
||||
.mutate(gql`mutation($resourceId: ID!, $reasonCategory: ReasonCategory!, $reasonDescription: String!) {
|
||||
fileReport(resourceId: $resourceId, reasonCategory: $reasonCategory, reasonDescription: $reasonDescription) {
|
||||
reportId
|
||||
}
|
||||
}`, {
|
||||
resourceId,
|
||||
reasonCategory,
|
||||
reasonDescription
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -0,0 +1,13 @@
|
||||
Given("there is an annoying user who has muted me", () => {
|
||||
cy.neode()
|
||||
.first("User", {
|
||||
role: 'moderator'
|
||||
})
|
||||
.then(mutedUser => {
|
||||
cy.neode()
|
||||
.first("User", {
|
||||
id: 'user'
|
||||
})
|
||||
.relateTo(mutedUser, "muted");
|
||||
});
|
||||
});
|
||||
@ -1,6 +1,5 @@
|
||||
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
|
||||
import { VERSION } from '../../constants/terms-and-conditions-version.js'
|
||||
import { gql } from '../../../backend/src/helpers/jest'
|
||||
|
||||
/* global cy */
|
||||
|
||||
@ -24,11 +23,6 @@ Given("I see David Irving's post on the newsfeed", page => {
|
||||
cy.openPage('newsfeed')
|
||||
})
|
||||
|
||||
Given("I see David Irving's post on the post page", page => {
|
||||
cy.visit(`/post/${davidIrvingPostSlug}`)
|
||||
cy.contains(davidIrvingPostTitle) // wait
|
||||
})
|
||||
|
||||
Given('I am logged in with a {string} role', role => {
|
||||
cy.factory().build('user', {
|
||||
termsAndConditionsAgreedVersion: VERSION,
|
||||
@ -50,16 +44,6 @@ Given('I am logged in with a {string} role', role => {
|
||||
.then(user => cy.login(user))
|
||||
})
|
||||
|
||||
When('I click on "Report Post" from the content menu of the post', () => {
|
||||
cy.contains('.base-card', davidIrvingPostTitle)
|
||||
.find('.content-menu .base-button')
|
||||
.click({force: true})
|
||||
|
||||
cy.get('.popover .ds-menu-item-link')
|
||||
.contains('Report Post')
|
||||
.click()
|
||||
})
|
||||
|
||||
When('I click on "Report User" from the content menu in the user info box', () => {
|
||||
cy.contains('.base-card', davidIrvingPostTitle)
|
||||
.get('.user-content-menu .base-button')
|
||||
@ -70,12 +54,6 @@ When('I click on "Report User" from the content menu in the user info box', () =
|
||||
.click()
|
||||
})
|
||||
|
||||
When('I click on the author', () => {
|
||||
cy.get('.user-teaser')
|
||||
.click()
|
||||
.url().should('include', '/profile/')
|
||||
})
|
||||
|
||||
When('I report the author', () => {
|
||||
cy.get('.page-name-profile-id-slug').then(() => {
|
||||
invokeReportOnElement('.base-card').then(() => {
|
||||
@ -104,74 +82,6 @@ Then('I see my reported user', () => {
|
||||
})
|
||||
})
|
||||
|
||||
Then(`I can't see the moderation menu item`, () => {
|
||||
cy.get('.avatar-menu-popover')
|
||||
.find('a[href="/settings"]', 'Settings')
|
||||
.should('exist') // OK, the dropdown is actually open
|
||||
|
||||
cy.get('.avatar-menu-popover')
|
||||
.find('a[href="/moderation"]', 'Moderation')
|
||||
.should('not.exist')
|
||||
})
|
||||
|
||||
When(/^I confirm the reporting dialog .*:$/, message => {
|
||||
cy.contains(message) // wait for element to become visible
|
||||
cy.get('.ds-modal').within(() => {
|
||||
cy.get('.ds-radio-option-label')
|
||||
.first()
|
||||
.click({
|
||||
force: true
|
||||
})
|
||||
cy.get('button')
|
||||
.contains('Report')
|
||||
.click()
|
||||
})
|
||||
})
|
||||
|
||||
Given('somebody reported the following posts:', table => {
|
||||
table.hashes().forEach(({ submitterEmail, resourceId, reasonCategory, reasonDescription }) => {
|
||||
const submitter = {
|
||||
email: submitterEmail,
|
||||
password: '1234'
|
||||
}
|
||||
cy.factory()
|
||||
.build('user', {}, submitter)
|
||||
.authenticateAs(submitter)
|
||||
.mutate(gql`mutation($resourceId: ID!, $reasonCategory: ReasonCategory!, $reasonDescription: String!) {
|
||||
fileReport(resourceId: $resourceId, reasonCategory: $reasonCategory, reasonDescription: $reasonDescription) {
|
||||
reportId
|
||||
}
|
||||
}`, {
|
||||
resourceId,
|
||||
reasonCategory,
|
||||
reasonDescription
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Then('I see all the reported posts including the one from above', () => {
|
||||
cy.get('table tbody').within(() => {
|
||||
cy.contains('tr', davidIrvingPostTitle)
|
||||
})
|
||||
})
|
||||
|
||||
Then('I see all the reported posts including from the user who muted me', () => {
|
||||
cy.get('table tbody').within(() => {
|
||||
cy.contains('tr', annoyingUserWhoMutedModeratorTitle)
|
||||
})
|
||||
})
|
||||
|
||||
Then('each list item links to the post page', () => {
|
||||
cy.contains(davidIrvingPostTitle).click()
|
||||
cy.location('pathname').should('contain', '/post')
|
||||
})
|
||||
|
||||
Then('I can visit the post page', () => {
|
||||
cy.contains(annoyingUserWhoMutedModeratorTitle).click()
|
||||
cy.location('pathname').should('contain', '/post')
|
||||
.get('.base-card .title').should('contain', annoyingUserWhoMutedModeratorTitle)
|
||||
})
|
||||
|
||||
When("they have a post someone has reported", () => {
|
||||
cy.factory()
|
||||
.build("post", {
|
||||
|
||||
@ -40,10 +40,6 @@ Given("we have the following posts in our database:", table => {
|
||||
})
|
||||
})
|
||||
|
||||
When("I click on the avatar menu in the top right corner", () => {
|
||||
cy.get(".avatar-menu").click();
|
||||
});
|
||||
|
||||
Given("there is an annoying user called {string}", name => {
|
||||
cy.factory().build("user", {
|
||||
id: "annoying-user",
|
||||
@ -52,20 +48,6 @@ Given("there is an annoying user called {string}", name => {
|
||||
}, annoyingParams);
|
||||
});
|
||||
|
||||
Given("there is an annoying user who has muted me", () => {
|
||||
cy.neode()
|
||||
.first("User", {
|
||||
role: 'moderator'
|
||||
})
|
||||
.then(mutedUser => {
|
||||
cy.neode()
|
||||
.first("User", {
|
||||
id: 'annoying-user'
|
||||
})
|
||||
.relateTo(mutedUser, "muted");
|
||||
});
|
||||
});
|
||||
|
||||
Given("I wrote a post {string}", title => {
|
||||
cy.factory()
|
||||
.build("post", {
|
||||
|
||||
@ -10,6 +10,7 @@ When("I click on {string}", element => {
|
||||
'reply button': '.reply-button',
|
||||
'security menu': 'a[href="/settings/security"]',
|
||||
'pin post': '.ds-menu-item:first-child',
|
||||
'Moderation': 'a[href="/moderation"]',
|
||||
}
|
||||
|
||||
cy.get(elementSelectors[element])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user