Added user report test (broken for no reason)

This commit is contained in:
Grzegorz Leoniec 2019-01-17 22:41:48 +01:00
parent a87c9e4f4a
commit cd40879c6e
No known key found for this signature in database
GPG Key ID: 3AA43686D4EB1377
2 changed files with 34 additions and 3 deletions

View File

@ -30,5 +30,14 @@ Feature: Report content
And I visit the "moderation" page
Then I see my reported post
Scenario: Report user
Given I am logged in as "admin"
And I am viewing a post
When I click on the author
And I report the author
And I visit the "moderation" page
Then I see my reported user
#Scenario: Normal user can't see the moderation page
#Given I am logged in as "user"

View File

@ -2,7 +2,7 @@ import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
/* global cy */
let lastPostTitle
let lastReportTitle
const savePostTitle = $post => {
return $post
@ -11,7 +11,7 @@ const savePostTitle = $post => {
.first()
.invoke('text')
.then(title => {
lastPostTitle = title
lastReportTitle = title
})
}
const invokeReportOnElement = selector => {
@ -56,6 +56,23 @@ When('I click on a Post menu and select the report option', () => {
invokeReportOnElement('.post-card')
})
When('I click on the author', () => {
cy.get('a.author')
.first()
.click()
.wait(200)
})
When('I report the author', () => {
cy.get('.page-name-profile-slug').then(() => {
invokeReportOnElement('.ds-card').then(() => {
cy.get('button')
.contains('Send')
.click()
})
})
})
When('I click on send in the confirmation dialog', () => {
cy.get('button')
.contains('Send')
@ -68,6 +85,11 @@ Then('I get a success message', () => {
Then('I see my reported post', () => {
cy.get('table').then(() => {
cy.get('tbody tr:first-child()').contains(lastPostTitle.slice(0, 20))
cy.get('tbody tr:first-child()').contains(lastReportTitle.slice(0, 20))
})
})
Then('I see my reported user', () => {
cy.get('table').then(() => {
cy.get('tbody tr:first-child()').contains(lastReportTitle)
})
})