UserProfile.SocialMedia.feature

This commit is contained in:
Ulf Gebhardt 2021-04-11 22:31:54 +02:00
parent 7a06c0c5ed
commit 00101a7c60
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD
13 changed files with 118 additions and 118 deletions

View File

@ -0,0 +1,41 @@
Feature: List Social Media Accounts
As a User
I'd like to enter my social media
So I can show them to other users to get in contact
Background:
Given the following "users" are in the database:
| email | password | id | name | slug | termsAndConditionsAgreedVersion |
| peterpan@example.org | 123 | id-of-peter-pan | Peter Pan | peter-pan | 0.0.4 |
And I am logged in as "peter-pan"
Scenario: Adding Social Media
When I navigate to page "/settings/my-social-media"
Then I am on page "/settings/my-social-media"
When I add a social media link
Then I see a toaster with "Added social media"
And the new social media link shows up on the page
Scenario: Other users viewing my Social Media
Given I have added a social media link
When I navigate to page "/profile/peter-pan"
Then they should be able to see my social media links
Scenario: Deleting Social Media
When I navigate to page "/settings/my-social-media"
Then I am on page "/settings/my-social-media"
Given I have added a social media link
When I delete a social media link
Then I see a toaster with "Deleted social media"
Scenario: Editing Social Media
When I navigate to page "/settings/my-social-media"
Then I am on page "/settings/my-social-media"
Given I have added a social media link
When I start editing a social media link
Then I can cancel editing
When I start editing a social media link
And I edit and save the link
Then I see a toaster with "Added social media"
And the new url is displayed
But the old url is not displayed

View File

@ -0,0 +1,9 @@
import { When } from "cypress-cucumber-preprocessor/steps";
When('I add a social media link', () => {
cy.get('input#addSocialMedia')
.type('https://freeradical.zone/peter-pan')
.get('button')
.contains('Add link')
.click()
})

View File

@ -0,0 +1,8 @@
import { Then } from "cypress-cucumber-preprocessor/steps";
Then('I can cancel editing', () => {
cy.get('button#cancel')
.click()
.get('input#editSocialMedia')
.should('have.length', 0)
})

View File

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

View File

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

View File

@ -0,0 +1,10 @@
import { Given } from "cypress-cucumber-preprocessor/steps";
Given('I have added a social media link', () => {
cy.visit('/settings/my-social-media')
.get('input#addSocialMedia')
.type('https://freeradical.zone/peter-pan')
.get('button')
.contains('Add link')
.click()
})

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,8 @@
import { Then } from "cypress-cucumber-preprocessor/steps";
Then('they should be able to see my social media links', () => {
cy.get('.base-card')
.contains('Where else can I find Peter Pan?')
.get('a[href="https://freeradical.zone/peter-pan"]')
.should('have.length', 1)
})

View File

@ -15,79 +15,4 @@ Then('I should be on the {string} page', page => {
})
.get('h2')
.should('contain', 'Social media')
})
When('I add a social media link', () => {
cy.get('input#addSocialMedia')
.type('https://freeradical.zone/peter-pan')
.get('button')
.contains('Add link')
.click()
})
Then('it gets saved successfully', () => {
cy.get('.iziToast-message')
.should('contain', 'Added social media')
})
Then('the new social media link shows up on the page', () => {
cy.get('a[href="https://freeradical.zone/peter-pan"]')
.should('have.length', 1)
})
Given('I have added a social media link', () => {
cy.openPage('/settings/my-social-media')
.get('input#addSocialMedia')
.type('https://freeradical.zone/peter-pan')
.get('button')
.contains('Add link')
.click()
})
Then('they should be able to see my social media links', () => {
cy.get('.base-card')
.contains('Where else can I find Peter Pan?')
.get('a[href="https://freeradical.zone/peter-pan"]')
.should('have.length', 1)
})
When('I delete a social media link', () => {
cy.get(".base-button[title='Delete']")
.click()
})
Then('it gets deleted successfully', () => {
cy.get('.iziToast-message')
.should('contain', 'Deleted social media')
})
When('I start editing a social media link', () => {
cy.get(".base-button[title='Edit']")
.click()
})
Then('I can cancel editing', () => {
cy.get('button#cancel')
.click()
.get('input#editSocialMedia')
.should('have.length', 0)
})
When('I edit and save the link', () => {
cy.get('input#editSocialMedia')
.clear()
.type('https://freeradical.zone/tinkerbell')
.get('button')
.contains('Save')
.click()
})
Then('the new url is displayed', () => {
cy.get("a[href='https://freeradical.zone/tinkerbell']")
.should('have.length', 1)
})
Then('the old url is not displayed', () => {
cy.get("a[href='https://freeradical.zone/peter-pan']")
.should('have.length', 0)
})
})

View File

@ -1,42 +0,0 @@
Feature: List Social Media Accounts
As a User
I'd like to enter my social media
So I can show them to other users to get in contact
Background:
Given I have a user account
And I am logged in
Scenario: Adding Social Media
Given I am on the "settings" page
And I click on the "Social media" link
Then I should be on the "/settings/my-social-media" page
When I add a social media link
Then it gets saved successfully
And the new social media link shows up on the page
Scenario: Other users viewing my Social Media
Given I have added a social media link
When people visit my profile page
Then they should be able to see my social media links
Scenario: Deleting Social Media
Given I am on the "settings" page
And I click on the "Social media" link
Then I should be on the "/settings/my-social-media" page
Given I have added a social media link
When I delete a social media link
Then it gets deleted successfully
Scenario: Editing Social Media
Given I am on the "settings" page
And I click on the "Social media" link
Then I should be on the "/settings/my-social-media" page
Given I have added a social media link
When I start editing a social media link
Then I can cancel editing
When I start editing a social media link
And I edit and save the link
Then it gets saved successfully
And the new url is displayed
But the old url is not displayed