mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
UserProfile.Avatar.feature
This commit is contained in:
parent
00101a7c60
commit
2df140612a
20
cypress/integration/UserProfile.Avatar.feature
Normal file
20
cypress/integration/UserProfile.Avatar.feature
Normal 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
|
||||
@ -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");
|
||||
});
|
||||
@ -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);
|
||||
});
|
||||
@ -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
|
||||
|
||||
@ -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");
|
||||
});
|
||||
@ -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
|
||||
Loading…
x
Reference in New Issue
Block a user