refactor(other): cypress: simplify cucumber preprocessor imports and some linting (#8489)

* cypress: a little linting

* cypress: import badeball preprocessor globally

* cypress: reintroduce accidentally removed semicolons

* cypress: set new e2e support file in config

* Revert "cypress: import badeball preprocessor globally"

This reverts commit 55fde3de2f9c355fe25bf9b49485b6bf64ca01cf.

* Revert "cypress: set new e2e support file in config"

This reverts commit 525cb5cf3766e402dadfd17f48e5b0f6c6ba1f9b.

* cypress: change preprocessor import to correct method in step definition file

* cypress: change preprocessor import to correct method in step definition files
This commit is contained in:
mahula 2025-05-04 22:00:36 +02:00 committed by GitHub
parent b54e9773f4
commit 30080a44c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
119 changed files with 559 additions and 563 deletions

View File

@ -1,8 +1,8 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("the donation info contains goal {string} and progress {string}", (goal, progress) => { defineStep('the donation info contains goal {string} and progress {string}', (goal, progress) => {
cy.get('.top-info-bar') cy.get('.top-info-bar')
.should('contain', goal) .should('contain', goal)
cy.get('.top-info-bar') cy.get('.top-info-bar')
.should('contain', progress) .should('contain', progress)
}); })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("the donation info is {string}", (visibility) => { defineStep('the donation info is {string}', (visibility) => {
cy.get('.top-info-bar') cy.get('.top-info-bar')
.should(visibility === 'visible' ? 'exist' : 'not.exist') .should(visibility === 'visible' ? 'exist' : 'not.exist')
}) })

View File

@ -1,6 +1,6 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("I open the content menu of post {string}", (title) => { defineStep('I open the content menu of post {string}', (title) => {
cy.contains('.post-teaser', title) cy.contains('.post-teaser', title)
.find('.content-menu .base-button') .find('.content-menu .base-button')
.click() .click()

View File

@ -1,9 +1,9 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("the post with title {string} has a ribbon for pinned posts", (title) => { defineStep('the post with title {string} has a ribbon for pinned posts', (title) => {
cy.get(".post-teaser").contains(title) cy.get('.post-teaser').contains(title)
.parent() .parent()
.parent() .parent()
.find(".ribbon.--pinned") .find('.ribbon.--pinned')
.should("contain", "Announcement") .should('contain', 'Announcement')
}) })

View File

@ -1,7 +1,7 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("there is no button to pin a post", () => { defineStep('there is no button to pin a post', () => {
cy.get("a.ds-menu-item-link") cy.get('a.ds-menu-item-link')
.should('contain', "Report Post") // sanity check .should('contain', 'Report Post') // sanity check
.should('not.contain', "Pin post") .should('not.contain', 'Pin post')
}) })

View File

@ -1,5 +1,5 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I see a button with the label {string}", label => { defineStep('I see a button with the label {string}', label => {
cy.contains("button", label); cy.contains('button', label)
}); })

View File

@ -1,8 +1,8 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("I select {string} in the language menu", language => { defineStep('I select {string} in the language menu', language => {
cy.get(".locale-menu") cy.get('.locale-menu')
.click(); .click()
cy.contains(".locale-menu-popover a", language) cy.contains('.locale-menu-popover a', language)
.click(); .click()
}); })

View File

@ -1,8 +1,8 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
import locales from '../../../../webapp/locales' import locales from '../../../../webapp/locales'
Then("the whole user interface appears in {string}", language => { defineStep('the whole user interface appears in {string}', language => {
const { code } = locales.find((entry) => entry.name === language); const { code } = locales.find((entry) => entry.name === language)
cy.get(`html[lang=${code}]`); cy.get(`html[lang=${code}]`)
cy.getCookie("locale").should("have.property", "value", code); cy.getCookie('locale').should('have.property', 'value', code)
}); })

View File

@ -1,7 +1,7 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I should see only {int} posts on the newsfeed", posts => { defineStep('I should see only {int} posts on the newsfeed', posts => {
cy.get(".post-teaser") cy.get('.post-teaser')
.should("have.length", posts); .should('have.length', posts)
}); })

View File

