add integration test for editing social media

This commit is contained in:
Alina Beck 2019-07-16 13:06:34 +02:00
parent 05b6c63006
commit c2887c7b90
2 changed files with 47 additions and 3 deletions

View File

@ -79,7 +79,7 @@ Then('I should be on the {string} page', page => {
}) })
When('I add a social media link', () => { When('I add a social media link', () => {
cy.get("input[name='social-media']") cy.get('input#addSocialMedia')
.type('https://freeradical.zone/peter-pan') .type('https://freeradical.zone/peter-pan')
.get('button') .get('button')
.contains('Add link') .contains('Add link')
@ -98,7 +98,7 @@ Then('the new social media link shows up on the page', () => {
Given('I have added a social media link', () => { Given('I have added a social media link', () => {
cy.openPage('/settings/my-social-media') cy.openPage('/settings/my-social-media')
.get("input[name='social-media']") .get('input#addSocialMedia')
.type('https://freeradical.zone/peter-pan') .type('https://freeradical.zone/peter-pan')
.get('button') .get('button')
.contains('Add link') .contains('Add link')
@ -121,3 +121,34 @@ Then('it gets deleted successfully', () => {
cy.get('.iziToast-message') cy.get('.iziToast-message')
.should('contain', 'Deleted social media') .should('contain', 'Deleted social media')
}) })
When('I start editing a social media link', () => {
cy.get("a[name='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

@ -15,7 +15,7 @@ Feature: List Social Media Accounts
Then it gets saved successfully Then it gets saved successfully
And the new social media link shows up on the page And the new social media link shows up on the page
Scenario: Other user's viewing my Social Media Scenario: Other users viewing my Social Media
Given I have added a social media link Given I have added a social media link
When people visit my profile page When people visit my profile page
Then they should be able to see my social media links Then they should be able to see my social media links
@ -27,3 +27,16 @@ Feature: List Social Media Accounts
Given I have added a social media link Given I have added a social media link
When I delete a social media link When I delete a social media link
Then it gets deleted successfully 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