diff --git a/cypress/features.md b/cypress/features.md index 60980703d..cc1bf3b91 100644 --- a/cypress/features.md +++ b/cypress/features.md @@ -38,6 +38,7 @@ The following features will be implemented. This gets done in three steps: * Upload and Change Avatar * Upload and Change Profile Picture +* Upload and Change Profile Header Image * Edit Social Media Accounts * Edit Locale information * Show and delete Bookmarks \(later\) diff --git a/cypress/integration/common/profile.js b/cypress/integration/common/profile.js index a0be8a2cf..e63ccea1d 100644 --- a/cypress/integration/common/profile.js +++ b/cypress/integration/common/profile.js @@ -24,13 +24,39 @@ Then("I should be able to change my profile picture", () => { ); }); +Then("I should be able to change my profile header picture", () => { + const headerUpload = "onourjourney.png"; + + cy.fixture(headerUpload, "base64").then(fileContent => { + cy.get("#profileHeaderDropzone").upload( + { fileContent, fileName: headerUpload, mimeType: "image/png" }, + { subjectType: "drag-n-drop", force: true } + ); + }); + cy.get(".profile-header-image") + .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", () => { +Then("I cannot upload a profile picture", () => { cy.get(".base-card") .children() .should("not.have.id", "customdropzone") .should("have.class", "user-avatar"); }); + + +Then("I cannot upload a profile header image", () => { + cy.get(".base-card") + .children() + .should("not.have.id", "profileHeaderDropzone") + .should("have.class", "profile-header"); +}); diff --git a/cypress/integration/user_profile/UploadUserProfileHeader.feature b/cypress/integration/user_profile/UploadUserProfileHeader.feature new file mode 100644 index 000000000..b27ad187d --- /dev/null +++ b/cypress/integration/user_profile/UploadUserProfileHeader.feature @@ -0,0 +1,18 @@ +Feature: Upload UserProfile Header + As a user + I would like to be able to add a profile header pic to my profile + So that I can personalize my profile + + + Background: + Given I have a user account + + Scenario: Change my UserProfile Header + Given I am logged in + And I visit my profile page + Then I should be able to change my profile header picture + + Scenario: Unable to change another user's header images + Given I am logged in with a "user" role + And I visit another user's profile page + Then I cannot upload a profile header image \ No newline at end of file diff --git a/cypress/integration/user_profile/UploadUserProfileImage.feature b/cypress/integration/user_profile/UploadUserProfileImage.feature index b46a31de8..6b972f180 100644 --- a/cypress/integration/user_profile/UploadUserProfileImage.feature +++ b/cypress/integration/user_profile/UploadUserProfileImage.feature @@ -15,4 +15,4 @@ Feature: Upload UserProfile Image 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 + Then I cannot upload a profile picture \ No newline at end of file