@ -1,14 +1,14 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("the page {string} returns a 404 error with a message:", (route, message) => { defineStep('the page {string} returns a 404 error with a message:', (route, message) => {
cy.request({ cy.request({
url: route, url: route,
failOnStatusCode: false failOnStatusCode: false
}) })
.its("status") .its('status')
.should("eq", 404); .should('eq', 404)
cy.visit(route, { cy.visit(route, {
failOnStatusCode: false failOnStatusCode: false
}); })
cy.get(".error-message").should("contain", message); cy.get('.error-message').should('contain', message)
}); })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then(`I can't see the moderation menu item`, () => { defineStep(`I can't see the moderation menu item`, () => {
cy.get('.avatar-menu-popover') cy.get('.avatar-menu-popover')
.find('a[href="/settings"]', 'Settings') .find('a[href="/settings"]', 'Settings')
.should('exist') // OK, the dropdown is actually open .should('exist') // OK, the dropdown is actually open

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then('I can visit the post page', () => { defineStep('I can visit the post page', () => {
cy.contains('Fake news').click() cy.contains('Fake news').click()
cy.location('pathname').should('contain', '/post') cy.location('pathname').should('contain', '/post')
.get('.base-card .title').should('contain', 'Fake news') .get('.base-card .title').should('contain', 'Fake news')

View File

@ -1,6 +1,6 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When('I click on "Report Post" from the content menu of the post', () => { defineStep('I click on "Report Post" from the content menu of the post', () => {
cy.contains('.base-card', 'The Truth about the Holocaust') cy.contains('.base-card', 'The Truth about the Holocaust')
.find('.content-menu .base-button') .find('.content-menu .base-button')
.click() .click()

View File

@ -1,6 +1,6 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When('I click on the author', () => { defineStep('I click on the author', () => {
cy.get('[data-test="avatarUserLink"]') cy.get('[data-test="avatarUserLink"]')
.click() .click()
.url().should('include', '/profile/') .url().should('include', '/profile/')

View File

@ -1,7 +1,7 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
import 'cypress-network-idle'; import 'cypress-network-idle'
When("I click on the avatar menu in the top right corner", () => { defineStep('I click on the avatar menu in the top right corner', () => {
cy.get(".avatar-menu").click(); cy.get('.avatar-menu').click()
cy.waitForNetworkIdle(2000); cy.waitForNetworkIdle(2000)
}); })

View File

@ -1,6 +1,6 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When(/^I confirm the reporting dialog .*:$/, message => { defineStep(/^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') cy.get('.ds-modal')
.within(() => { .within(() => {

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then('I see all the reported posts including from the user who muted me', () => { defineStep('I see all the reported posts including from the user who muted me', () => {
cy.get('table tbody').within(() => { cy.get('table tbody').within(() => {
cy.contains('tr', 'Fake news') cy.contains('tr', 'Fake news')
}) })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then('I see all the reported posts including the one from above', () => { defineStep('I see all the reported posts including the one from above', () => {
cy.intercept({ cy.intercept({
method: 'POST', method: 'POST',
url: '/api', url: '/api',

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then('each list item links to the post page', () => { defineStep('each list item links to the post page', () => {
cy.contains('The Truth about the Holocaust').click(); cy.contains('The Truth about the Holocaust').click()
cy.location('pathname').should('contain', '/post') cy.location('pathname').should('contain', '/post')
}) })

View File

@ -1,9 +1,9 @@
import { Given } from '@badeball/cypress-cucumber-preprocessor' import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
import './../../commands' import './../../commands'
import './../../factories' import './../../factories'
import 'cypress-network-idle' import 'cypress-network-idle'
Given('somebody reported the following posts:', table => { defineStep('somebody reported the following posts:', table => {
const reportIdRegex = /^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/ const reportIdRegex = /^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/
cy.intercept({ cy.intercept({
method: 'POST', method: 'POST',

View File

@ -1,15 +1,15 @@
import { Given } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Given("there is an annoying user who has muted me", () => { defineStep('there is an annoying user who has muted me', () => {
cy.neode() cy.neode()
.firstOf("User", { .firstOf('User', {
role: 'moderator' role: 'moderator'
}) })
.then(mutedUser => { .then(mutedUser => {
cy.neode() cy.neode()
.firstOf("User", { .firstOf('User', {
id: 'user' id: 'user'
}) })
.relateTo(mutedUser, "muted"); .relateTo(mutedUser, 'muted')
}); })
}); })

View File

@ -1,8 +1,8 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("I start to write a new post with the title {string} beginning with:", (title, intro) => { defineStep('I start to write a new post with the title {string} beginning with:', (title, intro) => {
cy.get('input[name="title"]') cy.get('input[name="title"]')
.type(title); .type(title)
cy.get(".ProseMirror") cy.get('.ProseMirror')
.type(intro); .type(intro)
}); })

View File

@ -1,9 +1,9 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("mention {string} in the text", mention => { defineStep('mention {string} in the text', mention => {
cy.get(".ProseMirror") cy.get('.ProseMirror')
.type(" @"); .type(' @')
cy.get(".suggestion-list__item") cy.get('.suggestion-list__item')
.contains(mention) .contains(mention)
.click(); .click()
}); })

View File

@ -1,10 +1,10 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("open the notification menu and click on the first item", () => { defineStep('open the notification menu and click on the first item', () => {
cy.get(".notifications-menu") cy.get('.notifications-menu')
.invoke('show') .invoke('show')
.click(); // "invoke('show')" because of the delay for show the menu .click() // 'invoke('show')' because of the delay for show the menu
cy.get(".notification .link") cy.get('.notification .link')
.first() .first()
.click({force: true}); .click({force: true})
}); })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("see {int} unread notifications in the top menu", count => { defineStep('see {int} unread notifications in the top menu', count => {
cy.get(".notifications-menu") cy.get('.notifications-menu')
.should("contain", count); .should('contain', count)
}); })

View File

@ -1,8 +1,8 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("the notification menu button links to the all notifications page", () => { defineStep('the notification menu button links to the all notifications page', () => {
cy.get(".notifications-menu") cy.get('.notifications-menu')
.click(); .click()
cy.location("pathname") cy.location('pathname')
.should("contain", "/notifications"); .should('contain', '/notifications')
}); })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("the unread counter is removed", () => { defineStep('the unread counter is removed', () => {
cy.get('.notifications-menu .counter-icon') cy.get('.notifications-menu .counter-icon')
.should('not.exist'); .should('not.exist')
}); })

View File

@ -1,7 +1,7 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("I comment the following:", text => { defineStep('I comment the following:', text => {
const comment = text.replace("\n", " ") const comment = text.replace('\n', ' ')
cy.task('pushValue', { name: 'lastComment', value: comment }) cy.task('pushValue', { name: 'lastComment', value: comment })
cy.get(".editor .ProseMirror").type(comment); cy.get('.editor .ProseMirror').type(comment)
}); })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I should see an abbreviated version of my comment", () => { defineStep('I should see an abbreviated version of my comment', () => {
cy.get("article.comment-card") cy.get('article.comment-card')
.should("contain", "show more") .should('contain', 'show more')
}); })

View File

@ -1,13 +1,13 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I should see my comment", () => { defineStep('I should see my comment', () => {
cy.get("article.comment-card p") cy.get('article.comment-card p')
.should("contain", "Ocelot.social rocks") .should('contain', 'Ocelot.social rocks')
.get(".user-teaser span.slug") .get('.user-teaser span.slug')
.should("contain", "@peter-pan") // specific enough .should('contain', '@peter-pan') // specific enough
.get(".profile-avatar img") .get('.profile-avatar img')
.should("have.attr", "src") .should('have.attr', 'src')
.and("contain", 'https://') // some url .and('contain', 'https://') // some url
.get(".user-teaser > .info > .text") .get('.user-teaser > .info > .text')
.should("contain", "today at"); .should('contain', 'today at')
}); })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I should see the entirety of my comment", () => { defineStep('I should see the entirety of my comment', () => {
cy.get("article.comment-card") cy.get('article.comment-card')
.should("not.contain", "show more") .should('not.contain', 'show more')
}); })

View File

@ -1,9 +1,9 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("I type in a comment with {int} characters", size => { defineStep('I type in a comment with {int} characters', size => {
var c=""; var c = ''
for (var i = 0; i < size; i++) { for (var i = 0; i < size; i++) {
c += "c" c += 'c'
} }
cy.get(".editor .ProseMirror").type(c); cy.get('.editor .ProseMirror').type(c)
}); })

View File

@ -1,7 +1,7 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("it should create a mention in the CommentForm", () => { defineStep('it should create a mention in the CommentForm', () => {
cy.get(".ProseMirror a") cy.get('.ProseMirror a')
.should('have.class', 'mention') .should('have.class', 'mention')
.should('contain', '@peter-pan') .should('contain', '@peter-pan')
}) })

View File

@ -1,5 +1,5 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("my comment should be successfully created", () => { defineStep('my comment should be successfully created', () => {
cy.get(".iziToast-message").contains("Comment submitted!"); cy.get('.iziToast-message').contains('Comment submitted!')
}); })

View File

@ -1,5 +1,5 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("the editor should be cleared", () => { defineStep('the editor should be cleared', () => {
cy.get(".ProseMirror p").should("have.class", "is-empty"); cy.get('.ProseMirror p').should('have.class', 'is-empty')
}); })

View File

@ -1,8 +1,8 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("I choose {string} as the title", title => { defineStep('I choose {string} as the title', title => {
const lastPost = {} const lastPost = {}
lastPost.title = title.replace("\n", " "); lastPost.title = title.replace('\n', ' ')
cy.task('pushValue', { name: 'lastPost', value: lastPost }) cy.task('pushValue', { name: 'lastPost', value: lastPost })
cy.get('input[name="title"]').type(lastPost.title); cy.get('input[name="title"]').type(lastPost.title)
}); })

View File

@ -1,8 +1,8 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("the post was saved successfully", () => { defineStep('the post was saved successfully', () => {
cy.task('getValue', 'lastPost').then(lastPost => { cy.task('getValue', 'lastPost').then(lastPost => {
cy.get(".base-card > .title").should("contain", lastPost.title); cy.get('.base-card > .title').should('contain', lastPost.title)
cy.get(".content").should("contain", lastPost.content); cy.get('.content').should('contain', lastPost.content)
}) })
}); })

View File

@ -1,8 +1,8 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I add all required fields", () => { defineStep('I add all required fields', () => {
cy.get('input[name="title"]') cy.get('input[name="title"]')
.type('new post') .type('new post')
.get(".editor .ProseMirror") .get('.editor .ProseMirror')
.type('new post content') .type('new post content')
}) })

View File

@ -1,29 +1,28 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I should be able to {string} a teaser image", condition => { defineStep('I should be able to {string} a teaser image', condition => {
let postTeaserImage = "" let postTeaserImage = ''
switch(condition){ switch(condition){
case "change": case 'change':
postTeaserImage = "humanconnection.png" postTeaserImage = 'humanconnection.png'
cy.get(".delete-image-button") cy.get('.delete-image-button')
.click() .click()
cy.get("#postdropzone").selectFile( cy.get('#postdropzone').selectFile(
{ contents: `cypress/fixtures/${postTeaserImage}`, fileName: postTeaserImage, mimeType: "image/png" }, { contents: `cypress/fixtures/${postTeaserImage}`, fileName: postTeaserImage, mimeType: 'image/png' },
{ action: "drag-drop", force: true } { action: 'drag-drop', force: true }
).wait(750); ).wait(750)
break; break
case "add": case 'add':
postTeaserImage = "onourjourney.png" postTeaserImage = 'onourjourney.png'
cy.get("#postdropzone").selectFile( cy.get('#postdropzone').selectFile(
{ contents: `cypress/fixtures/${postTeaserImage}`, fileName: postTeaserImage, mimeType: "image/png" }, { contents: `cypress/fixtures/${postTeaserImage}`, fileName: postTeaserImage, mimeType: 'image/png' },
{ action: "drag-drop", force: true } { action: 'drag-drop', force: true }
).wait(750); ).wait(750)
break; break
case "remove": case 'remove':
cy.get(".delete-image-button") cy.get('.delete-image-button')
.click() .click()
break; break
} }
}) })

View File

@ -1,6 +1,6 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When('my post has a teaser image', () => { defineStep('my post has a teaser image', () => {
cy.get('.contribution-form .image') cy.get('.contribution-form .image')
.should('exist') .should('exist')
.and('have.attr', 'src') .and('have.attr', 'src')

View File

@ -1,7 +1,7 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("the first image should not be displayed anymore", () => { defineStep('the first image should not be displayed anymore', () => {
cy.get(".hero-image") cy.get('.hero-image')
.children() .children()
.get('.hero-image > .image') .get('.hero-image > .image')
.should('have.length', 1) .should('have.length', 1)

View File

@ -1,11 +1,11 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("the post was saved successfully with the {string} teaser image", condition => { defineStep('the post was saved successfully with the {string} teaser image', condition => {
cy.get(".base-card > .title") cy.get('.base-card > .title')
.should("contain", condition === 'updated' ? 'to be updated' : 'new post') .should('contain', condition === 'updated' ? 'to be updated' : 'new post')
.get(".content") .get('.content')
.should("contain", condition === 'updated' ? 'successfully updated' : 'new post content') .should('contain', condition === 'updated' ? 'successfully updated' : 'new post content')
.get('.post-page img') .get('.post-page img')
.should("have.attr", "src") .should('have.attr', 'src')
.and("contains", condition === 'updated' ? 'humanconnection' : 'onourjourney') .and('contains', condition === 'updated' ? 'humanconnection' : 'onourjourney')
}) })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then('the {string} post was saved successfully without a teaser image', condition => { defineStep('the {string} post was saved successfully without a teaser image', condition => {
cy.get(".base-card > .title") cy.get(".base-card > .title")
.should("contain", condition === 'updated' ? 'to be updated' : 'new post') .should("contain", condition === 'updated' ? 'to be updated' : 'new post')
.get(".content") .get(".content")

View File

@ -1,8 +1,7 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("the post shows up on the newsfeed at position {int}", index => { defineStep('the post shows up on the newsfeed at position {int}', index => {
const selector = `.post-teaser:nth-child(${index}) > .base-card`; const selector = `.post-teaser:nth-child(${index}) > .base-card`
cy.get(selector).should("contain", 'previously created post'); cy.get(selector).should('contain', 'previously created post')
cy.get(selector).should("contain", 'with some content'); cy.get(selector).should('contain', 'with some content')
})
});

View File

@ -1,7 +1,7 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("I select a post entry", () => { defineStep('I select a post entry', () => {
cy.get(".searchable-input .search-post") cy.get('.searchable-input .search-post')
.first() .first()
.trigger("click"); .trigger('click')
}); })

View File

@ -1,7 +1,7 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I select a user entry", () => { defineStep('I select a user entry', () => {
cy.get(".searchable-input .user-teaser") cy.get('.searchable-input .user-teaser')
.first() .first()
.trigger("click"); .trigger('click')
}) })

View File

@ -1,7 +1,7 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I should have one item in the select dropdown", () => { defineStep('I should have one item in the select dropdown', () => {
cy.get(".searchable-input .ds-select-dropdown").should($li => { cy.get('.searchable-input .ds-select-dropdown').should($li => {
expect($li).to.have.length(1); expect($li).to.have.length(1)
}); })
}); })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I should not see posts without the searched-for term in the select dropdown", () => { defineStep('I should not see posts without the searched-for term in the select dropdown', () => {
cy.get(".ds-select-dropdown") cy.get('.ds-select-dropdown')
.should("not.contain","No searched for content"); .should('not.contain','No searched for content')
}); })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I should see posts with the searched-for term in the select dropdown", () => { defineStep('I should see posts with the searched-for term in the select dropdown', () => {
cy.get(".ds-select-dropdown") cy.get('.ds-select-dropdown')
.should("contain","101 Essays that will change the way you think"); .should('contain','101 Essays that will change the way you think')
}); })

View File

@ -1,8 +1,8 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I should see the following posts on the search results page:", table => { defineStep('I should see the following posts on the search results page:', table => {
table.hashes().forEach(({ title }) => { table.hashes().forEach(({ title }) => {
cy.get(".post-teaser") cy.get('.post-teaser')
.should("contain",title) .should('contain',title)
}); })
}); })

View File

@ -1,8 +1,8 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I should see the following users in the select dropdown:", table => { defineStep('I should see the following users in the select dropdown:', table => {
cy.get(".search-heading").should("contain", "Users"); cy.get('.search-heading').should('contain', 'Users')
table.hashes().forEach(({ slug }) => { table.hashes().forEach(({ slug }) => {
cy.get(".ds-select-dropdown").should("contain", slug); cy.get('.ds-select-dropdown').should('contain', slug)
}); })
}); })

View File

@ -1,8 +1,8 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("I type {string} and press Enter", value => { defineStep('I type {string} and press Enter', value => {
cy.get(".searchable-input .ds-select input") cy.get('.searchable-input .ds-select input')
.focus() .focus()
.type(value) .type(value)
.type("{enter}", { force: true }); .type('{enter}', { force: true })
}); })

View File

@ -1,8 +1,8 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("I type {string} and press escape", value => { defineStep('I type {string} and press escape', value => {
cy.get(".searchable-input .ds-select input") cy.get('.searchable-input .ds-select input')
.focus() .focus()
.type(value) .type(value)
.type("{esc}"); .type('{esc}')
}); })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("the search field should clear", () => { defineStep('the search field should clear', () => {
cy.get(".searchable-input .ds-select input") cy.get('.searchable-input .ds-select input')
.should("have.text", ""); .should('have.text', '')
}); })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("the search parameter equals {string}", search => { defineStep('the search parameter equals {string}', search => {
cy.location("search") cy.location('search')
.should("eq", search); .should('eq', search)
}); })

View File

@ -1,7 +1,7 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I am logged in with username {string}", name => { defineStep('I am logged in with username {string}', name => {
cy.get(".avatar-menu").click(); cy.get('.avatar-menu').click()
cy.get(".avatar-menu-popover").contains(name); cy.get('.avatar-menu-popover').contains(name)
cy.get(".avatar-menu").click(); // Close menu again cy.get('.avatar-menu').click() // Close menu again
}); })

View File

@ -1,11 +1,11 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("I block the user {string}", name => { defineStep('I block the user {string}', name => {
cy.neode() cy.neode()
.firstOf("User", { name }) .firstOf('User', { name })
.then(blockedUser => { .then(blockedUser => {
cy.neode() cy.neode()
.firstOf("User", {id: "id-of-peter-pan"}) .firstOf('User', {id: 'id-of-peter-pan'})
.relateTo(blockedUser, "blocked"); .relateTo(blockedUser, 'blocked')
}); })
}); })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then('I should not see {string} button', button => { defineStep('I should not see {string} button', button => {
cy.get('.base-card .action-buttons') cy.get('.base-card .action-buttons')
.should('have.length', 1) .should('have.length', 1)
}) })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I should see no users in my blocked users list", () => { defineStep('I should see no users in my blocked users list', () => {
cy.get('.ds-placeholder') cy.get('.ds-placeholder')
.should('contain', "So far, you have not blocked anybody.") .should('contain', 'So far, you have not blocked anybody.')
}) })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then('I should see the {string} button', button => { defineStep('I should see the {string} button', button => {
cy.get('.base-card .action-buttons .base-button') cy.get('.base-card .action-buttons .base-button')
.should('contain', button) .should('contain', button)
}) })

View File

@ -1,7 +1,7 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I {string} see {string} from the content menu in the user info box", (condition, link) => { defineStep('I {string} see {string} from the content menu in the user info box', (condition, link) => {
cy.get(".user-content-menu .base-button").click() cy.get('.user-content-menu .base-button').click()
cy.get(".popover .ds-menu-item-link") cy.get('.popover .ds-menu-item-link')
.should(condition === 'should' ? 'contain' : 'not.contain', link) .should(condition === 'should' ? 'contain' : 'not.contain', link)
}) })

