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 Nightly Race / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (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,82 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
// ***************************************************************
// - [#] indicates a test step (e.g. # Go to a page)
// - [*] indicates an assertion (e.g. * Check the title)
// - Use element ID when selecting an element. Create one if none.
// ***************************************************************
// Stage: @prod
// Group: @channels @enterprise @permissions
import * as TIMEOUTS from '@/fixtures/timeouts';
const deleteExistingTeamOverrideSchemes = () => {
cy.apiGetSchemes('team').then(({schemes}) => {
schemes.forEach((scheme) => {
cy.apiDeleteScheme(scheme.id);
});
});
};
const checkChannelBookmarksPermissionsAreVisibleAndSet = () => {
const permissionRowIds = ['all_users-public_channel-manage_public_channel_bookmarks-checkbox',
'all_users-private_channel-manage_private_channel_bookmarks-checkbox'];
permissionRowIds.forEach((id) => {
cy.findByTestId(id).then((el) => {
expect(el.hasClass('checked')).to.be.true;
});
});
};
describe('Revoke Bookmarks Permissions', () => {
before(() => {
cy.apiRequireLicense();
cy.apiInitSetup();
deleteExistingTeamOverrideSchemes();
});
beforeEach(() => {
cy.apiLogout();
cy.apiAdminLogin();
cy.apiResetRoles();
});
it('Channel Bookmarks permissions should be visible and set in the system scheme', () => {
cy.apiAdminLogin();
// # Go to `User Management / Permissions` section
cy.visit('/admin_console/user_management/permissions');
// # Click `Edit Scheme` on System Scheme
cy.findByTestId('systemScheme-link').should('be.visible').click().wait(TIMEOUTS.HALF_SEC);
// # Find and ensure that manage bookmarks permissions are visible and set
checkChannelBookmarksPermissionsAreVisibleAndSet();
});
it('Channel Bookmarks permissions should be visible and set in a custom scheme', () => {
cy.apiAdminLogin();
// # Go to `User Management / Permissions` section
cy.visit('/admin_console/user_management/permissions');
// # Click `New Team Override Scheme`
cy.findByTestId('team-override-schemes-link').should('be.visible').click().wait(TIMEOUTS.HALF_SEC);
// # Type Name and Description
cy.get('#scheme-name').should('be.visible').type('custom test schema');
cy.get('#scheme-description').type('description');
// # Save scheme
cy.get('#saveSetting').click().wait(TIMEOUTS.TWO_SEC);
// # Edit the schema
cy.findByTestId('custom test schema-edit').should('be.visible').click().wait(TIMEOUTS.HALF_SEC);
// # Find and ensure that manage bookmarks permissions are visible and set
checkChannelBookmarksPermissionsAreVisibleAndSet();
});
});

View File

@@ -0,0 +1,234 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
// ***************************************************************
// - [#] indicates a test step (e.g. # Go to a page)
// - [*] indicates an assertion (e.g. * Check the title)
// - Use element ID when selecting an element. Create one if none.
// ***************************************************************
// Stage: @prod
// Group: @channels @enterprise @permissions
import * as TIMEOUTS from '@/fixtures/timeouts';
const deleteExistingTeamOverrideSchemes = () => {
cy.apiGetSchemes('team').then(({schemes}) => {
schemes.forEach((scheme) => {
cy.apiDeleteScheme(scheme.id);
});
});
};
const createTeamOverrideSchemeWithPermission = (name: string, team: Cypress.Team, permissionId: string, permissionValue: boolean) => {
cy.apiAdminLogin();
// # Go to `User Management / Permissions` section
cy.visit('/admin_console/user_management/permissions');
// # Click `New Team Override Scheme`
cy.findByTestId('team-override-schemes-link').should('be.visible').click().wait(TIMEOUTS.HALF_SEC);
// # Type Name and Description
cy.get('#scheme-name').should('be.visible').type(name);
cy.get('#scheme-description').type('Description');
// # Click `Add Teams`
cy.findByTestId('add-teams').should('be.visible').click().wait(TIMEOUTS.HALF_SEC);
// # Find and select testTeam
cy.get('#selectItems input').typeWithForce(team.display_name).wait(TIMEOUTS.HALF_SEC);
cy.get('#multiSelectList div.more-modal__row.clickable').eq(0).click().wait(TIMEOUTS.HALF_SEC);
// # Save scheme
cy.get('#saveItems').should('be.visible').click().wait(TIMEOUTS.HALF_SEC);
// # Modify the permissions scheme
cy.findByTestId(permissionId).then((el) => {
if ((!el.hasClass('checked') && permissionValue) || (el.hasClass('checked') && !permissionValue)) {
el.click();
}
});
// # Save scheme
cy.get('#saveSetting').click().wait(TIMEOUTS.TWO_SEC);
cy.apiLogout();
};
describe('Team Permissions', () => {
let testTeam: Cypress.Team;
let testUser: Cypress.UserProfile;
let testPrivateCh: Cypress.Channel;
let otherUser: Cypress.UserProfile;
const schemeName = 'schemetest';
before(() => {
cy.apiRequireLicense();
cy.apiInitSetup().then(({team, user}) => {
testTeam = team;
testUser = user;
cy.apiCreateChannel(testTeam.id, 'private-permissions-test', 'Private Permissions Test', 'P', '').then(({channel}) => {
cy.apiAddUserToChannel(channel.id, testUser.id);
testPrivateCh = channel;
});
cy.apiCreateUser().then(({user: newUser}) => {
otherUser = newUser;
cy.apiAddUserToTeam(testTeam.id, otherUser.id);
});
});
});
beforeEach(() => {
cy.apiLogout();
cy.apiAdminLogin();
cy.apiResetRoles();
deleteExistingTeamOverrideSchemes();
});
it('MM-T2871 Member cannot add members to the team', () => {
createTeamOverrideSchemeWithPermission(schemeName, testTeam, 'all_users-teams_team_scope-send_invites-checkbox', false);
cy.apiLogin(testUser);
// # Go to main channel
cy.visit(`/${testTeam.name}/channels/town-square`);
// # Open hamburger menu
cy.uiOpenTeamMenu().wait(TIMEOUTS.HALF_SEC);
// * Verify `Invite People` menu item is not present
cy.get("#sidebarTeamMenu li:contains('Invite people')").should('not.exist');
// # Click `View Members` menu item
cy.get("#sidebarTeamMenu li:contains('View members')").should('be.visible').click().wait(TIMEOUTS.HALF_SEC);
// * Verify team members modal opens
cy.get('#teamMembersModal').should('be.visible');
// * Verify 'Invite People` button is not present
cy.get('#invitePeople').should('not.exist');
});
it('MM-T2876 Member cannot add or remove other members from private channel', () => {
createTeamOverrideSchemeWithPermission(schemeName, testTeam, 'all_users-private_channel-manage_private_channel_members_and_read_groups-checkbox', false);
cy.apiLogin(testUser);
// # Go to private channel
cy.visit(`/${testTeam.name}/channels/${testPrivateCh.name}`);
// # Open channel header menu
cy.uiOpenChannelMenu().wait(TIMEOUTS.HALF_SEC);
// * Verify dropdown opens
cy.get('#channelHeaderDropdownMenu').should('be.visible');
// * Verify `View Members` menu item is visible
cy.get('#channelMembers').should('be.visible');
// # Close channel header menu
cy.get('body').type('{esc}');
// # Open channel members list
cy.get('.member-rhs__trigger').should('be.visible').click().wait(TIMEOUTS.HALF_SEC);
// * Verify it does not countains Add or Manage buttons
cy.uiGetRHS().contains('button', 'Manage').should('not.exist');
cy.uiGetRHS().contains('button', 'Add').should('not.exist');
});
it('MM-T2878 Member cannot create a private channel', () => {
createTeamOverrideSchemeWithPermission(schemeName, testTeam, 'all_users-private_channel-create_private_channel-checkbox', false);
cy.apiLogin(testUser);
// # Go to main channel
cy.visit(`/${testTeam.name}/channels/town-square`);
// # Click on create new channel at LHS
cy.uiBrowseOrCreateChannel('Create new channel');
// * Verify that the create private channel is disabled
cy.findByRole('dialog', {name: 'Create a new channel'}).find('#public-private-selector-button-P').should('have.class', 'disabled');
});
it('MM-T2900 As a Channel Admin, the test user is now able to add or remove other users from public channel', () => {
cy.apiLogin(testUser);
// # Create new public channel
cy.apiCreateChannel(testTeam.id, 'public-permissions-test', 'Public Permissions Test', 'O', '').then(({channel}) => {
// # Visit the created channel
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
// # Open channel header menu
cy.uiOpenChannelMenu().wait(TIMEOUTS.HALF_SEC);
// * Verify dropdown opens
cy.get('#channelHeaderDropdownMenu').should('be.visible');
// # Click on `Members`
cy.get('#channelMembers').should('be.visible').click().wait(TIMEOUTS.HALF_SEC);
cy.uiGetButton('Add').click();
// # Search and select otherUser
cy.get('#selectItems input').typeWithForce(otherUser.username).wait(TIMEOUTS.HALF_SEC);
cy.get('#multiSelectList div').eq(0).click();
// # Click `Save` button
cy.get('#saveItems').should('be.visible').click().wait(TIMEOUTS.ONE_SEC);
// # Open channel header menu
cy.uiOpenChannelMenu().wait(TIMEOUTS.HALF_SEC);
// * Verify dropdown opens
cy.get('#channelHeaderDropdownMenu').should('be.visible');
// # Click on `Members`
cy.get('#channelMembers').should('be.visible').click().wait(TIMEOUTS.HALF_SEC);
cy.uiGetButton('Manage').click();
// # Click on `Member`
cy.uiGetRHS().findByTestId(`memberline-${otherUser.id}`).within(() => {
cy.findByTestId('rolechooser').should('be.visible').and('contain.text', 'Member').click().wait(TIMEOUTS.HALF_SEC);
cy.findByTestId('rolechooser').within(() => {
// * Verify the user can be removed
cy.get('.Menu__content.dropdown-menu .MenuItem').eq(1).should('be.visible').and('contain.text', 'Remove from Channel').click();
});
});
});
});
it('MM-T2908 As a Team Admin, the test user is able to update the public channel Name, Header and Purpose', () => {
cy.apiLogin(testUser);
// # Create new team
cy.apiCreateTeam('test-team-permissions', 'Test Team Permissions').then(({team}) => {
// # Visit the `Off-Topic` channel in the new team
cy.visit(`/${team.name}/channels/off-topic`);
// # Open channel header dropdown
cy.get('#channelHeaderDropdownButton').click();
// * Verify Channel Settings option is visible
cy.findByText('Channel Settings').should('be.visible');
// # Click on Channel Settings
cy.findByText('Channel Settings').click();
// * Verify Channel Settings modal opens
cy.get('.ChannelSettingsModal').should('be.visible');
// * Verify user can edit channel name
cy.get('#input_channel-settings-name').should('be.visible').and('not.be.disabled');
// * Verify user can edit channel URL
cy.get('.url-input-button').should('be.visible').and('not.be.disabled');
// * Verify user can edit channel purpose
cy.get('#channel_settings_purpose_textbox').scrollIntoView().should('be.visible').and('not.be.disabled');
// * Verify user can edit channel header
cy.get('#channel_settings_header_textbox').scrollIntoView().should('be.visible').and('not.be.disabled');
// # Close the modal
cy.get('.GenericModal .modal-header button[aria-label="Close"]').click();
cy.get('.ChannelSettingsModal').should('not.exist');
});
});
});