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>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a777e12055
Коммит
19d6a2c47d
42
e2e-tests/cypress/tests/support/ui/team.ts
Обычный файл
42
e2e-tests/cypress/tests/support/ui/team.ts
Обычный файл
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
/**
|
||||
* Invites a member to the current team
|
||||
* @param {string} username - the username
|
||||
*/
|
||||
function uiInviteMemberToCurrentTeam(username: string) {
|
||||
// # Open member invite screen
|
||||
cy.uiOpenTeamMenu('Invite People');
|
||||
|
||||
// # Open members section if licensed for guest accounts
|
||||
cy.findByTestId('invitationModal').
|
||||
then((container) => container.find('[data-testid="inviteMembersLink"]')).
|
||||
then((link) => link?.click());
|
||||
|
||||
// # Enter bot username and submit
|
||||
cy.get('.users-emails-input__control input').typeWithForce(username).as('input');
|
||||
cy.get('.users-emails-input__option ').contains(`@${username}`);
|
||||
cy.get('@input').typeWithForce('{enter}');
|
||||
cy.findByTestId('inviteButton').click();
|
||||
|
||||
// * Verify user invited to team
|
||||
cy.get('.invitation-modal-confirm--sent .InviteResultRow').
|
||||
should('contain.text', `@${username}`).
|
||||
and('contain.text', 'This member has been added to the team.');
|
||||
|
||||
// # Close, return
|
||||
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 {};
|
||||
Ссылка в новой задаче
Block a user