* refactor: convert bot_api_1_spec.js to typescript - convert file bot_accounts/bot_api_1_spec.js to typescript - update related data types in order to fix argument issues * refactor: convert bot_api_not_cloud_spec.js to ts - convert file bot_accounts/bot_api_not_cloud_spec.js to typescript - update related data types in order to fix argument issues * refactor: convert bot_channel_intro_spec.js to ts - convert file bot_accounts/bot_channel_intro_spec.js to typescript - convert support/api/bots.js to typescript - remove data type bot.d.ts and include docs and definitions in support/api/bots.ts * refactor: convert bot_accounts files to ts - convert files from js to typescript - move declaration files to ts - update js docs - fix lint and type errors Related to #21303 * fix: replace params undefined on client.createUser - replace undefined params with empty strings as suggested in review * fix: add types to variables on spec tags_spec.ts - add types to variables * fix: update args for apiCreateBot on api/bots.ts - update args so that lint issue is fixed * Apply suggestions from code review update assertion to 401 --------- Co-authored-by: Saturnino Abril <5334504+saturninoabril@users.noreply.github.com>
34 строки
1.1 KiB
TypeScript
34 строки
1.1 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {Team} from '@mattermost/types/teams';
|
|
import {getRandomId} from '../../../utils';
|
|
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
|
|
|
export function createBotInteractive(team: Team, username = `bot-${getRandomId()}`) {
|
|
// # Visit the Integrations > Bot Accounts page
|
|
cy.visit(`/${team.name}/integrations/bots`);
|
|
|
|
// # Click add bot
|
|
cy.get('#addBotAccount').click();
|
|
|
|
// # Fill and submit form
|
|
cy.get('#username').type(username);
|
|
cy.get('#displayName').type('Test Bot');
|
|
cy.get('#saveBot').click();
|
|
|
|
// * Verify confirmation page
|
|
cy.url({timeout: TIMEOUTS.ONE_MIN}).
|
|
should('include', `/${team.name}/integrations/confirm`).
|
|
should('match', /token=[a-zA-Z0-9]{26}/);
|
|
|
|
// * Verify confirmation form/token
|
|
cy.get('div.backstage-form').
|
|
should('include.text', 'Setup Successful').
|
|
should((confirmation) => {
|
|
expect(confirmation.text()).to.match(/Token: [a-zA-Z0-9]{26}/);
|
|
});
|
|
|
|
return cy.get('div.backstage-form').invoke('text');
|
|
}
|