From 62a23975f34b9e8ec5b544abc24b75ebeab5a411 Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Tue, 4 Nov 2025 12:59:20 +0100 Subject: [PATCH] check user avatar in the admin settings->users --- .../features/user-settings/profilePhoto.feature | 6 ++++++ tests/e2e/cucumber/steps/ui/adminSettings.ts | 10 ++++++++++ .../objects/app-admin-settings/users/actions.ts | 8 +++++++- .../support/objects/app-admin-settings/users/index.ts | 6 +++++- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/tests/e2e/cucumber/features/user-settings/profilePhoto.feature b/tests/e2e/cucumber/features/user-settings/profilePhoto.feature index d2ed6315b7..535f2d9d69 100644 --- a/tests/e2e/cucumber/features/user-settings/profilePhoto.feature +++ b/tests/e2e/cucumber/features/user-settings/profilePhoto.feature @@ -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 diff --git a/tests/e2e/cucumber/steps/ui/adminSettings.ts b/tests/e2e/cucumber/steps/ui/adminSettings.ts index 488452491b..53ff9a3dae 100644 --- a/tests/e2e/cucumber/steps/ui/adminSettings.ts +++ b/tests/e2e/cucumber/steps/ui/adminSettings.ts @@ -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 { + const { page } = this.actorsEnvironment.getActor({ key: stepUser }) + const usersObject = new objects.applicationAdminSettings.Users({ page }) + const userProfilePicture = usersObject.getUserProfilePicture({ key }) + await expect(userProfilePicture).toHaveAttribute('src', /.+/) + } +) diff --git a/tests/e2e/support/objects/app-admin-settings/users/actions.ts b/tests/e2e/support/objects/app-admin-settings/users/actions.ts index 29b06a10b7..f0680f2c35 100644 --- a/tests/e2e/support/objects/app-admin-settings/users/actions.ts +++ b/tests/e2e/support/objects/app-admin-settings/users/actions.ts @@ -1,4 +1,4 @@ -import { Page } from '@playwright/test' +import { Page, Locator } from '@playwright/test' import util from 'util' import { UsersEnvironment } from '../../../environment' @@ -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 @@ -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)) +} diff --git a/tests/e2e/support/objects/app-admin-settings/users/index.ts b/tests/e2e/support/objects/app-admin-settings/users/index.ts index 627c36bb6d..f5d621eb0c 100644 --- a/tests/e2e/support/objects/app-admin-settings/users/index.ts +++ b/tests/e2e/support/objects/app-admin-settings/users/index.ts @@ -1,4 +1,4 @@ -import { Page } from '@playwright/test' +import { Page, Locator } from '@playwright/test' import { UsersEnvironment } from '../../../environment' import * as po from './actions' @@ -186,4 +186,8 @@ export class Users { async waitForEditPanelToBeVisible(): Promise { await po.waitForEditPanelToBeVisible({ page: this.#page }) } + + getUserProfilePicture({ key }: { key: string }): Locator { + return po.getUserProfilePicture({ page: this.#page, uuid: this.getUUID({ key }) }) + } }