Files
Scott Bishel fd717cfa64 MM-59065 - New channel menu using new menu system (#30093)
* New channel menu using new menu system

* fix e2e-tests

* remove extraneous separator

* lint fix

* fix test after merge

* update to pass properties to first menu item

* fix e2etest

* refactor: Update channel header menu items to use const event handlers

* refactor: Extract plugin item click handler in channel header menu

* refactor: Improve error handling and button click handlers in mobile channel header plugins

* lint fixes

* updates for code reveiw

* run i18n-extract

* fix unit test

* fix: Close channel dropdown menu by clicking channel header title

* fix: Use keyboard escape to close channel dropdown menu in e2e tests

* fix cypress test

* fix: Resolve MUI Menu component fragment rendering issue

* cleanup

* remove unneccessary css

* fixing testing issues

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2025-03-19 07:06:04 -05:00

94 строки
3.3 KiB
JavaScript

// 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 @messaging
import * as TIMEOUTS from '../../../fixtures/timeouts';
describe('Header', () => {
let otherUser;
before(() => {
// # Login as test user and visit town-square
cy.apiInitSetup().then(({team, user}) => {
cy.apiCreateUser().then(({user: user1}) => {
otherUser = user1;
cy.apiAddUserToTeam(team.id, otherUser.id);
});
cy.apiLogin(user);
cy.visit(`/${team.name}/channels/off-topic`);
});
});
it('MM-T88 An ellipsis indicates the channel header is too long - public or private channel Quote icon displays at beginning of channel header', () => {
// * Verify with short channel header
updateAndVerifyChannelHeader(false, '>', 'newheader');
// * Verify with long channel header
updateAndVerifyChannelHeader(false, '>', 'newheader'.repeat(20));
});
it('MM-T881_1 - Header: Markdown quote', () => {
// # Update channel header text
const header = 'This is a quote in the header';
updateAndVerifyChannelHeader(false, '>', header);
});
it('MM-T89 An ellipsis indicates the channel header is too long - DM', () => {
// # Open Account Setting and enable Compact View on the Display tab
cy.uiChangeMessageDisplaySetting('COMPACT');
// # Open a DM with other user
cy.uiAddDirectMessage().click().wait(TIMEOUTS.HALF_SEC);
cy.focused().
type(otherUser.username, {force: true}).wait(TIMEOUTS.HALF_SEC).
type('{enter}', {force: true}).wait(TIMEOUTS.HALF_SEC);
cy.get('#saveItems').click().wait(TIMEOUTS.HALF_SEC);
// # Update DM channel header
const header = `quote ${'newheader'.repeat(15)}`;
updateAndVerifyChannelHeader(true, '>', header);
// # Hover on channel header
cy.get('#channelHeaderDescription .header-description__text').trigger('mouseenter');
// * Check that no ellipsis is present
cy.get('.channel-header-text-popover').should(($el) => {
expect($el.get(0).innerText).to.eq(header);
});
cy.apiSaveMessageDisplayPreference('clean');
});
});
function updateAndVerifyChannelHeader(isDM, prefix, header) {
// # Update channel header
if (isDM) {
cy.updateDMGMChannelHeader(prefix + header);
} else {
cy.updateChannelHeader(prefix + header);
}
// * Should render blockquote if it starts with ">"
if (prefix === '>') {
cy.get('.header-description__text').within(() => {
cy.get('blockquote').should('be.visible');
});
}
// * Check if channel header description has ellipsis
cy.get('.header-description__text').
should('include.text', header).
and('have.css', 'overflow', 'hidden').
and('have.css', 'text-overflow', 'ellipsis');
}