Fix Cypress tests

This commit is contained in:
Wolfgang Huß 2019-10-09 17:11:16 +02:00
parent 377dc2af53
commit bc4cf2ee60
2 changed files with 15 additions and 9 deletions

View File

@ -107,6 +107,11 @@ Then(`I can't see the moderation menu item`, () => {
When(/^I confirm the reporting dialog .*:$/, message => { When(/^I confirm the reporting dialog .*:$/, message => {
cy.contains(message) // wait for element to become visible cy.contains(message) // wait for element to become visible
cy.get('.ds-modal').within(() => { cy.get('.ds-modal').within(() => {
cy.get('.ds-radio-option-label')
.first()
.click({
force: true
})
cy.get('button') cy.get('button')
.contains('Report') .contains('Report')
.click() .click()
@ -114,21 +119,22 @@ When(/^I confirm the reporting dialog .*:$/, message => {
}) })
Given('somebody reported the following posts:', table => { Given('somebody reported the following posts:', table => {
table.hashes().forEach(({ id }) => { table.hashes().forEach(({ resourceId, reasonCategory, reasonDescription }) => {
const submitter = { const submitter = {
email: `submitter${id}@example.org`, email: `submitter${resourceId}@example.org`,
password: '1234' password: '1234'
} }
cy.factory() cy.factory()
.create('User', submitter) .create('User', submitter)
.authenticateAs(submitter) .authenticateAs(submitter)
.mutate(`mutation($resourceId: ID!, $reasonDescription: String!) { .mutate(`mutation(resourceId: ID!, reasonCategory: String!, reasonDescription: String!) {
report(reasonDescription: $reasonDescription, resourceId: $resourceId) { report(resourceId: $resourceId, reasonCategory: $reasonCategory, reasonDescription: $reasonDescription) {
id id
} }
}`, { }`, {
resourceId, resourceId,
reasonDescription: 'Offensive content' reasonCategory,
reasonDescription
}) })
}) })
}) })

View File

@ -50,8 +50,8 @@ Feature: Report and Moderate
Scenario: Review reported content Scenario: Review reported content
Given somebody reported the following posts: Given somebody reported the following posts:
| id | | resourceId | reasonCategory | reasonDescription |
| p1 | | p1 | discrimination-etc | Offensive content |
And I am logged in with a "moderator" role And I am logged in with a "moderator" role
When I click on the avatar menu in the top right corner When I click on the avatar menu in the top right corner
And I click on "Moderation" And I click on "Moderation"
@ -60,8 +60,8 @@ Feature: Report and Moderate
Scenario: Review reported posts of a user who's blocked a moderator Scenario: Review reported posts of a user who's blocked a moderator
Given somebody reported the following posts: Given somebody reported the following posts:
| id | | resourceId | reasonCategory | reasonDescription |
| p2 | | p2 | other | Offensive content |
And my user account has the role "moderator" And my user account has the role "moderator"
And there is an annoying user who has blocked me And there is an annoying user who has blocked me
And I am logged in And I am logged in