snapshot of https://github.com/mattermost/mattermost.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 2s
Server CI Nightly Race / Build Environment (push) Failing after 1s

This commit is contained in:
upstream-mirror
2026-09-16 00:29:55 +05:00
commit 240db4e2a7
15309 changed files with 2173406 additions and 0 deletions

View File

@@ -0,0 +1,117 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {expect, test} from '@mattermost/playwright-lib';
/**
* @objective Verify a system admin can edit a team's name and description from the
* System Console Team Configuration page and that the changes are persisted.
*/
test('edits team name and description from the System Console', {tag: '@system_console'}, async ({pw}) => {
const {adminUser, adminClient} = await pw.initSetup();
// # Create a team with a known name and description
const initialDescription = 'Initial team description';
const team = await adminClient.createTeam({
...(await pw.random.team()),
description: initialDescription,
});
// # Log in as a system admin and open the Team Configuration page
const {systemConsolePage} = await pw.testBrowser.login(adminUser);
const {page} = systemConsolePage;
await page.goto(`/admin_console/user_management/teams/${team.id}`);
const nameInput = page.getByTestId('teamNameInput');
const descriptionInput = page.getByTestId('teamDescriptionInput');
// * Verify the fields are prefilled with the current team values
await expect(nameInput).toHaveValue(team.display_name);
await expect(descriptionInput).toHaveValue(initialDescription);
// # Edit the team name and description
const newName = `Edited Name ${pw.random.id()}`;
const newDescription = 'Edited team description';
await nameInput.fill(newName);
await descriptionInput.fill(newDescription);
// # Save the changes
await page.getByTestId('saveSetting').click();
// * Verify the page returns to the teams list after a successful save
await page.waitForURL(/\/admin_console\/user_management\/teams$/);
// * Verify the changes were persisted on the server
const updatedTeam = await adminClient.getTeam(team.id);
expect(updatedTeam.display_name).toBe(newName);
expect(updatedTeam.description).toBe(newDescription);
});
/**
* @objective Verify saving a too-short team name is blocked with an inline validation
* error and does not persist the change.
*/
test('blocks saving a team name shorter than the minimum length', {tag: '@system_console'}, async ({pw}) => {
const {adminUser, adminClient} = await pw.initSetup();
// # Create a team to edit
const team = await adminClient.createTeam(await pw.random.team());
// # Log in as a system admin and open the Team Configuration page
const {systemConsolePage} = await pw.testBrowser.login(adminUser);
const {page} = systemConsolePage;
await page.goto(`/admin_console/user_management/teams/${team.id}`);
const nameInput = page.getByTestId('teamNameInput');
await expect(nameInput).toHaveValue(team.display_name);
// # Enter a name below the minimum length and try to save
await nameInput.fill('a');
await page.getByTestId('saveSetting').click();
// * Verify an inline validation error is shown and the page stays on the team
await expect(page.getByText('Team name must be 2 or more characters')).toBeVisible();
expect(new URL(page.url()).pathname).toBe(`/admin_console/user_management/teams/${team.id}`);
// * Verify the team name was not changed on the server
const unchangedTeam = await adminClient.getTeam(team.id);
expect(unchangedTeam.display_name).toBe(team.display_name);
});
/**
* @objective Verify that toggling Archive Team with a too-short team name surfaces the
* inline validation error on Save instead of leaving the "Save and Archive Team"
* confirmation modal stuck open with no feedback.
*/
test('blocks archiving a team when the team name is invalid', {tag: '@system_console'}, async ({pw}) => {
const {adminUser, adminClient} = await pw.initSetup();
// # Create a team to edit
const team = await adminClient.createTeam(await pw.random.team());
// # Log in as a system admin and open the Team Configuration page
const {systemConsolePage} = await pw.testBrowser.login(adminUser);
const {page} = systemConsolePage;
await page.goto(`/admin_console/user_management/teams/${team.id}`);
const nameInput = page.getByTestId('teamNameInput');
await expect(nameInput).toHaveValue(team.display_name);
// # Enter a name below the minimum length, then toggle the team to be archived
await nameInput.fill('a');
await page.getByRole('button', {name: 'Archive Team'}).click();
// # Try to save the archive
await page.getByTestId('saveSetting').click();
// * Verify the inline validation error is shown
await expect(page.getByText('Team name must be 2 or more characters')).toBeVisible();
// * Verify the Save and Archive Team confirmation modal did not open
await expect(page.getByText('Save and Archive Team')).not.toBeVisible();
// * Verify the team was neither renamed nor archived on the server
const unchangedTeam = await adminClient.getTeam(team.id);
expect(unchangedTeam.display_name).toBe(team.display_name);
expect(unchangedTeam.delete_at).toBe(0);
});