Added integration tests for uploading and displaying a user's profile header image. Adjusted existing tests for the profile image to make them more distinct.

This commit is contained in:
Dries Cruyskens 2020-06-12 18:30:46 +02:00
parent f62efe39fa
commit ca00968444
4 changed files with 47 additions and 2 deletions

View File

@ -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\)

View File

@ -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");
});

View File

@ -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

View File

@ -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
Then I cannot upload a profile picture