Files
48a3f4a0ab E2E/Cypress: Upgrade dependencies (#33665)
* upgrade cypress and other dependecies

* fix eslint

* remove axios-retry and update eslint

* fix tests

* fix lint on trailing spaces

---------

Co-authored-by: Mattermost Build <[email protected]>
2025-09-01 14:14:13 +08:00

42 lines
1.6 KiB
TypeScript

// 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 @commands
import * as TIMEOUTS from '../../../fixtures/timeouts';
describe('Leave Channel Command', () => {
let testChannel;
before(() => {
// # Login as test user and go to town-square
cy.apiInitSetup({loginAfter: true}).then(({team, channel}) => {
testChannel = channel;
cy.visit(`/${team.name}/channels/town-square`);
cy.get('#channelHeaderTitle').should('be.visible').and('contain', 'Town Square');
});
});
it('Should be redirected to last channel when user leaves channel with /leave command', () => {
// # Go to newly created channel
cy.get('#sidebarItem_' + testChannel.name).click({force: true});
cy.findAllByTestId('postView').last().scrollIntoView().should('be.visible');
// # Post /leave command in center channel
cy.postMessage('/leave ');
cy.wait(TIMEOUTS.TWO_SEC);
// * Assert that user is redirected to townsquare
cy.url().should('include', '/channels/town-square');
cy.get('#channelHeaderTitle').should('be.visible').and('contain', 'Town Square');
});
});