View File

@ -1,15 +1,15 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("a user has blocked me", () => { defineStep('a user has blocked me', () => {
cy.neode() cy.neode()
.firstOf("User", { .firstOf('User', {
name: "Peter Pan" name: 'Peter Pan'
}) })
.then(blockedUser => { .then(blockedUser => {
cy.neode() cy.neode()
.firstOf("User", { .firstOf('User', {
name: 'Harassing User' name: 'Harassing User'
}) })
.relateTo(blockedUser, "blocked"); .relateTo(blockedUser, 'blocked')
}); })
}); })

View File

@ -1,5 +1,5 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("they should not see the comment form", () => { defineStep('they should not see the comment form', () => {
cy.get(".base-card").children().should('not.have.class', 'comment-form') cy.get('.base-card').children().should('not.have.class', 'comment-form')
}) })

View File

@ -1,5 +1,5 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("they should see a text explaining why commenting is not possible", () => { defineStep('they should see a text explaining why commenting is not possible', () => {
cy.get('.ds-placeholder').should('contain', "Commenting is not possible at this time on this post.") cy.get('.ds-placeholder').should('contain', 'Commenting is not possible at this time on this post.')
}) })

View File

@ -1,13 +1,13 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("I mute the user {string}", name => { defineStep('I mute the user {string}', name => {
cy.neode() cy.neode()
.firstOf("User", { name }) .firstOf('User', { name })
.then(mutedUser => { .then(mutedUser => {
cy.neode() cy.neode()
.firstOf("User", { .firstOf('User', {
name: "Peter Pan" name: 'Peter Pan'
}) })
.relateTo(mutedUser, "muted"); .relateTo(mutedUser, 'muted')
}); })
}); })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("the list of posts of this user is empty", () => { defineStep('the list of posts of this user is empty', () => {
cy.get(".base-card").not(".post-link"); cy.get('.base-card').not('.post-link')
cy.get(".main-container").find(".ds-space.hc-empty"); cy.get('.main-container').find('.ds-space.hc-empty')
}); })

