-
Notifications
You must be signed in to change notification settings - Fork 41
feat: π° Webapp, Backend β User Profile β Display, Select and Upload User Profile Header Image #3634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: π° Webapp, Backend β User Profile β Display, Select and Upload User Profile Header Image #3634
Changes from 5 commits
a551959
f62efe3
ca00968
0b8deba
213ce12
e40eda6
ad4862e
4f18df1
9819992
977156c
dcaa2cf
927e389
c6ec32b
eef33a2
51efbe4
3234012
b30ed6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,6 +168,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] | |
}, | ||
{ | ||
email: '[email protected]', | ||
profileHeader: Factory.build('image'), | ||
}, | ||
), | ||
Factory.build( | ||
|
@@ -192,6 +193,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] | |
}, | ||
{ | ||
email: '[email protected]', | ||
profileHeader: Factory.build('image'), | ||
}, | ||
), | ||
Factory.build( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,9 @@ const statisticsQuery = gql` | |
} | ||
} | ||
` | ||
beforeAll(() => { | ||
beforeAll(async () => { | ||
// Clean the database so no artifacts from other test files are interfering. | ||
await cleanDatabase() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@@ -21,7 +21,9 @@ const statisticsQuery = gql`
}
}
`
-beforeAll(() => {
+beforeAll(async () => {
+ // Clean the database so no artifacts from other test files are interfering.
+ await cleanDatabase() πππΌ |
||
authenticatedUser = undefined | ||
const { server } = createServer({ | ||
context: () => { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,6 +109,9 @@ describe('currentUser', () => { | |
avatar { | ||
url | ||
} | ||
profileHeader { | ||
url | ||
} | ||
role | ||
} | ||
|
@@ -142,6 +145,9 @@ describe('currentUser', () => { | |
avatar: Factory.build('image', { | ||
url: 'https://s3.amazonaws.com/uifaces/faces/twitter/jimmuirhead/128.jpg', | ||
}), | ||
profileHeader: Factory.build('image', { | ||
url: 'https://s3.amazonaws.com/uifaces/faces/twitter/hellofeverrrr/128.jpg', | ||
}), | ||
}, | ||
) | ||
const userBearerToken = encode({ id: 'u3' }) | ||
|
@@ -156,6 +162,9 @@ describe('currentUser', () => { | |
avatar: Factory.build('image', { | ||
url: 'https://s3.amazonaws.com/uifaces/faces/twitter/jimmuirhead/128.jpg', | ||
}), | ||
profileHeader: Factory.build('image', { | ||
url: 'https://s3.amazonaws.com/uifaces/faces/twitter/hellofeverrrr/128.jpg', | ||
}), | ||
email: '[email protected]', | ||
name: 'Matilde Hermiston', | ||
slug: 'matilde-hermiston', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -341,11 +341,17 @@ describe('DeleteUser', () => { | |
beforeEach(async () => { | ||
variables = { id: ' u343', resource: [] } | ||
|
||
user = await Factory.build('user', { | ||
name: 'My name should be deleted', | ||
about: 'along with my about', | ||
id: 'u343', | ||
}) | ||
user = await Factory.build( | ||
'user', | ||
{ | ||
name: 'My name should be deleted', | ||
about: 'along with my about', | ||
id: 'u343', | ||
}, | ||
{ | ||
profileHeader: Factory.build('image'), | ||
}, | ||
) | ||
}) | ||
|
||
describe('authenticated as Admin', () => { | ||
|
@@ -496,8 +502,8 @@ describe('DeleteUser', () => { | |
).resolves.toMatchObject(expectedResponse) | ||
}) | ||
|
||
it('deletes user avatar and post hero images', async () => { | ||
await expect(neode.all('Image')).resolves.toHaveLength(22) | ||
it('deletes user avatar, profile header and post hero images', async () => { | ||
await expect(neode.all('Image')).resolves.toHaveLength(23) | ||
await mutate({ mutation: deleteUserMutation, variables }) | ||
await expect(neode.all('Image')).resolves.toHaveLength(20) | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@@ -496,8 +502,8 @@ describe('DeleteUser', () => {
).resolves.toMatchObject(expectedResponse)
})
- it('deletes user avatar and post hero images', async () => {
- await expect(neode.all('Image')).resolves.toHaveLength(22)
+ it('deletes user avatar, profile header and post hero images', async () => {
+ await expect(neode.all('Image')).resolves.toHaveLength(23)
await mutate({ mutation: deleteUserMutation, variables })
await expect(neode.all('Image')).resolves.toHaveLength(20)
}) Thanks to add this test! π« |
||
|
@@ -627,11 +633,17 @@ describe('DeleteUser', () => { | |
beforeEach(async () => { | ||
variables = { id: 'u343', resource: [] } | ||
|
||
user = await Factory.build('user', { | ||
name: 'My name should be deleted', | ||
about: 'along with my about', | ||
id: 'u343', | ||
}) | ||
user = await Factory.build( | ||
'user', | ||
{ | ||
name: 'My name should be deleted', | ||
about: 'along with my about', | ||
id: 'u343', | ||
}, | ||
{ | ||
profileHeader: Factory.build('image'), | ||
}, | ||
) | ||
await Factory.build( | ||
'user', | ||
{ | ||
|
@@ -792,8 +804,8 @@ describe('DeleteUser', () => { | |
).resolves.toMatchObject(expectedResponse) | ||
}) | ||
|
||
it('deletes user avatar and post hero images', async () => { | ||
await expect(neode.all('Image')).resolves.toHaveLength(22) | ||
it('deletes user avatar, profile header and post hero images', async () => { | ||
await expect(neode.all('Image')).resolves.toHaveLength(23) | ||
await mutate({ mutation: deleteUserMutation, variables }) | ||
await expect(neode.all('Image')).resolves.toHaveLength(20) | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@@ -792,8 +804,8 @@ describe('DeleteUser', () => {
).resolves.toMatchObject(expectedResponse)
})
- it('deletes user avatar and post hero images', async () => {
- await expect(neode.all('Image')).resolves.toHaveLength(22)
+ it('deletes user avatar, profile header and post hero images', async () => {
+ await expect(neode.all('Image')).resolves.toHaveLength(23)
await mutate({ mutation: deleteUserMutation, variables })
await expect(neode.all('Image')).resolves.toHaveLength(20)
}) Great! π« |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@@ -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 Thanks very much that you thought about changing this doc as well. π |
||
* Edit Social Media Accounts | ||
* Edit Locale information | ||
* Show and delete Bookmarks \(later\) | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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"); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@@ -28,9 +46,17 @@ 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-card"); I suspect the fix you did changing tldr; The error regarding this test should be fixed by changing line 61 back to
Suggested change
|
||||||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Feature: Upload UserProfile Header | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,18 @@
+Feature: Upload UserProfile Header Hey, very good you add this e2e test! π€π |
||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@@ -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 Cool youβve clarified this as well! πππΌ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice you added this! π
But the
await
is missing:would be correct.