Files
b6f80ae12e E2E/Playwright: Migrate RFQA browser tests (batch 5, 81-100) (#37417)
* E2E/Playwright: Migrate RFQA browser tests (batch 4, 61-80)

Migrate the fourth batch of Rainforest QA browser tests into Playwright
(migration plan None-core #34-53, keys MM-T480..MM-T1257): 17 new/covered
specs across notifications, search, channel_settings, sidebar_left,
keyboard_shortcuts, and direct_messages_modal, plus 3 duplicate keys folded
into existing tests (MM-T480, MM-T1256, MM-T1257).

POM/infra: add a ChannelMenu page object for the channel header dropdown, an
EditChannelHeaderModal, a header field on the channel-settings info tab, a
channel-wide-mentions checkbox on NotificationsSettings, a getConfirmModal
helper, and a clickNotification browser-API mock helper. Give the channel
header menu and the confirm modal proper accessible names so they can be
targeted semantically. Notification specs run on all browsers now that the
Notification API stub works headless on Chromium and Firefox.

* E2E/Playwright: Migrate RFQA browser tests (batch 5, 81-100)

Migrate the fifth batch of Rainforest QA browser tests into Playwright across
keyboard_shortcuts, search, archived_channels, channel_settings,
plugin_marketplace, messaging, and emoji_picker (keys MM-T1247..MM-T2365),
folding duplicate coverage into existing keyboard-shortcut specs and
documenting skipped cases inline.

POM/infra: add AddPeopleToChannelModal and MarketplaceModal page objects,
manage/add member buttons on the channel members RHS, and an App Marketplace
entry on the global header; target the search "Jump" link through the existing
SearchResultsPanel POM.

Also fix a webapp bug where a post body disappeared when an inline edit was
cancelled mid-animation (found via the up-arrow edit shortcut spec).

* E2E/Playwright: Fail on missing scroll bounding boxes

* E2E/Playwright: Group related batch 5 specs

* E2E/Playwright: Avoid duplicate creator membership

* E2E/Playwright: Group Rainforest batches 1 through 4

---------

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-13 17:14:42 +08:00

92 lines
4.5 KiB
TypeScript

// 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 multi-line channel header is truncated in the header bar, that hovering it opens a
* popover with the full header, that a markdown link in the header points to the correct URL, and that the
* popover closes.
*/
test(
'MM-T879 opens and closes the channel header popover with a working link',
{tag: '@channel_settings'},
async ({pw}) => {
const {adminClient, team, user} = await pw.initSetup();
const channel = await adminClient.createPublicChannel(team.id, `Header ${pw.random.id()}`);
await adminClient.addToChannel(user.id, channel.id);
const {channelsPage, page} = await pw.testBrowser.login(user);
await channelsPage.goto(team.name, channel.name);
await channelsPage.toBeVisible();
// # Set a multi-line channel header that contains a markdown link, via Channel Settings
const header = ['Header text line one', '', '- Two', '- [Google](https://google.com/)', '- Four'].join('\n');
const channelSettings = await channelsPage.openChannelSettings();
const infoSettings = await channelSettings.openInfoTab();
await infoSettings.updateHeader(header);
await channelSettings.save();
await channelSettings.close();
// * Verify the header bar shows the first line of the header
const headerText = channelsPage.centerView.header.container.getByText('Header text line one');
await expect(headerText).toBeVisible();
// # Hover the header text to open the popover. Force the hover because opening the popover mounts a
// full-screen floating overlay that would otherwise be reported as intercepting the pointer.
await headerText.hover({force: true});
// * Verify the popover opens with the full header and a link to the correct URL
const popover = page.getByRole('tooltip');
await expect(popover).toBeVisible();
await expect(popover.getByText('Four')).toBeVisible();
const link = popover.getByRole('link', {name: 'Google'});
await expect(link).toHaveAttribute('href', 'https://google.com/');
// # Move the pointer away from the header to dismiss the popover
await page.mouse.move(400, 500);
await channelsPage.centerView.postCreate.input.hover({force: true});
// * Verify the popover closes
await expect(popover).not.toBeVisible();
},
);
/**
* @objective Verify a channel header can be added from the "Set header" link in a new channel's intro,
* that cancelling the modal makes no change, and that the saved header appears in the channel info.
*/
test('MM-T880 adds a channel header from the intro Set header link', {tag: '@channel_settings'}, async ({pw}) => {
const {user, team} = await pw.initSetup();
const {channelsPage} = await pw.testBrowser.login(user);
await channelsPage.goto(team.name, 'town-square');
await channelsPage.toBeVisible();
// # Create a new public channel so its intro (with the "Set header" link) is shown
const channelName = `channel header ${pw.random.id()}`;
await channelsPage.newChannel(channelName, 'O');
await channelsPage.centerView.header.toHaveTitle(channelName);
// # Open the Edit Header modal from the intro and cancel without entering text
await channelsPage.centerView.channelIntro.getByRole('button', {name: 'Set header'}).click();
await channelsPage.editChannelHeaderModal.toBeVisible();
await channelsPage.editChannelHeaderModal.cancel();
// # Reopen the Edit Header modal and save a header
const header = 'this is the channel header';
await channelsPage.centerView.channelIntro.getByRole('button', {name: 'Set header'}).click();
await channelsPage.editChannelHeaderModal.toBeVisible();
await channelsPage.editChannelHeaderModal.setHeader(header);
// * Verify the header-change system message is posted
await channelsPage.centerView.waitUntilLastPostContains(`updated the channel header to: ${header}`);
// # Open the channel info panel from the channel header menu
const channelMenu = await channelsPage.openChannelMenu();
await channelMenu.viewInfo.click();
await channelsPage.sidebarRight.toBeVisible();
// * Verify the saved header appears in the channel info panel
await expect(channelsPage.sidebarRight.container.getByText(header)).toBeVisible();
});