This repository was archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
MM-46343: Include E2Es for colorized usernames in compact view #10942
Merged
mvitale1989
merged 7 commits into
mattermost:master
from
sinansonmez:MM-46343-e2e-test-for-colorized-names
Aug 22, 2022
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ddf7ff0
verify colorize option is selected or not
sinansonmez 9b39f6d
fix test description
sinansonmez c9a058b
check colors are unique
sinansonmez cfbd155
improve code to make it dry
sinansonmez 0831ca3
colors should be reverted to normal
sinansonmez 7eddccf
address comments
sinansonmez c7eea2b
replace hard coded colors
sinansonmez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
146 changes: 146 additions & 0 deletions
146
...cypress/tests/integration/settings/display/message_display_mode_colorize_username_spec.js
This file contains hidden or 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,146 @@ | ||
| // 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: @account_setting | ||
|
|
||
| describe('Settings > Display > Message Display: Colorize username', () => { | ||
| let testTeam; | ||
| let firstUser; | ||
| let otherUser; | ||
| let testChannel; | ||
| const colors = {}; | ||
| let defaultTextColor = ''; | ||
|
|
||
| before(() => { | ||
| // # Login as new user and visit off-topic | ||
| cy.apiInitSetup().then(({channel, user, team}) => { | ||
| testTeam = team; | ||
| firstUser = user; | ||
| testChannel = channel; | ||
|
|
||
| cy.apiCreateUser({prefix: 'other'}).then(({user: user1}) => { | ||
| otherUser = user1; | ||
|
|
||
| // # Add user to team and channel | ||
| cy.apiAddUserToTeam(testTeam.id, otherUser.id).then(() => { | ||
| cy.apiAddUserToChannel(testChannel.id, otherUser.id); | ||
|
|
||
| // # Post some messages | ||
| cy.postMessageAs({ | ||
| sender: otherUser, | ||
| message: 'Other message', | ||
| channelId: testChannel.id, | ||
| }); | ||
| cy.postMessageAs({ | ||
| sender: firstUser, | ||
| message: 'Test message', | ||
| channelId: testChannel.id, | ||
| }); | ||
| }); | ||
| }); | ||
| }, | ||
| ); | ||
| }); | ||
|
|
||
| beforeEach(() => { | ||
| // # Visit related channel | ||
| cy.visit(`/${testTeam.name}/channels/${testChannel.name}`); | ||
| }); | ||
|
|
||
| it('MM-T4984_1 Message Display: colorize usernames option should not exist in Compact mode', () => { | ||
| // # Select 'Standard' option | ||
| cy.uiChangeMessageDisplaySetting(); | ||
|
|
||
| // # Set the default text color | ||
| cy.findByText(firstUser.username).then((elements) => { | ||
| cy.window().then((win) => { | ||
| defaultTextColor = win.getComputedStyle(elements[0]).color; | ||
| }); | ||
| }); | ||
|
|
||
| // # Go to Settings modal - Display section - Message Display | ||
| goToMessageDisplaySetting(); | ||
|
|
||
| // * Verify Colorize usernames option doesn't exist; | ||
| cy.findByRole('checkbox', { | ||
| name: 'Colorize usernames: Use colors to distinguish users in compact mode', | ||
| }).should('not.exist'); | ||
|
|
||
| // # Save and close the modal | ||
| cy.uiSaveAndClose(); | ||
| }); | ||
|
|
||
| it('MM-T4984_2 Message Display: colorize usernames option should exist in Compact mode and function as expected', () => { | ||
| // # Select 'Compact' option | ||
| cy.uiChangeMessageDisplaySetting('COMPACT'); | ||
|
|
||
| // # Go to Settings modal - Display section - Message Display | ||
| goToMessageDisplaySetting(); | ||
|
|
||
| // * Verify Colorize usernames option exists and checked by default | ||
| cy.findByRole('checkbox', {name: 'Colorize usernames: Use colors to distinguish users in compact mode'}).should('exist'); | ||
| cy.findByRole('checkbox', {name: 'Colorize usernames: Use colors to distinguish users in compact mode'}).should('be.checked'); | ||
|
|
||
| // # Save and close the modal | ||
| cy.uiSaveAndClose(); | ||
|
|
||
| // # Save the color of the buttons | ||
| cy.findByText(firstUser.username).then((elements) => { | ||
| colors[firstUser.username] = elements[0].attributes.style.value; | ||
| }); | ||
| cy.findByText(otherUser.username).then((elements) => { | ||
| colors[otherUser.username] = elements[0].attributes.style.value; | ||
| }).then(() => { | ||
| // * Verify that colors are different | ||
| expect(colors[firstUser.username]).to.not.equal(colors[otherUser.username]); | ||
| }); | ||
|
|
||
| cy.reload(); | ||
|
|
||
| // * Verify that after reload colors are the same | ||
| cy.findByText(firstUser.username).then((elements) => { | ||
| cy.wrap(elements[0]).should('have.attr', 'style', colors[firstUser.username]); | ||
| }); | ||
| cy.findByText(otherUser.username).then((elements) => { | ||
| cy.wrap(elements[0]).should('have.attr', 'style', colors[otherUser.username]); | ||
| }); | ||
| }); | ||
|
|
||
| it('MM-T4984_3 Message Display: disabling colorize should revert to colors to normal color', () => { | ||
| // # Select 'Compact' option | ||
| cy.uiChangeMessageDisplaySetting('COMPACT'); | ||
|
|
||
| // # Go to Settings modal - Display section - Message Display | ||
| goToMessageDisplaySetting(); | ||
|
|
||
| // # Verify Colorize usernames option exists and make it unchecked | ||
| cy.findByRole('checkbox', {name: 'Colorize usernames: Use colors to distinguish users in compact mode'}).should('exist'); | ||
| cy.findByRole('checkbox', {name: 'Colorize usernames: Use colors to distinguish users in compact mode'}).uncheck().should('not.be.checked'); | ||
|
|
||
| // # Save and close the modal | ||
| cy.uiSaveAndClose(); | ||
|
|
||
| // * Verify that colors are reverted to normal | ||
| cy.findByText(firstUser.username).then((elements) => { | ||
| cy.wrap(elements[0]).should('have.css', 'color', defaultTextColor); | ||
| }); | ||
| cy.findByText(otherUser.username).then((elements) => { | ||
| cy.wrap(elements[0]).should('have.css', 'color', defaultTextColor); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| function goToMessageDisplaySetting() { | ||
| // # Go to Settings modal - Display section - Message Display | ||
| cy.uiOpenSettingsModal('Display').within(() => { | ||
| cy.get('#displayButton').click(); | ||
| cy.get('#message_displayEdit').should('be.visible'); | ||
| cy.get('#message_displayEdit').click(); | ||
| }); | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.