mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Report feature uses factories
This commit is contained in:
parent
cec78c1954
commit
cf898d5417
@ -9,8 +9,8 @@ Feature: Report and Moderate
|
||||
|
||||
Background:
|
||||
Given we have the following posts in our database:
|
||||
| Author | title | content |
|
||||
| David Irving | The Truth about the Holocaust | It never existed! |
|
||||
| Author | id | title | content |
|
||||
| David Irving | p1 | The Truth about the Holocaust | It never existed! |
|
||||
|
||||
Scenario Outline: Report a post from various pages
|
||||
Given I am logged in with a "user" role
|
||||
@ -45,8 +45,8 @@ Feature: Report and Moderate
|
||||
|
||||
Scenario: Review reported content
|
||||
Given somebody reported the following posts:
|
||||
| Slug |
|
||||
| the-truth-about-the-holocaust |
|
||||
| id |
|
||||
| p1 |
|
||||
And I am logged in with a "moderator" role
|
||||
When I click on the avatar menu in the top right corner
|
||||
And I click on "Moderation"
|
||||
|
||||
@ -125,27 +125,17 @@ When(/^I confirm the reporting dialog .*:$/, () => {
|
||||
})
|
||||
|
||||
Given('somebody reported the following posts:', table => {
|
||||
table.hashes().forEach(({ slug }, index) => {
|
||||
const author = {
|
||||
id: `author${index}`,
|
||||
email: `author${index}@example.org`,
|
||||
password: '1234'
|
||||
}
|
||||
table.hashes().forEach(({ id }) => {
|
||||
const reporter = {
|
||||
id: `reporter${index}`,
|
||||
email: `reporter${index}@example.org`,
|
||||
email: `reporter${id}@example.org`,
|
||||
password: '1234'
|
||||
}
|
||||
cy.factory()
|
||||
.create('user', author)
|
||||
.authenticateAs(author)
|
||||
.create('post', { id: `p${index}` })
|
||||
cy.factory()
|
||||
.create('user', reporter)
|
||||
.authenticateAs(reporter)
|
||||
.create('report', {
|
||||
description: "I don't like this post",
|
||||
resource: { id: `p${index}`, type: 'post' }
|
||||
resource: { id, type: 'contribution' }
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -139,7 +139,7 @@ When('I press {string}', label => {
|
||||
})
|
||||
|
||||
Given('we have the following posts in our database:', table => {
|
||||
table.hashes().forEach(({ Author, title, content }) => {
|
||||
table.hashes().forEach(({ Author, id, title, content }) => {
|
||||
cy.factory()
|
||||
.create('user', {
|
||||
name: Author,
|
||||
@ -150,7 +150,7 @@ Given('we have the following posts in our database:', table => {
|
||||
email: `${Author}@example.org`,
|
||||
password: '1234'
|
||||
})
|
||||
.create('post', { title, content })
|
||||
.create('post', { id, title, content })
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user