mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Migration typescript/team.js (#25811)
* refactor: convert file team.js to ts - convert file to typescript - create types in file * refactor: use optional chaining operator for link.click --------- Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
parent
a777e12055
commit
19d6a2c47d
@ -1,14 +1,18 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
Cypress.Commands.add('uiInviteMemberToCurrentTeam', (username) => {
|
/**
|
||||||
|
* Invites a member to the current team
|
||||||
|
* @param {string} username - the username
|
||||||
|
*/
|
||||||
|
function uiInviteMemberToCurrentTeam(username: string) {
|
||||||
// # Open member invite screen
|
// # Open member invite screen
|
||||||
cy.uiOpenTeamMenu('Invite People');
|
cy.uiOpenTeamMenu('Invite People');
|
||||||
|
|
||||||
// # Open members section if licensed for guest accounts
|
// # Open members section if licensed for guest accounts
|
||||||
cy.findByTestId('invitationModal').
|
cy.findByTestId('invitationModal').
|
||||||
then((container) => container.find('[data-testid="inviteMembersLink"]')).
|
then((container) => container.find('[data-testid="inviteMembersLink"]')).
|
||||||
then((link) => link && link.click());
|
then((link) => link?.click());
|
||||||
|
|
||||||
// # Enter bot username and submit
|
// # Enter bot username and submit
|
||||||
cy.get('.users-emails-input__control input').typeWithForce(username).as('input');
|
cy.get('.users-emails-input__control input').typeWithForce(username).as('input');
|
||||||
@ -23,4 +27,16 @@ Cypress.Commands.add('uiInviteMemberToCurrentTeam', (username) => {
|
|||||||
|
|
||||||
// # Close, return
|
// # Close, return
|
||||||
cy.findByTestId('confirm-done').click();
|
cy.findByTestId('confirm-done').click();
|
||||||
});
|
}
|
||||||
|
Cypress.Commands.add('uiInviteMemberToCurrentTeam', uiInviteMemberToCurrentTeam);
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||||
|
namespace Cypress {
|
||||||
|
interface Chainable {
|
||||||
|
uiInviteMemberToCurrentTeam: typeof uiInviteMemberToCurrentTeam;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {};
|
Loading…
Reference in New Issue
Block a user