diff --git a/cypress/integration/UserProfile.Avatar.feature b/cypress/integration/UserProfile.Avatar.feature new file mode 100644 index 000000000..abb3fea63 --- /dev/null +++ b/cypress/integration/UserProfile.Avatar.feature @@ -0,0 +1,20 @@ +Feature: User profile - Upload avatar image + As a user + I would like to be able to add an avatar image to my profile + So that I can personalize my profile + + 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 | + | user@example.org | 123 | user | User | user | 0.0.4 | + And I am logged in as "peter-pan" + + Scenario: Change my UserProfile Image + And I navigate to page "/profile/peter-pan" + Then I should be able to change my profile picture + + Scenario: Unable to change another user's avatar + Given I am logged in as "user" + And I navigate to page "/profile/peter-pan" + Then I cannot upload a picture \ No newline at end of file diff --git a/cypress/integration/UserProfile.Avatar/I_cannot_upload_a_picture.js b/cypress/integration/UserProfile.Avatar/I_cannot_upload_a_picture.js new file mode 100644 index 000000000..d20a181f2 --- /dev/null +++ b/cypress/integration/UserProfile.Avatar/I_cannot_upload_a_picture.js @@ -0,0 +1,8 @@ +import { Then } from "cypress-cucumber-preprocessor/steps"; + +Then("I cannot upload a picture", () => { + cy.get(".base-card") + .children() + .should("not.have.id", "customdropzone") + .should("have.class", "user-avatar"); +}); \ No newline at end of file diff --git a/cypress/integration/UserProfile.Avatar/I_should_be_able_to_change_my_profile_picture.js b/cypress/integration/UserProfile.Avatar/I_should_be_able_to_change_my_profile_picture.js new file mode 100644 index 000000000..f92789ef8 --- /dev/null +++ b/cypress/integration/UserProfile.Avatar/I_should_be_able_to_change_my_profile_picture.js @@ -0,0 +1,17 @@ +import { Then } from "cypress-cucumber-preprocessor/steps"; + +Then("I should be able to change my profile picture", () => { + const avatarUpload = "onourjourney.png"; + + cy.fixture(avatarUpload, "base64").then(fileContent => { + cy.get("#customdropzone").upload( + { fileContent, fileName: avatarUpload, mimeType: "image/png" }, + { subjectType: "drag-n-drop", force: true } + ); + }); + cy.get(".profile-avatar img") + .should("have.attr", "src") + .and("contains", "onourjourney"); + cy.contains(".iziToast-message", "Upload successful") + .should("have.length",1); +}); \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia.feature b/cypress/integration/UserProfile.SocialMedia.feature index 9862dcdd7..5ab1feb25 100644 --- a/cypress/integration/UserProfile.SocialMedia.feature +++ b/cypress/integration/UserProfile.SocialMedia.feature @@ -1,4 +1,4 @@ -Feature: List Social Media Accounts +Feature: User profile - 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 diff --git a/cypress/integration/common/.profile.js b/cypress/integration/common/.profile.js deleted file mode 100644 index a0be8a2cf..000000000 --- a/cypress/integration/common/.profile.js +++ /dev/null @@ -1,36 +0,0 @@ -import { When, Then } from "cypress-cucumber-preprocessor/steps"; - -/* global cy */ - -When("I visit my profile page", () => { - cy.openPage("profile/peter-pan"); -}); - -Then("I should be able to change my profile picture", () => { - const avatarUpload = "onourjourney.png"; - - cy.fixture(avatarUpload, "base64").then(fileContent => { - cy.get("#customdropzone").upload( - { fileContent, fileName: avatarUpload, mimeType: "image/png" }, - { subjectType: "drag-n-drop", force: true } - ); - }); - cy.get(".profile-avatar img") - .should("have.attr", "src") - .and("contains", "onourjourney"); - cy.contains(".iziToast-message", "Upload successful").should( - "have.length", - 1 - ); -}); - -When("I visit another user's profile page", () => { - cy.openPage("profile/peter-pan"); -}); - -Then("I cannot upload a picture", () => { - cy.get(".base-card") - .children() - .should("not.have.id", "customdropzone") - .should("have.class", "user-avatar"); -}); diff --git a/cypress/integration/user_profile/.UploadUserProfileImage.feature b/cypress/integration/user_profile/.UploadUserProfileImage.feature deleted file mode 100644 index b46a31de8..000000000 --- a/cypress/integration/user_profile/.UploadUserProfileImage.feature +++ /dev/null @@ -1,18 +0,0 @@ -Feature: Upload UserProfile Image - As a user - I would like to be able to add an avatar/profile pic to my profile - So that I can personalize my profile - - - Background: - Given I have a user account - - Scenario: Change my UserProfile Image - Given I am logged in - And I visit my profile page - Then I should be able to change my profile picture - - Scenario: Unable to change another user's avatar - Given I am logged in with a "user" role - And I visit another user's profile page - Then I cannot upload a picture \ No newline at end of file