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 1s
Server CI Nightly Race / Build Environment (push) Failing after 1s
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 1s
Server CI Nightly Race / Build Environment (push) Failing after 1s
This commit is contained in:
@@ -0,0 +1,165 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {expect, test} from '@mattermost/playwright-lib';
|
||||
|
||||
// The notify-all confirmation modal appears once a channel has more than this many members.
|
||||
const NOTIFY_ALL_THRESHOLD = 5;
|
||||
|
||||
const NOTIFY_ALL_TITLE = 'Confirm sending notifications to entire channel';
|
||||
|
||||
/**
|
||||
* @objective Verify that channel-wide mentions with uppercase letters trigger notifications and are properly highlighted.
|
||||
*
|
||||
* @precondition
|
||||
* - Two users are members of the same team
|
||||
* - Notification permissions are granted in the browser
|
||||
*/
|
||||
test(
|
||||
'MM-T483 triggers notification with uppercase channel-wide mention and highlights message for all users',
|
||||
{tag: '@notifications'},
|
||||
async ({pw}) => {
|
||||
// # Initialize setup and get the required users and team
|
||||
const {team, adminUser, user} = await pw.initSetup();
|
||||
|
||||
// # Log in as the admin in one browser session and navigate to the "town-square" channel
|
||||
const {page: adminPage, channelsPage: adminChannelsPage} = await pw.testBrowser.login(adminUser);
|
||||
await adminChannelsPage.goto(team.name, 'town-square');
|
||||
await adminChannelsPage.toBeVisible();
|
||||
|
||||
// # Stub the Notification in the admin's browser to capture notifications
|
||||
await pw.stubNotification(adminPage, 'granted');
|
||||
|
||||
// # Log in as the regular user in a separate browser and navigate to the "off-topic" channel
|
||||
const {channelsPage: otherChannelsPage} = await pw.testBrowser.login(user);
|
||||
await otherChannelsPage.goto(team.name, 'off-topic');
|
||||
await otherChannelsPage.toBeVisible();
|
||||
|
||||
// # Post a channel-wide mention message "@ALL" in uppercase from the user's browser
|
||||
const message = `@ALL good morning, ${team.name}!`;
|
||||
await otherChannelsPage.postMessage(message);
|
||||
|
||||
// * Verify notification is received in the admin's browser with correct content
|
||||
const notifications = await pw.waitForNotification(adminPage);
|
||||
expect(notifications.length).toBe(1);
|
||||
|
||||
const notification = notifications[0];
|
||||
expect(notification.title).toBe('Off-Topic');
|
||||
expect(notification.body).toBe(`@${user.username}: ${message}`);
|
||||
|
||||
// The Notifications API tag must not leak the message body; the app uses the
|
||||
// opaque post ID as the tag so notifications coalesce per conversation.
|
||||
const otherLastPost = await otherChannelsPage.getLastPost();
|
||||
expect(notification.tag).toBe(await otherLastPost.getId());
|
||||
expect(notification.tag).not.toContain(message);
|
||||
|
||||
expect(notification.icon).toContain('.png');
|
||||
expect(notification.requireInteraction).toBe(false);
|
||||
expect(notification.silent).toBe(false);
|
||||
|
||||
// * Verify the last post as viewed by the regular user in the "off-topic" channel contains the message and is highlighted
|
||||
await otherLastPost.toContainText(message);
|
||||
await expect(otherLastPost.container.locator('.mention--highlight')).toBeVisible();
|
||||
await expect(otherLastPost.container.locator('.mention--highlight').getByText('@ALL')).toBeVisible();
|
||||
|
||||
// # Navigate admin to the "off-topic" channel
|
||||
await adminChannelsPage.goto(team.name, 'off-topic');
|
||||
|
||||
// * Verify the message is posted and highlighted correctly for the admin user
|
||||
const adminLastPost = await adminChannelsPage.getLastPost();
|
||||
await adminLastPost.toContainText(message);
|
||||
await expect(adminLastPost.container.locator('.mention--highlight')).toBeVisible();
|
||||
await expect(adminLastPost.container.locator('.mention--highlight').getByText('@ALL')).toBeVisible();
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* @objective Verify a channel-wide mention typed in mixed case (@channEL) is recognized as a mention,
|
||||
* prompts the notify-all confirmation, and is posted with its original casing preserved.
|
||||
*/
|
||||
test(
|
||||
'MM-T484 recognizes a mixed-case @channEL channel-wide mention and preserves its casing',
|
||||
{tag: '@notifications'},
|
||||
async ({pw}) => {
|
||||
const {adminClient, team, user} = await pw.initSetup();
|
||||
|
||||
// # Add enough members so the channel exceeds the notify-all threshold
|
||||
for (let i = 0; i < NOTIFY_ALL_THRESHOLD; i++) {
|
||||
const extraUser = await pw.createNewUserProfile(adminClient, {prefix: 'channel-wide'});
|
||||
await adminClient.addToTeam(team.id, extraUser.id);
|
||||
}
|
||||
|
||||
const {channelsPage} = await pw.testBrowser.login(user);
|
||||
await channelsPage.goto(team.name, 'town-square');
|
||||
await channelsPage.toBeVisible();
|
||||
|
||||
// # Type a mixed-case channel-wide mention and send it
|
||||
const message = `@channEL mixed case mention ${pw.random.id()}`;
|
||||
await channelsPage.centerView.postCreate.writeMessage(message);
|
||||
await channelsPage.centerView.postCreate.sendMessage();
|
||||
|
||||
// * Verify the notify-all confirmation modal appears (mention was recognized despite casing)
|
||||
const confirmModal = channelsPage.getConfirmModal(NOTIFY_ALL_TITLE);
|
||||
await confirmModal.toBeVisible();
|
||||
|
||||
// # Confirm sending the notification
|
||||
await confirmModal.confirm();
|
||||
|
||||
// * Verify the posted message preserves the mixed-case mention
|
||||
const lastPost = await channelsPage.getLastPost();
|
||||
await lastPost.toContainText(message);
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* @objective Verify an @HERE channel-wide mention typed in uppercase is recognized as a mention,
|
||||
* prompts the notify-all confirmation, and keeps its uppercase casing after switching channels.
|
||||
*/
|
||||
test(
|
||||
'MM-T485 recognizes an uppercase @HERE channel-wide mention and preserves its casing',
|
||||
{tag: '@notifications'},
|
||||
async ({pw}) => {
|
||||
const {adminClient, team, user} = await pw.initSetup();
|
||||
|
||||
// # Add enough members so the channel exceeds the notify-all threshold
|
||||
for (let i = 0; i < NOTIFY_ALL_THRESHOLD; i++) {
|
||||
const extraUser = await pw.createNewUserProfile(adminClient, {prefix: 'channel-wide'});
|
||||
await adminClient.addToTeam(team.id, extraUser.id);
|
||||
}
|
||||
|
||||
const {channelsPage} = await pw.testBrowser.login(user);
|
||||
await channelsPage.goto(team.name, 'off-topic');
|
||||
await channelsPage.toBeVisible();
|
||||
|
||||
// * Verify the "Channel-wide mentions" keyword is enabled by default in notification settings
|
||||
const settingsModal = await channelsPage.openSettings();
|
||||
const notificationSettings = await settingsModal.openNotificationsTab();
|
||||
await notificationSettings.keywordsTriggerNotificationsEditButton.click();
|
||||
await expect(notificationSettings.channelWideMentionsCheckbox).toBeChecked();
|
||||
await settingsModal.close();
|
||||
|
||||
// # Type an uppercase channel-wide mention and send it
|
||||
const message = `@HERE channel-wide mention ${pw.random.id()}`;
|
||||
await channelsPage.centerView.postCreate.writeMessage(message);
|
||||
await channelsPage.centerView.postCreate.sendMessage();
|
||||
|
||||
// * Verify the notify-all confirmation modal appears (mention was recognized despite uppercase)
|
||||
const confirmModal = channelsPage.getConfirmModal(NOTIFY_ALL_TITLE);
|
||||
await confirmModal.toBeVisible();
|
||||
|
||||
// # Confirm sending the notification
|
||||
await confirmModal.confirm();
|
||||
|
||||
// * Verify the posted message preserves the uppercase mention
|
||||
const lastPost = await channelsPage.getLastPost();
|
||||
await lastPost.toContainText(message);
|
||||
|
||||
// # Switch to another channel and back
|
||||
await channelsPage.sidebarLeft.goToItem('town-square');
|
||||
await channelsPage.sidebarLeft.goToItem('off-topic');
|
||||
|
||||
// * Verify the uppercase mention is still shown after returning to the channel
|
||||
const postAfterSwitch = await channelsPage.getLastPost();
|
||||
await postAfterSwitch.toContainText(message);
|
||||
},
|
||||
);
|
||||
Reference in New Issue
Block a user