Files
gitea/tests/e2e/user-settings.test.ts
T
666e6e2d17 fix(web): allow clearing the full name in profile settings (#40186)
Clearing "Full Name" in the profile settings shows success but keeps the
old value: since #31959 it is only updated when non-empty, because the
input is disabled (not submitted) when `change_full_name` is disabled.

Use `*string` for the field, so a missing field keeps the value and an
empty one clears it. With `change_full_name` disabled, any submitted
value (including empty) is now rejected. Not `optional.Option[string]`,
because `MaxSize` would count slice elements instead of characters.

Fixes #40185

---
AI disclosure: written with Claude Code (claude-opus-5-5) and tested
locally.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2026-11-04 01:42:41 +00:00

29 lines
1.4 KiB
TypeScript

import {test, expect} from '@playwright/test';
import {login, loginUser, apiCreateUser, randomString} from './utils.ts';
test('update profile biography', async ({page, request}) => {
const username = `e2e-settings-${randomString(8)}`;
const bio = `e2e-bio-${randomString(8)}`;
await apiCreateUser(request, username);
await loginUser(page, username);
await page.goto('/user/settings');
await page.getByLabel('Biography').fill(bio);
await page.getByRole('button', {name: 'Update Profile'}).click();
await expect(page.getByText('Your profile has been updated.', {exact: true})).toBeVisible();
await expect(page.getByLabel('Biography')).toHaveValue(bio);
await page.getByLabel('Biography').fill('');
await page.getByRole('button', {name: 'Update Profile'}).click();
await expect(page.getByText('Your profile has been updated.', {exact: true})).toBeVisible();
await expect(page.getByLabel('Biography')).toHaveValue('');
});
test('select and deselect all webhook events', async ({page}) => {
await login(page);
await page.goto('/user/settings/hooks/gitea/new');
await page.getByRole('radio', {name: 'Custom Events'}).check();
await page.getByRole('button', {name: 'Select All', exact: true}).click();
await expect(page.getByRole('checkbox', {checked: false})).toHaveCount(0);
await page.getByRole('button', {name: 'Deselect All', exact: true}).click();
await expect(page.getByRole('checkbox', {checked: true})).toHaveAccessibleName('Active');
});