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,112 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {expect, test} from '@mattermost/playwright-lib';
/**
* @objective Verify that a user who belongs to multiple teams can switch between them and log out to the sign-in page.
*
* MM-T432 is a duplicate of MM-T430 and is covered by this test.
*/
test('MM-T430 MM-T432 switches between teams and logs out', {tag: '@multi_team'}, async ({pw}) => {
// # Create a user in one team, then add them to a second team
const {user, team, adminClient} = await pw.initSetup();
const secondTeam = await pw.createNewTeam(adminClient, {
name: 'team',
displayName: 'Second Team',
type: 'O',
unique: true,
});
await adminClient.addToTeam(secondTeam.id, user.id);
const {channelsPage, page} = await pw.testBrowser.login(user);
await channelsPage.goto(team.name, 'off-topic');
await channelsPage.toBeVisible();
// # Switch to the second team
await channelsPage.switchToTeam(secondTeam.name);
// * Verify the second team is displayed
await expect.poll(() => page.url(), {timeout: pw.duration.ten_sec}).toContain(`/${secondTeam.name}/`);
// # Switch back to the first team
await channelsPage.switchToTeam(team.name);
// * Verify the first team is displayed
await expect.poll(() => page.url(), {timeout: pw.duration.ten_sec}).toContain(`/${team.name}/`);
// # Log out
await channelsPage.logout();
// * Verify the user is returned to the sign-in page
await expect.poll(() => page.url(), {timeout: pw.duration.ten_sec}).toContain('/login');
});
/**
* @objective Verify that reopening the app returns the user to the previously viewed team and channel.
*/
test('MM-T431 reopens to the previously viewed team and channel', {tag: '@multi_team'}, async ({pw}) => {
// # Create a user in one team, then add them to a second team
const {user, team, adminClient} = await pw.initSetup();
const secondTeam = await pw.createNewTeam(adminClient, {
name: 'team',
displayName: 'Second Team',
type: 'O',
unique: true,
});
await adminClient.addToTeam(secondTeam.id, user.id);
const {channelsPage, page} = await pw.testBrowser.login(user);
await channelsPage.goto(team.name, 'town-square');
await channelsPage.toBeVisible();
// # Switch to the second team and view its Off-Topic channel
await channelsPage.switchToTeam(secondTeam.name);
await channelsPage.sidebarLeft.goToItem('off-topic');
await expect
.poll(() => page.url(), {timeout: pw.duration.ten_sec})
.toContain(`/${secondTeam.name}/channels/off-topic`);
// # Reopen the app by navigating to the root URL
await page.goto('/');
// * Verify the app returns to the previously viewed team and channel
await channelsPage.toBeVisible();
await expect
.poll(() => page.url(), {timeout: pw.duration.ten_sec})
.toContain(`/${secondTeam.name}/channels/off-topic`);
});
/**
* @objective Verify that the right-hand-side reply panel can be expanded to overlay the center channel and collapsed back while staying open.
*/
test('MM-T440 expands and collapses the RHS reply panel', {tag: '@multi_team'}, async ({pw}) => {
// # Create and log in as a test user
const {user, team} = await pw.initSetup();
const {channelsPage} = await pw.testBrowser.login(user);
await channelsPage.goto(team.name, 'town-square');
await channelsPage.toBeVisible();
// # Post a message and open its thread in the RHS
await channelsPage.postMessage(`rhs expand ${pw.random.id()}`);
const post = await channelsPage.getLastPost();
await post.reply();
await channelsPage.sidebarRight.toBeVisible();
// * Verify the RHS starts collapsed with an expand control
await expect(channelsPage.sidebarRight.expandButton).toBeVisible();
// # Expand the RHS
await channelsPage.sidebarRight.expand();
// * Verify the RHS is expanded (a collapse control is now shown)
await expect(channelsPage.sidebarRight.collapseButton).toBeVisible();
// # Collapse the RHS again
await channelsPage.sidebarRight.collapse();
// * Verify the RHS collapses but stays open, and the center channel is visible again
await expect(channelsPage.sidebarRight.expandButton).toBeVisible();
await channelsPage.sidebarRight.toBeVisible();
await expect(channelsPage.centerView.postCreate.input).toBeVisible();
});

