Files
6b36e7d0e6 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 <[email protected]>
2025-03-19 07:06:04 -05:00

113 lines
4.0 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)
// ***************************************************************
// Stage: @prod
// Group: @playbooks
describe('channels > run', {testIsolation: true}, () => {
let testTeam;
let testUser;
let testPrivateChannel;
before(() => {
cy.apiInitSetup().then(({team, user}) => {
testTeam = team;
testUser = user;
// # Login as testUser
cy.apiLogin(testUser);
// # Create a playbook
cy.apiCreatePlaybook({
teamId: team.id,
title: 'Playbook',
memberIDs: [user.id],
});
// # Create a private channel
cy.apiCreateChannel(
testTeam.id,
'private-channel',
'Private Channel',
'P',
).then(({channel}) => {
testPrivateChannel = channel;
});
});
});
beforeEach(() => {
// # Login as testUser
cy.apiLogin(testUser);
// # Size the viewport to show plugin icons even when RHS is open
cy.viewport('macbook-13');
});
describe('via slash command', () => {
it('while viewing a public channel', () => {
// # Visit a public channel
cy.visit(`/${testTeam.name}/channels/off-topic`);
// * Verify that playbook run can be started with slash command
const playbookRunName = 'Public ' + Date.now();
cy.startPlaybookRunWithSlashCommand('Playbook', playbookRunName);
cy.verifyPlaybookRunActive(testTeam.id, playbookRunName);
});
it('while viewing a private channel', () => {
// # Visit a private channel
cy.visit(`/${testTeam.name}/channels/${testPrivateChannel.name}`);
// * Verify that playbook run can be started with slash command
const playbookRunName = 'Private ' + Date.now();
cy.startPlaybookRunWithSlashCommand('Playbook', playbookRunName);
cy.verifyPlaybookRunActive(testTeam.id, playbookRunName);
});
});
describe('via post menu', () => {
it('while viewing a public channel', () => {
// # Visit a public channel
cy.visit(`/${testTeam.name}/channels/off-topic`);
// * Verify that playbook run can be started from post menu
const playbookRunName = 'Public - ' + Date.now();
cy.startPlaybookRunFromPostMenu('Playbook', playbookRunName);
cy.verifyPlaybookRunActive(testTeam.id, playbookRunName);
});
it('while viewing a private channel', () => {
// # Visit a private channel
cy.visit(`/${testTeam.name}/channels/${testPrivateChannel.name}`);
// * Verify that playbook run can be started from post menu
const playbookRunName = 'Private - ' + Date.now();
cy.startPlaybookRunFromPostMenu('Playbook', playbookRunName);
cy.verifyPlaybookRunActive(testTeam.id, playbookRunName);
});
});
it('always as channel admin', () => {
// # Visit a public channel
cy.visit(`/${testTeam.name}/channels/off-topic`);
// # Start a playbook run with a slash command
const playbookRunName = 'Public ' + Date.now();
cy.startPlaybookRunWithSlashCommand('Playbook', playbookRunName);
cy.verifyPlaybookRunActive(testTeam.id, playbookRunName);
// # Open the channel header
cy.get('#channelHeaderTitle').click();
cy.findByText('Channel Settings').should('be.visible').trigger('mouseover');
// * Verify the ability to edit the channel header exists
cy.get('#channelEditHeader').should('exist');
});
});