forked from mattermost/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MM-27832 - Cypress/E2E: Channels > Change Channel using Channel Switc…
…her (mattermost#6261) * Cypress/E2E: Automate backlogs - Channels > Change Channel using Channel Switcher * added steps * Update e2e/cypress/integration/channel/channel_switcher_spec.js Co-authored-by: Joseph Baylon <[email protected]> * added last test step Co-authored-by: Joseph Baylon <[email protected]> Co-authored-by: Mattermod <[email protected]>
- Loading branch information
1 parent
28f2ac8
commit 8823a62
Showing
1 changed file
with
104 additions
and
0 deletions.
There are no files selected for viewing
104 changes: 104 additions & 0 deletions
104
e2e/cypress/integration/channel/channel_switcher_spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
// 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. | ||
// *************************************************************** | ||
|
||
// Group: @channel @smoke | ||
|
||
describe('Channel Switcher', () => { | ||
let testTeam; | ||
|
||
before(() => { | ||
cy.apiInitSetup().then(({team, user}) => { | ||
testTeam = team; | ||
|
||
// # Add some channels | ||
cy.apiCreateChannel(testTeam.id, 'channel-a', 'SwitchChannel A', 'O'); | ||
cy.apiCreateChannel(testTeam.id, 'channel-b', 'SwitchChannel B', 'O'); | ||
cy.apiCreateChannel(testTeam.id, 'channel-c', 'SwitchChannel C', 'O'); | ||
|
||
// # Login as test user and go to town square | ||
cy.apiLogin(user); | ||
cy.visit(`/${team.name}/channels/town-square`); | ||
}); | ||
}); | ||
|
||
it('MM-T2031_1 - should switch channels by keyboard', () => { | ||
// # Press CTRL+K (Windows) or CMD+K(Mac) | ||
cy.typeCmdOrCtrl().type('K', {release: true}); | ||
|
||
// # Start typing channel name in the "Switch Channels" modal message box | ||
// # Use up/down arrow keys to highlight second channel | ||
// # Press ENTER | ||
cy.get('#quickSwitchInput').type('SwitchChannel ').type('{downarrow}').type('{downarrow}').type('{enter}'); | ||
|
||
// * Expect channel title to match title | ||
cy.get('#channelHeaderTitle'). | ||
should('be.visible'). | ||
and('contain.text', 'SwitchChannel B'); | ||
|
||
// * Expect url to match url | ||
cy.url().should('contain', 'channel-b'); | ||
}); | ||
|
||
it('MM-T2031_2 - should switch channels by mouse', () => { | ||
// # Press CTRL+K (Windows) or CMD+K(Mac) | ||
cy.typeCmdOrCtrl().type('K', {release: true}); | ||
|
||
// # Start typing channel name in the "Switch Channels" modal message box | ||
cy.get('#quickSwitchInput').type('SwitchChannel '); | ||
|
||
cy.get('[data-testid^=channel-c] > span').click(); | ||
|
||
// * Expect channel title to match title | ||
cy.get('#channelHeaderTitle'). | ||
should('be.visible'). | ||
and('contain.text', 'SwitchChannel C'); | ||
|
||
// * Expect url to match url | ||
cy.url().should('contain', 'channel-c'); | ||
}); | ||
|
||
it('MM-T2031_3 - should show empty result', () => { | ||
// # Press CTRL+K (Windows) or CMD+K(Mac) | ||
cy.typeCmdOrCtrl().type('K', {release: true}); | ||
|
||
// # Type invalid channel name in the "Switch Channels" modal message box | ||
cy.get('#quickSwitchInput').type('there-is-no-spoon'); | ||
|
||
// * Expect 'nothing found' message | ||
cy.get('.no-results__title > span').should('be.visible'); | ||
}); | ||
|
||
it('MM-T2031_4 - should close on esc and outside click', () => { | ||
cy.visit(`/${testTeam.name}/channels/town-square`); | ||
|
||
// # Press CTRL+K (Windows) or CMD+K(Mac) | ||
cy.typeCmdOrCtrl().type('K', {release: true}); | ||
|
||
// # Press ESC | ||
cy.get('#quickSwitchInput').type('{esc}'); | ||
|
||
// * Expect the dialog to be closed | ||
cy.get('#quickSwitchInput').should('not.exist'); | ||
|
||
// * Expect staying in the same channel | ||
cy.url().should('contain', 'town-square'); | ||
|
||
// # Press CTRL+K (Windows) or CMD+K(Mac) | ||
cy.typeCmdOrCtrl().type('K', {release: true}); | ||
|
||
// # Click outside of the modal | ||
cy.get('.modal').click({force: true}); | ||
|
||
// * Expect the dialog to be closed | ||
cy.get('#quickSwitchInput').should('not.exist'); | ||
|
||
// * Expect staying in the same channel | ||
cy.url().should('contain', 'town-square'); | ||
}); | ||
}); |