View File

@@ -0,0 +1,88 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {expect, test} from '@mattermost/playwright-lib';
/**
* @objective Verify that a user viewing a team can leave it, is moved to another team they belong to, and
* can rejoin the team they left.
*/
test('MM-T2547 leaves a team while viewing it and rejoins it', {tag: '@multi_team'}, async ({pw}) => {
const {user, team, adminClient} = await pw.initSetup();
// # Make the team open so it can be rejoined from the team selection page
await adminClient.patchTeam({id: team.id, allow_open_invite: true});
// # Add the user to a second team so there is another team to fall back to
const secondTeam = await pw.createNewTeam(adminClient, {
name: 'team',
displayName: 'Second Team',
type: 'O',
unique: true,
});
await adminClient.addToTeam(secondTeam.id, user.id);
const {channelsPage, page} = await pw.testBrowser.login(user);
await channelsPage.goto(team.name, 'town-square');
await channelsPage.toBeVisible();
// # Leave the current team from the team menu
await channelsPage.sidebarLeft.teamMenuButton.click();
await channelsPage.teamMenu.toBeVisible();
await channelsPage.teamMenu.clickLeaveTeam();
// # Confirm leaving in the dialog
await channelsPage.leaveTeamModal.toBeVisible();
await channelsPage.leaveTeamModal.confirm();
// * Verify the user is moved to the other team and the left team is gone from the team sidebar
await expect.poll(() => page.url(), {timeout: pw.duration.ten_sec}).toContain(`/${secondTeam.name}/`);
await expect(page.locator(`#${team.name}TeamButton`)).not.toBeVisible();
// # Rejoin the left team from the team selection page
await page.goto('/select_team');
await page.getByRole('link', {name: team.display_name}).click();
// * Verify the rejoined team is displayed again with its button in the sidebar
await expect.poll(() => page.url(), {timeout: pw.duration.ten_sec}).toContain(`/${team.name}/`);
await expect(page.locator(`#${team.name}TeamButton`)).toBeVisible();
});
/**
* @objective Verify that when an admin removes a user from the team they are viewing, the user is moved off
* that team in real time, and is re-added when the admin invites them back.
*/
test(
'MM-T2548 removes the user from the team they are viewing and re-adds them',
{tag: '@multi_team'},
async ({pw}) => {
const {user, team, adminClient} = await pw.initSetup();
// # Add the user to a second team so there is another team to fall back to when removed
const secondTeam = await pw.createNewTeam(adminClient, {
name: 'team',
displayName: 'Second Team',
type: 'O',
unique: true,
});
await adminClient.addToTeam(secondTeam.id, user.id);
const {channelsPage, page} = await pw.testBrowser.login(user);
await channelsPage.goto(team.name, 'town-square');
await channelsPage.toBeVisible();
await expect(page.locator(`#${team.name}TeamButton`)).toBeVisible();
// # Remove the user from the team they are viewing
await adminClient.removeFromTeam(team.id, user.id);
// * Verify the user is moved off the removed team and its button disappears from the sidebar
await expect(page.locator(`#${team.name}TeamButton`)).not.toBeVisible();
await expect.poll(() => page.url(), {timeout: pw.duration.ten_sec}).toContain(`/${secondTeam.name}/`);
// # Re-add the user to the team
await adminClient.addToTeam(team.id, user.id);
// * Verify the team reappears in the sidebar for the user
await expect(page.locator(`#${team.name}TeamButton`)).toBeVisible();
},
);

View File