View File

@ -1,13 +1,13 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("the search should contain the annoying user", () => { defineStep('the search should contain the annoying user', () => {
cy.get(".searchable-input .ds-select-dropdown") cy.get('.searchable-input .ds-select-dropdown')
.should($li => { .should($li => {
expect($li).to.have.length(1); expect($li).to.have.length(1)
}) })
cy.get(".ds-select-dropdown .user-teaser .slug") cy.get('.ds-select-dropdown .user-teaser .slug')
.should("contain", '@annoying-user'); .should('contain', '@annoying-user')
cy.get(".searchable-input .ds-select input") cy.get('.searchable-input .ds-select input')
.focus() .focus()
.type("{esc}"); .type('{esc}')
}) })

View File

@ -1,10 +1,10 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("the search should not contain posts by the annoying user", () => { defineStep('the search should not contain posts by the annoying user', () => {
cy.get(".searchable-input .ds-select-dropdown").should($li => { cy.get('.searchable-input .ds-select-dropdown').should($li => {
expect($li).to.have.length(1); expect($li).to.have.length(1)
}) })
cy.get(".ds-select-dropdown") cy.get('.ds-select-dropdown')
.should("not.have.class", '.search-post') .should('not.have.class', '.search-post')
.should("not.contain", 'Spam') .should('not.contain', 'Spam')
}); })

