diff --git a/cypress/cypress.json b/cypress/cypress.json index 3f41ca3e5..dbe8691fa 100644 --- a/cypress/cypress.json +++ b/cypress/cypress.json @@ -1,5 +1,6 @@ { "projectId": "qa7fe2", + "defaultCommandTimeout": 10000, "ignoreTestFiles": "*.js", "chromeWebSecurity": false, "baseUrl": "http://localhost:3000", diff --git a/cypress/integration/UserProfile.SocialMedia.feature b/cypress/integration/UserProfile.SocialMedia.feature index 5ab1feb25..04c227661 100644 --- a/cypress/integration/UserProfile.SocialMedia.feature +++ b/cypress/integration/UserProfile.SocialMedia.feature @@ -13,29 +13,29 @@ Feature: User profile - list social media accounts 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" + Then I see a toaster with status "success" 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 + Given I have added the social media link "https://freeradical.zone/peter-pan" 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" + Given I have added the social media link "https://freeradical.zone/peter-pan" + When I delete the social media link "https://freeradical.zone/peter-pan" + Then I see a toaster with status "success" 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 + Given I have added the social media link "https://freeradical.zone/peter-pan" 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" + Then I see a toaster with status "success" 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 index ca2e36818..07c80b30c 100644 --- a/cypress/integration/UserProfile.SocialMedia/I_add_a_social_media_link.js +++ b/cypress/integration/UserProfile.SocialMedia/I_add_a_social_media_link.js @@ -1,12 +1,10 @@ import { When } from "cypress-cucumber-preprocessor/steps"; When('I add a social media link', () => { - cy.get('button') - .contains('Add link') + cy.get('[data-test="add-save-button"]') .click() .get('#editSocialMedia') .type('https://freeradical.zone/peter-pan') - .get('button') - .contains('Save') + .get('[data-test="add-save-button"]') .click() }) \ 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 deleted file mode 100644 index 73fd0a16e..000000000 --- a/cypress/integration/UserProfile.SocialMedia/I_delete_a_social_media_link.js +++ /dev/null @@ -1,7 +0,0 @@ -import { When } from "cypress-cucumber-preprocessor/steps"; - -When('I delete a social media link', () => { - cy.get(".base-button[title='Delete']") - .click() - // TODO: add delition confirmation modal click, see issue -}) \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia/I_delete_the_social_media_link_{string}.js b/cypress/integration/UserProfile.SocialMedia/I_delete_the_social_media_link_{string}.js new file mode 100644 index 000000000..6b65e361b --- /dev/null +++ b/cypress/integration/UserProfile.SocialMedia/I_delete_the_social_media_link_{string}.js @@ -0,0 +1,12 @@ +import { When } from "cypress-cucumber-preprocessor/steps"; + +When('I delete the social media link {string}', (link) => { + cy.get('[data-test="delete-button"]') + .click() + cy.get('[data-test="confirm-modal"]') + .should("be.visible") + cy.get('[data-test="confirm-button"]') + .click() + cy.get('.ds-list-item-content > a') + .contains(link).should('not.exist') +}) \ 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 index 714e6b701..54712920d 100644 --- a/cypress/integration/UserProfile.SocialMedia/I_edit_and_save_the_link.js +++ b/cypress/integration/UserProfile.SocialMedia/I_edit_and_save_the_link.js @@ -4,7 +4,6 @@ When('I edit and save the link', () => { cy.get('input#editSocialMedia') .clear() .type('https://freeradical.zone/tinkerbell') - .get('button') - .contains('Save') + .get('[data-test="add-save-button"]') .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 deleted file mode 100644 index 93e35bf28..000000000 --- a/cypress/integration/UserProfile.SocialMedia/I_have_added_a_social_media_link.js +++ /dev/null @@ -1,13 +0,0 @@ -import { Given } from "cypress-cucumber-preprocessor/steps"; - -Given('I have added a social media link', () => { - cy.visit('/settings/my-social-media') - .get('button') - .contains('Add link') - .click() - .get('#editSocialMedia') - .type('https://freeradical.zone/peter-pan') - .get('button') - .contains('Save') - .click() -}) \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia/I_have_added_the_social_media_link_{string}.js b/cypress/integration/UserProfile.SocialMedia/I_have_added_the_social_media_link_{string}.js new file mode 100644 index 000000000..78a0191d2 --- /dev/null +++ b/cypress/integration/UserProfile.SocialMedia/I_have_added_the_social_media_link_{string}.js @@ -0,0 +1,13 @@ +import { Given } from "cypress-cucumber-preprocessor/steps"; + +Given('I have added the social media link {string}', (link) => { + cy.visit('/settings/my-social-media') + .get('[data-test="add-save-button"]') + .click() + .get('#editSocialMedia') + .type(link) + .get('[data-test="add-save-button"]') + .click() + cy.get('.ds-list-item-content > a') + .contains(link) +}) \ 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 index 1da05cfa5..e3e5c2a22 100644 --- 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 @@ -1,6 +1,6 @@ import { When } from "cypress-cucumber-preprocessor/steps"; When('I start editing a social media link', () => { - cy.get(".base-button[title='Edit']") + cy.get('[data-test="edit-button"]') .click() }) \ 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 index 249e4f420..89db2bd77 100644 --- 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 @@ -1,8 +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?') + cy.get('[data-test="social-media-list-headline"]') + .contains('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/I_see_a_toaster_with_status_{string}.js b/cypress/integration/common/I_see_a_toaster_with_status_{string}.js new file mode 100644 index 000000000..aa07d787c --- /dev/null +++ b/cypress/integration/common/I_see_a_toaster_with_status_{string}.js @@ -0,0 +1,9 @@ +import { Then } from "cypress-cucumber-preprocessor/steps"; + +Then("I see a toaster with status {string}", (status) => { + switch (status) { + case "success": + cy.get(".iziToast.iziToast-color-green").should("be.visible"); + break; + } +}) \ No newline at end of file diff --git a/webapp/components/Modal/ConfirmModal.vue b/webapp/components/Modal/ConfirmModal.vue index 87dc4963a..e94bd1f94 100644 --- a/webapp/components/Modal/ConfirmModal.vue +++ b/webapp/components/Modal/ConfirmModal.vue @@ -1,5 +1,5 @@