@@ -0,0 +1,92 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {expect, test} from '@mattermost/playwright-lib';
/**
* @objective Verify switching teams preserves direct messages and each team's last channel, while team badges distinguish mentions from ordinary unread messages.
*/
test(
'MM-T433 MM-T437 MM-T438 switches teams and displays multi-team mentions and unreads',
{tag: '@multi_team'},
async ({pw}) => {
// # Create two teams, two users on both teams, and one user only on the first team
const {user, team, adminClient, userClient} = await pw.initSetup();
const [sharedUser, firstTeamUser] = await adminClient.createUsers(team.id, 2, 'multi-team');
const {client: sharedUserClient} = await pw.makeClient(sharedUser);
const secondTeam = await pw.createNewTeam(adminClient, {
name: 'team',
displayName: 'Second Team',
type: 'O',
unique: true,
});
await adminClient.addToTeam(secondTeam.id, user.id);
await adminClient.addToTeam(secondTeam.id, sharedUser.id);
const firstDm = await adminClient.createDirectChannel([user.id, sharedUser.id]);
const secondDm = await adminClient.createDirectChannel([user.id, firstTeamUser.id]);
await userClient.createPost({channel_id: firstDm.id, message: ':)'});
await userClient.createPost({channel_id: secondDm.id, message: ':('});
// # Open both DMs on the first team, ending on the second DM, then switch to the second team
const {channelsPage, page} = await pw.testBrowser.login(user);
await channelsPage.goto(team.name, `@${sharedUser.username}`);
await channelsPage.toBeVisible();
await channelsPage.goto(team.name, `@${firstTeamUser.username}`);
await channelsPage.toBeVisible();
await channelsPage.switchToTeamByDisplayName(secondTeam.display_name);
// * Verify the second team opens at the top of its channel list and both DMs remain available
await expect
.poll(() => page.url(), {timeout: pw.duration.ten_sec})
.toContain(`/${secondTeam.name}/channels/town-square`);
await expect(channelsPage.sidebarLeft.teamMenuButton).toContainText(secondTeam.display_name);
await expect(channelsPage.sidebarLeft.item(sharedUser.username)).toBeVisible();
await expect(channelsPage.sidebarLeft.item(firstTeamUser.username)).toBeVisible();
// # Post in Off-Topic on the second team, then switch back to the first team
await channelsPage.sidebarLeft.goToItem('off-topic');
await channelsPage.postMessage('Hello World');
await (await channelsPage.getLastPost()).toContainText('Hello World');
await channelsPage.switchToTeamByDisplayName(team.display_name);
// * Verify team data does not cross-contaminate and the first team's last DM is restored
await channelsPage.sidebarLeft.assertItemRead('off-topic');
await expect(channelsPage.sidebarLeft.item(sharedUser.username)).toBeVisible();
await expect(channelsPage.sidebarLeft.item(firstTeamUser.username)).toBeVisible();
await expect
.poll(() => page.url(), {timeout: pw.duration.ten_sec})
.toContain(`/${team.name}/messages/@${firstTeamUser.username}`);
// # Have the shared user mention the test user twice in the second team's Off-Topic channel
const secondTeamOffTopic = await adminClient.getChannelByName(secondTeam.id, 'off-topic');
await sharedUserClient.createPost({
channel_id: secondTeamOffTopic.id,
message: `@${user.username} first mention`,
});
await sharedUserClient.createPost({
channel_id: secondTeamOffTopic.id,
message: `@${user.username} second mention`,
});
// * Verify the second team's semantic label reports two mentions
await channelsPage.toHaveTeamMentionCount(secondTeam.display_name, 2);
// # Switch to the second team to read its mentions
await channelsPage.switchToTeamByDisplayName(secondTeam.display_name);
await channelsPage.sidebarLeft.goToItem('off-topic');
// * Verify the second team's mention badge clears
await channelsPage.toHaveTeamNoUnread(secondTeam.display_name);
// # Have the shared user post an ordinary message on the first team while it is in the background
const firstTeamOffTopic = await adminClient.getChannelByName(team.id, 'off-topic');
await sharedUserClient.createPost({
channel_id: firstTeamOffTopic.id,
message: 'Hey all',
});
// * Verify the first team reports unread activity without a mention count
await channelsPage.toHaveTeamUnread(team.display_name, team.id);
},
);