feat(e2e): group create feature (#8636)

Co-authored-by: mahula <lenzmath@posteo.de>
This commit is contained in:
Moriz Wahl 2025-06-06 16:47:05 +02:00 committed by GitHub
parent aaf3b34125
commit b67c9fd7cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,27 @@
Feature: Create a group
As an logged in user
I would like to create a group
To invite my friends
Background:
Given the following "users" are in the database:
| slug | email | password | id | name | termsAndConditionsAgreedVersion |
| narrator | narrator@example.org | 1234 | narrator | Nathan Narrator | 0.0.4 |
And I am logged in as "narrator"
And I navigate to page "/groups"
Scenario: Create a group
When I click on "create group button"
Then I am on page "groups/create"
When I choose "My group " as the name
And I choose "public" as the visibility
And I choose "to invite my friends" as the about
And I choose the following text as description:
"""
This is the group where I want to exchange
my views with my friends.
"""
And I choose "regional" as the action radius
And I click on "save button"
Then I am on page "/groups/.*/my-group"
And the group was saved successfully

View File

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

View File

@ -0,0 +1,9 @@
import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
defineStep('I choose {string} as the about', about => {
cy.task('getValue', 'lastGroup').then(lastGroup => {
lastGroup.about = about.replace('\n', ' ')
cy.task('pushValue', { name: 'lastGroup', value: lastGroup })
cy.get('input[name="about"]').type(lastGroup.about)
})
})

View File

@ -0,0 +1,9 @@
import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
defineStep('I choose {string} as the action radius', actionRadius => {
cy.task('getValue', 'lastGroup').then(lastGroup => {
lastGroup.actionRadius = actionRadius.replace('\n', ' ')
cy.task('pushValue', { name: 'lastGroup', value: lastGroup })
cy.get('select[name="actionRadius"]').select(lastGroup.actionRadius)
})
})

View File

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

View File

@ -0,0 +1,9 @@
import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
defineStep('I choose {string} as the visibility', groupType => {
cy.task('getValue', 'lastGroup').then(lastGroup => {
lastGroup.groupType = groupType.replace('\n', ' ')
cy.task('pushValue', { name: 'lastGroup', value: lastGroup })
cy.get('select[name="groupType"]').select(lastGroup.groupType)
})
})

View File

@ -0,0 +1,7 @@
import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
defineStep('the group was saved successfully', () => {
cy.task('getValue', 'lastGroup').then(lastGroup => {
cy.get('h3.ds-heading').should('contain', lastGroup.name)
})
})

View File

@ -4,6 +4,7 @@ defineStep('I click on {string}', element => {
const elementSelectors = {
'submit button': 'button[name=submit]',
'create post button': '.post-add-button',
'create group button': '.group-add-button',
'save button': 'button[type=submit]',
'the first post': '.post-teaser:first-child',
'comment button': 'button[type=submit]',