View File

@ -1,5 +1,5 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("I click on element with ID {string}", (id) => { defineStep('I click on element with ID {string}', (id) => {
cy.get('#' + id).click() cy.get('#' + id).click()
}) })

View File

@ -1,5 +1,5 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I click save", () => { defineStep('I click save', () => {
cy.get(".save-button").click() cy.get('.save-button').click()
}) })

View File

@ -1,8 +1,8 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I cannot upload a picture", () => { defineStep('I cannot upload a picture', () => {
cy.get(".base-card") cy.get('.base-card')
.children() .children()
.should("not.have.id", "customdropzone") .should('not.have.id', 'customdropzone')
.should("have.class", "profile-avatar"); .should('have.class', 'profile-avatar')
}); })

View File

@ -1,15 +1,15 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I should be able to change my profile picture", () => { defineStep('I should be able to change my profile picture', () => {
const avatarUpload = "onourjourney.png"; const avatarUpload = 'onourjourney.png'
cy.get("#customdropzone").selectFile( cy.get('#customdropzone').selectFile(
{ contents: `cypress/fixtures/${avatarUpload}`, fileName: avatarUpload, mimeType: "image/png" }, { contents: `cypress/fixtures/${avatarUpload}`, fileName: avatarUpload, mimeType: 'image/png' },
{ action: "drag-drop" } { action: 'drag-drop' }
); )
cy.get(".profile-page-avatar img") cy.get('.profile-page-avatar img')
.should("have.attr", "src") .should('have.attr', 'src')
.and("contains", "onourjourney"); .and('contains', 'onourjourney')
cy.contains(".iziToast-message", "Upload successful") cy.contains('.iziToast-message', 'Upload successful')
.should("have.length",1); .should('have.length',1)
}); })

