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-20164] Member to Admin not updating has been fixed in Channnel Me…
…mber Dropdown (mattermost#4274) * [MM-20164] Fixed going from system admin to member not updating dropdown menu * fix linting errors * fix test * Updated tests and approach to problem * added comments and fixed linting * Fix lint * remove baseurl * Fix baseurl * updated cypress test * Fix linting
- Loading branch information
Showing
4 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
51 changes: 51 additions & 0 deletions
51
e2e/cypress/integration/channel/user_to_admin_updates_manage_channel_members_modal_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,51 @@ | ||
// 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. | ||
// *************************************************************** | ||
|
||
import users from '../../fixtures/users.json'; | ||
|
||
const demoteToMember = (user) => { | ||
cy.externalRequest({user: users.sysadmin, method: 'put', path: `users/${user.id}/roles`, data: {roles: 'system_user'}}); | ||
}; | ||
|
||
const promoteToSysAdmin = (user) => { | ||
cy.externalRequest({user: users.sysadmin, method: 'put', path: `users/${user.id}/roles`, data: {roles: 'system_user system_admin'}}); | ||
}; | ||
|
||
describe('View Members modal', () => { | ||
it('MM-20164 - Going from a Member to an Admin should update the modal', () => { | ||
cy.apiLogin('user-1'); | ||
cy.apiGetMe().then((res) => { | ||
// # Make user a regular member | ||
demoteToMember(res.body); | ||
|
||
// # Visit Town square and go to view members modal | ||
cy.visit('/'); | ||
cy.get('#sidebarItem_town-square').click({force: true}); | ||
cy.get('#member_popover').click(); | ||
cy.findByTestId('membersModal').click(); | ||
|
||
// * Check to see if no drop down menu exists | ||
cy.findAllByTestId('userListItemActions').then((el) => { | ||
expect(el[0].childElementCount).equal(0); | ||
cy.wrap(el[0]).should('not.be.visible'); | ||
}); | ||
|
||
// Promote user to a system admin | ||
promoteToSysAdmin(res.body); | ||
|
||
// * Check to see if a drop now exists now | ||
cy.findAllByTestId('userListItemActions').then((el) => { | ||
expect(el[0].childElementCount).equal(1); | ||
cy.wrap(el[0]).should((children) => { | ||
expect(children).contain('Channel Member'); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |