UserProfile.Avatar.feature

This commit is contained in:
Ulf Gebhardt 2021-04-11 22:58:20 +02:00
parent 00101a7c60
commit 2df140612a
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD
6 changed files with 46 additions and 55 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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