View File

@ -1,7 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I can login successfully", () => { defineStep('I can login successfully', () => {
// cy.reload(); cy.get('.iziToast-wrapper')
cy.get(".iziToast-wrapper") .should('contain', 'You are logged in!')
.should("contain", "You are logged in!"); })
});

View File

@ -1,7 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I cannot login anymore", password => { defineStep('I cannot login anymore', password => {
//cy.reload(); cy.get('.iziToast-wrapper')
cy.get(".iziToast-wrapper") .should('contain', 'Incorrect email address or password.')
.should("contain", "Incorrect email address or password."); })
});

View File

@ -1,6 +1,6 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("I cannot submit the form", () => { defineStep('I cannot submit the form', () => {
cy.get("button[type=submit]") cy.get('button[type=submit]')
.should('be.disabled'); .should('be.disabled')
}); })

View File

@ -1,11 +1,11 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("I fill the password form with:", table => { defineStep('I fill the password form with:', table => {
table = table.rowsHash(); table = table.rowsHash()
cy.get("input[id=oldPassword]") cy.get('input[id=oldPassword]')
.type(table["Your old password"]) .type(table['Your old password'])
.get("input[id=password]") .get('input[id=password]')
.type(table["Your new password"]) .type(table['Your new password'])
.get("input[id=passwordConfirmation]") .get('input[id=passwordConfirmation]')
.type(table["Confirm new password"]); .type(table['Confirm new password'])
}); })

