diff --git a/cypress/integration/common/settings.js b/cypress/integration/common/settings.js index 664ffcff8..b32924f6a 100644 --- a/cypress/integration/common/settings.js +++ b/cypress/integration/common/settings.js @@ -79,7 +79,7 @@ Then('I should be on the {string} page', page => { }) When('I add a social media link', () => { - cy.get("input[name='social-media']") + cy.get('input#addSocialMedia') .type('https://freeradical.zone/peter-pan') .get('button') .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', () => { cy.openPage('/settings/my-social-media') - .get("input[name='social-media']") + .get('input#addSocialMedia') .type('https://freeradical.zone/peter-pan') .get('button') .contains('Add link') @@ -121,3 +121,34 @@ Then('it gets deleted successfully', () => { cy.get('.iziToast-message') .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) +}) diff --git a/cypress/integration/user_profile/SocialMedia.feature b/cypress/integration/user_profile/SocialMedia.feature index d21167c6b..e6090a0a4 100644 --- a/cypress/integration/user_profile/SocialMedia.feature +++ b/cypress/integration/user_profile/SocialMedia.feature @@ -15,7 +15,7 @@ Feature: List Social Media Accounts Then it gets saved successfully 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 When people visit my profile page 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 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