diff --git a/cypress/integration/UserProfile.SocialMedia.feature b/cypress/integration/UserProfile.SocialMedia.feature new file mode 100644 index 000000000..9862dcdd7 --- /dev/null +++ b/cypress/integration/UserProfile.SocialMedia.feature @@ -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 diff --git a/cypress/integration/UserProfile.SocialMedia/I_add_a_social_media_link.js b/cypress/integration/UserProfile.SocialMedia/I_add_a_social_media_link.js new file mode 100644 index 000000000..9253709f9 --- /dev/null +++ b/cypress/integration/UserProfile.SocialMedia/I_add_a_social_media_link.js @@ -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() +}) \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia/I_can_cancel_editing.js b/cypress/integration/UserProfile.SocialMedia/I_can_cancel_editing.js new file mode 100644 index 000000000..03d60c44a --- /dev/null +++ b/cypress/integration/UserProfile.SocialMedia/I_can_cancel_editing.js @@ -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) +}) \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia/I_delete_a_social_media_link.js b/cypress/integration/UserProfile.SocialMedia/I_delete_a_social_media_link.js new file mode 100644 index 000000000..10daffca1 --- /dev/null +++ b/cypress/integration/UserProfile.SocialMedia/I_delete_a_social_media_link.js @@ -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() +}) \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia/I_edit_and_save_the_link.js b/cypress/integration/UserProfile.SocialMedia/I_edit_and_save_the_link.js new file mode 100644 index 000000000..714e6b701 --- /dev/null +++ b/cypress/integration/UserProfile.SocialMedia/I_edit_and_save_the_link.js @@ -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() +}) \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia/I_have_added_a_social_media_link.js b/cypress/integration/UserProfile.SocialMedia/I_have_added_a_social_media_link.js new file mode 100644 index 000000000..203b97032 --- /dev/null +++ b/cypress/integration/UserProfile.SocialMedia/I_have_added_a_social_media_link.js @@ -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() +}) \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia/I_start_editing_a_social_media_link.js b/cypress/integration/UserProfile.SocialMedia/I_start_editing_a_social_media_link.js new file mode 100644 index 000000000..1da05cfa5 --- /dev/null +++ b/cypress/integration/UserProfile.SocialMedia/I_start_editing_a_social_media_link.js @@ -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() +}) \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia/the_new_social_media_link_shows_up_on_the_page.js b/cypress/integration/UserProfile.SocialMedia/the_new_social_media_link_shows_up_on_the_page.js new file mode 100644 index 000000000..e72546f2a --- /dev/null +++ b/cypress/integration/UserProfile.SocialMedia/the_new_social_media_link_shows_up_on_the_page.js @@ -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) +}) \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia/the_new_url_is_displayed.js b/cypress/integration/UserProfile.SocialMedia/the_new_url_is_displayed.js new file mode 100644 index 000000000..c25e6f0bb --- /dev/null +++ b/cypress/integration/UserProfile.SocialMedia/the_new_url_is_displayed.js @@ -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) +}) \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia/the_old_url_is_not_displayed.js b/cypress/integration/UserProfile.SocialMedia/the_old_url_is_not_displayed.js new file mode 100644 index 000000000..b3e804124 --- /dev/null +++ b/cypress/integration/UserProfile.SocialMedia/the_old_url_is_not_displayed.js @@ -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) +}) + \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia/they_should_be_able_to_see_my_social_media_links.js b/cypress/integration/UserProfile.SocialMedia/they_should_be_able_to_see_my_social_media_links.js new file mode 100644 index 000000000..249e4f420 --- /dev/null +++ b/cypress/integration/UserProfile.SocialMedia/they_should_be_able_to_see_my_social_media_links.js @@ -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) +}) \ No newline at end of file diff --git a/cypress/integration/common/.settings.js b/cypress/integration/common/.settings.js index 568cc49a0..a5a1cf16b 100644 --- a/cypress/integration/common/.settings.js +++ b/cypress/integration/common/.settings.js @@ -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) -}) +}) \ No newline at end of file diff --git a/cypress/integration/user_profile/.SocialMedia.feature b/cypress/integration/user_profile/.SocialMedia.feature deleted file mode 100644 index e6090a0a4..000000000 --- a/cypress/integration/user_profile/.SocialMedia.feature +++ /dev/null @@ -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