From bc4cf2ee600769bd97c7b196acf829d1f95aa7a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Wed, 9 Oct 2019 17:11:16 +0200 Subject: [PATCH] Fix Cypress tests --- cypress/integration/common/report.js | 16 +++++++++++----- .../integration/moderation/ReportContent.feature | 8 ++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/cypress/integration/common/report.js b/cypress/integration/common/report.js index 83c96e6af..96664335a 100644 --- a/cypress/integration/common/report.js +++ b/cypress/integration/common/report.js @@ -107,6 +107,11 @@ Then(`I can't see the moderation menu item`, () => { 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() @@ -114,21 +119,22 @@ When(/^I confirm the reporting dialog .*:$/, message => { }) Given('somebody reported the following posts:', table => { - table.hashes().forEach(({ id }) => { + table.hashes().forEach(({ resourceId, reasonCategory, reasonDescription }) => { const submitter = { - email: `submitter${id}@example.org`, + email: `submitter${resourceId}@example.org`, password: '1234' } cy.factory() .create('User', submitter) .authenticateAs(submitter) - .mutate(`mutation($resourceId: ID!, $reasonDescription: String!) { - report(reasonDescription: $reasonDescription, resourceId: $resourceId) { + .mutate(`mutation(resourceId: ID!, reasonCategory: String!, reasonDescription: String!) { + report(resourceId: $resourceId, reasonCategory: $reasonCategory, reasonDescription: $reasonDescription) { id } }`, { resourceId, - reasonDescription: 'Offensive content' + reasonCategory, + reasonDescription }) }) }) diff --git a/cypress/integration/moderation/ReportContent.feature b/cypress/integration/moderation/ReportContent.feature index 0f8eec0e3..1d334325e 100644 --- a/cypress/integration/moderation/ReportContent.feature +++ b/cypress/integration/moderation/ReportContent.feature @@ -50,8 +50,8 @@ Feature: Report and Moderate Scenario: Review reported content Given somebody reported the following posts: - | id | - | p1 | + | resourceId | reasonCategory | reasonDescription | + | p1 | discrimination-etc | Offensive content | 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" @@ -60,8 +60,8 @@ Feature: Report and Moderate Scenario: Review reported posts of a user who's blocked a moderator Given somebody reported the following posts: - | id | - | p2 | + | resourceId | reasonCategory | reasonDescription | + | p2 | other | Offensive content | And my user account has the role "moderator" And there is an annoying user who has blocked me And I am logged in