Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ Feature: profile photo
When "Alice" uploads the profile image "testavatar.jpeg"
Then "Alice" should have a profile picture

And "Admin" logs in
And "Admin" opens the "admin-settings" app
When "Admin" navigates to the users management page
Then "Admin" sees profile photo of the user "Alice"
And "Admin" logs out

When "Alice" changes the profile image "testavatar.png"
Then "Alice" should have a profile picture

Expand Down
10 changes: 10 additions & 0 deletions tests/e2e/cucumber/steps/ui/adminSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,3 +552,13 @@ When(
await spacesObject.select({ key: value })
}
)

Then(
'{string} sees profile photo of the user {string}',
async function (this: World, stepUser: string, key: string): Promise<void> {
const { page } = this.actorsEnvironment.getActor({ key: stepUser })
const usersObject = new objects.applicationAdminSettings.Users({ page })
const userProfilePicture = usersObject.getUserProfilePicture({ key })
await expect(userProfilePicture).toHaveAttribute('src', /.+/)
}
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page } from '@playwright/test'
import { Page, Locator } from '@playwright/test'
import util from 'util'
import { UsersEnvironment } from '../../../environment'

Expand Down Expand Up @@ -34,6 +34,7 @@ const userNameInput = '#create-user-input-user-name'
const displayNameInput = '#create-user-input-display-name'
const emailInput = '#create-user-input-email'
const passwordInput = '#create-user-input-password'
const userAvatarImg = `[data-item-id="%s"] .oc-avatar .avatarImg`

export interface UserInterface {
displayName: string
Expand Down Expand Up @@ -425,3 +426,8 @@ const getGroupId = (group: string): string => {
const usersEnvironment = new UsersEnvironment()
return usersEnvironment.getCreatedGroupByDisplayName(group).uuid
}

export const getUserProfilePicture = (args: { page: Page; uuid: string }): Locator => {
const { page, uuid } = args
return page.locator(util.format(userAvatarImg, uuid))
}
6 changes: 5 additions & 1 deletion tests/e2e/support/objects/app-admin-settings/users/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page } from '@playwright/test'
import { Page, Locator } from '@playwright/test'
import { UsersEnvironment } from '../../../environment'
import * as po from './actions'

Expand Down Expand Up @@ -186,4 +186,8 @@ export class Users {
async waitForEditPanelToBeVisible(): Promise<void> {
await po.waitForEditPanelToBeVisible({ page: this.#page })
}

getUserProfilePicture({ key }: { key: string }): Locator {
return po.getUserProfilePicture({ page: this.#page, uuid: this.getUUID({ key }) })
}
}
Loading