View File

@ -1,5 +1,5 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("I submit the form", () => { defineStep('I submit the form', () => {
cy.get("form").submit(); cy.get('form').submit()
}); })

View File

@ -1,10 +1,10 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then('I can see my new name {string} when I click on my profile picture in the top right', name => { defineStep('I can see my new name {string} when I click on my profile picture in the top right', name => {
cy.get(".avatar-menu").then(($menu) => { cy.get(".avatar-menu").then(($menu) => {
if (!$menu.is(':visible')){ if (!$menu.is(':visible')){
cy.scrollTo("top"); cy.scrollTo("top")
cy.wait(500); cy.wait(500)
} }
}) })
cy.get('.avatar-menu').click() // open cy.get('.avatar-menu').click() // open

View File

@ -1,6 +1,6 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When('I have the following self-description:', text => { defineStep('I have the following self-description:', text => {
cy.get('textarea[id=about]') cy.get('textarea[id=about]')
.clear() .clear()
.type(text) .type(text)

View File

@ -1,6 +1,6 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When('I save {string} as my location', location => { defineStep('I save {string} as my location', location => {
cy.get('input[id=city]').type(location) cy.get('input[id=city]').type(location)
cy.get('.ds-select-option') cy.get('.ds-select-option')
.contains(location) .contains(location)

View File

@ -1,6 +1,6 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When('I save {string} as my new name', name => { defineStep('I save {string} as my new name', name => {
cy.get('input[id=name]') cy.get('input[id=name]')
.clear() .clear()
.type(name) .type(name)

View File

@ -1,5 +1,5 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When('they can see the following text in the info box below my avatar:', text => { defineStep('they can see the following text in the info box below my avatar:', text => {
cy.contains(text) cy.contains(text)
}) })

View File

@ -1,5 +1,5 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then('they can see {string} in the info box below my avatar', location => { defineStep('they can see {string} in the info box below my avatar', location => {
cy.contains(location) cy.contains(location)
}) })

View File

@ -1,6 +1,6 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When('I add a social media link', () => { defineStep('I add a social media link', () => {
cy.get('[data-test="add-save-button"]') cy.get('[data-test="add-save-button"]')
.click() .click()
.get('#editSocialMedia') .get('#editSocialMedia')

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then('I can cancel editing', () => { defineStep('I can cancel editing', () => {
cy.get('button#cancel') cy.get('button#cancel')
.click() .click()
.get('input#editSocialMedia') .get('input#editSocialMedia')

View File

@ -1,6 +1,6 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When('I delete a social media link', () => { defineStep('I delete a social media link', () => {
cy.get(".base-button[title='Delete']") cy.get(".base-button[title='Delete']")
.click() .click()
}) })

View File

@ -1,6 +1,6 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When('I delete the social media link {string}', (link) => { defineStep('I delete the social media link {string}', (link) => {
cy.get('[data-test="delete-button"]') cy.get('[data-test="delete-button"]')
.click() .click()
cy.get('[data-test="confirm-modal"]') cy.get('[data-test="confirm-modal"]')

View File

@ -1,6 +1,6 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When('I edit and save the link', () => { defineStep('I edit and save the link', () => {
cy.get('input#editSocialMedia') cy.get('input#editSocialMedia')
.clear() .clear()
.type('https://freeradical.zone/tinkerbell') .type('https://freeradical.zone/tinkerbell')

View File

@ -1,6 +1,6 @@
import { Given } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Given('I have added a social media link', () => { defineStep('I have added a social media link', () => {
cy.visit('/settings/my-social-media') cy.visit('/settings/my-social-media')
.get('button') .get('button')
.contains('Add link') .contains('Add link')

View File

@ -1,6 +1,6 @@
import { Given } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Given('I have added the social media link {string}', (link) => { defineStep('I have added the social media link {string}', (link) => {
cy.visit('/settings/my-social-media') cy.visit('/settings/my-social-media')
.get('[data-test="add-save-button"]') .get('[data-test="add-save-button"]')
.click() .click()

View File

@ -1,6 +1,6 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When('I start editing a social media link', () => { defineStep('I start editing a social media link', () => {
cy.get('[data-test="edit-button"]') cy.get('[data-test="edit-button"]')
.click() .click()
}) })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then('the new social media link shows up on the page', () => { defineStep('the new social media link shows up on the page', () => {
cy.get('a[href="https://freeradical.zone/peter-pan"]') cy.get('a[href="https://freeradical.zone/peter-pan"]')
.should('have.length', 1) .should('have.length', 1)
}) })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then('the new url is displayed', () => { defineStep('the new url is displayed', () => {
cy.get("a[href='https://freeradical.zone/tinkerbell']") cy.get("a[href='https://freeradical.zone/tinkerbell']")
.should('have.length', 1) .should('have.length', 1)
}) })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then('the old url is not displayed', () => { defineStep('the old url is not displayed', () => {
cy.get("a[href='https://freeradical.zone/peter-pan']") cy.get("a[href='https://freeradical.zone/peter-pan']")
.should('have.length', 0) .should('have.length', 0)
}) })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then('they should be able to see my social media links', () => { defineStep('they should be able to see my social media links', () => {
cy.get('[data-test="social-media-list-headline"]') cy.get('[data-test="social-media-list-headline"]')
.contains('Peter Pan') .contains('Peter Pan')
.get('a[href="https://freeradical.zone/peter-pan"]') .get('a[href="https://freeradical.zone/peter-pan"]')

View File

@ -1,7 +1,7 @@
import { Given } from '@badeball/cypress-cucumber-preprocessor' import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
import encode from '../../../../backend/build/src/jwt/encode' import encode from '../../../../backend/build/src/jwt/encode'
Given('I am logged in as {string}', slug => { defineStep('I am logged in as {string}', slug => {
cy.neode() cy.neode()
.firstOf('User', { slug }) .firstOf('User', { slug })
.then(user => { .then(user => {
@ -15,4 +15,4 @@ Given('I am logged in as {string}', slug => {
.then(user => { .then(user => {
cy.setCookie('ocelot-social-token', encode(user)) cy.setCookie('ocelot-social-token', encode(user))
}) })
}); })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then("I am on page {string}", page => { defineStep('I am on page {string}', page => {
cy.location("pathname") cy.location('pathname')
.should("match", new RegExp(page)); .should('match', new RegExp(page))
}); })

View File

@ -1,6 +1,6 @@
import { Then } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
Then('I can see the following table:', table => { defineStep('I can see the following table:', table => {
const headers = table.raw()[0] const headers = table.raw()[0]
headers.forEach((expected, i) => { headers.forEach((expected, i) => {
cy.get('thead th') cy.get('thead th')

View File

@ -1,9 +1,9 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("I choose the following text as content:", text => { defineStep('I choose the following text as content:', text => {
cy.task('getValue', 'lastPost').then(lastPost => { cy.task('getValue', 'lastPost').then(lastPost => {
lastPost.content = text.replace("\n", " "); lastPost.content = text.replace('\n', ' ')
cy.task('pushValue', { name: 'lastPost', value: lastPost }) cy.task('pushValue', { name: 'lastPost', value: lastPost })
cy.get(".editor .ProseMirror").type(lastPost.content); cy.get('.editor .ProseMirror').type(lastPost.content)
}) })
}); })

View File

@ -1,6 +1,6 @@
import { When } from "@badeball/cypress-cucumber-preprocessor"; import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
When("I click on {string}", element => { defineStep('I click on {string}', element => {
const elementSelectors = { const elementSelectors = {
'submit button': 'button[name=submit]', 'submit button': 'button[name=submit]',
'create post button': '.post-add-button', 'create post button': '.post-add-button',
@ -15,5 +15,5 @@ When("I click on {string}", element => {
cy.get(elementSelectors[element]) cy.get(elementSelectors[element])
.click() .click()
.wait(750); .wait(750)
}); })

Some files were not shown because too many files have changed in this diff Show More