removed redundant step definitions and old clutter

This commit is contained in:
Ulf Gebhardt 2021-04-12 02:08:44 +02:00
parent af6f45a399
commit 5c42815e2e
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD
3 changed files with 0 additions and 175 deletions

View File

@ -1,92 +0,0 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
import { VERSION } from '../../constants/terms-and-conditions-version.js'
/* global cy */
let lastReportTitle
let davidIrvingPostTitle = 'The Truth about the Holocaust'
let davidIrvingPostSlug = 'the-truth-about-the-holocaust'
let annoyingUserWhoMutedModeratorTitle = 'Fake news'
const savePostTitle = $post => {
return $post
.first()
.find('.title')
.first()
.invoke('text')
.then(title => {
lastReportTitle = title
})
}
Given("I see David Irving's post on the newsfeed", page => {
cy.openPage('newsfeed')
})
Given('I am logged in with a {string} role', role => {
cy.factory().build('user', {
termsAndConditionsAgreedVersion: VERSION,
role,
name: `${role} is my name`
}, {
email: `${role}@example.org`,
password: '1234',
})
cy.neode()
.first("User", {
name: `${role} is my name`,
})
.then(user => {
return new Cypress.Promise((resolve, reject) => {
return user.toJson().then((user) => resolve(user))
})
})
.then(user => cy.login(user))
})
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')
.click({ force: true })
cy.get('.popover .ds-menu-item-link')
.contains('Report User')
.click()
})
When('I report the author', () => {
cy.get('.page-name-profile-id-slug').then(() => {
invokeReportOnElement('.base-card').then(() => {
cy.get('button')
.contains('Send')
.click()
})
})
})
When('I click on send in the confirmation dialog', () => {
cy.get('button')
.contains('Send')
.click()
})
Then('I get a success message', () => {
cy.get('.iziToast-message').contains('Thanks')
})
Then('I see my reported user', () => {
cy.get('table').then(() => {
cy.get('tbody tr')
.first()
.contains(lastReportTitle.trim())
})
})
When("they have a post someone has reported", () => {
cy.factory()
.build("post", {
title,
}, {
authorId: 'annnoying-user',
});
})

View File

@ -1,18 +0,0 @@
import { When, Then } from 'cypress-cucumber-preprocessor/steps'
/* global cy */
When('I click on the {string} link', link => {
cy.get('a')
.contains(link)
.click()
})
Then('I should be on the {string} page', page => {
cy.location()
.should(loc => {
expect(loc.pathname).to.eq(page)
})
.get('h2')
.should('contain', 'Social media')
})

View File

@ -1,65 +0,0 @@
import {
Given,
When,
Then
} from "cypress-cucumber-preprocessor/steps";
import locales from '../../../webapp/locales'
import orderBy from 'lodash/orderBy'
/* global cy */
const languages = orderBy(locales, 'name')
let lastPost = {};
const annoyingParams = {
email: "spammy-spammer@example.org",
slug: 'spammy-spammer',
password: "1234",
};
When("I log out", cy.logout);
When(`I click on the menu item {string}`, linkOrButton => {
cy.contains(".ds-menu-item", linkOrButton).click();
});
When("I press {string}", label => {
cy.contains(label).click();
});
Given("we have the following posts in our database:", table => {
table.hashes().forEach((attributesOrOptions, i) => {
cy.factory().build("post", {
...attributesOrOptions,
deleted: Boolean(attributesOrOptions.deleted),
disabled: Boolean(attributesOrOptions.disabled),
pinned: Boolean(attributesOrOptions.pinned),
}, {
...attributesOrOptions,
});
})
})
Given("there is an annoying user called {string}", name => {
cy.factory().build("user", {
id: "annoying-user",
name,
...termsAndConditionsAgreedVersion,
}, annoyingParams);
});
Given("I wrote a post {string}", title => {
cy.factory()
.build("post", {
title,
}, {
authorId: narratorParams.id,
});
});
Then("I see only one post with the title {string}", title => {
cy.get(".main-container")
.find(".post-link")
.should("have.length", 1);
cy.get(".main-container").contains(".post-link", title);
});