This repository has been 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.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MM-30363: Cypress/E2E: Automate backlogs - Edit Bot Username (1 test …
…case) (#7073) * MM-30373 - first iteration * MM-30377 - first iteration * remove spurious file * MM-30377 - further iteration * MM-30363 - first iteration * remove extra file * some cleanup * remoe extra space Co-authored-by: Catalin Tomai <catalin.tomai@mattermost.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
- Loading branch information
1 parent
7a55401
commit 84e3132
Showing
1 changed file
with
99 additions
and
0 deletions.
There are no files selected for viewing
99 changes: 99 additions & 0 deletions
99
e2e/cypress/integration/bot_accounts/edit_bot_username_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,99 @@ | ||
// 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: @bot_accounts | ||
|
||
import * as TIMEOUTS from '../../fixtures/timeouts'; | ||
import {getRandomId} from '../../utils'; | ||
|
||
describe('Edit bot username', () => { | ||
let testTeam; | ||
let botName; | ||
let newbotName; | ||
|
||
// # Login as admin and visit town-square | ||
before(() => { | ||
// # Set ServiceSettings to expected values | ||
const newSettings = { | ||
ServiceSettings: { | ||
EnableBotAccountCreation: true, | ||
DisableBotsWhenOwnerIsDeactivated: true, | ||
}, | ||
PluginSettings: { | ||
Enable: true, | ||
RequirePluginSignature: false, | ||
}, | ||
}; | ||
cy.apiUpdateConfig(newSettings); | ||
|
||
cy.apiInitSetup().then(({team}) => { | ||
testTeam = team; | ||
}); | ||
}); | ||
|
||
it('MM-T2923 Edit bot username.', () => { | ||
// # Visit bot config | ||
cy.visit('/admin_console/integrations/bot_accounts'); | ||
|
||
// # Verify that the setting is enabled | ||
cy.findByTestId('ServiceSettings.EnableBotAccountCreationtrue', {timeout: TIMEOUTS.ONE_MIN}).should('be.checked'); | ||
|
||
// # Visit the integrations | ||
cy.visit(`/${testTeam.name}/integrations/bots`); | ||
|
||
// * Assert that adding bots possible | ||
cy.get('#addBotAccount', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible').click(); | ||
|
||
botName = `bot-${getRandomId()}`; | ||
|
||
// # fill+submit form | ||
cy.get('#username').clear().type(botName); | ||
cy.get('#displayName').clear().type('Test Bot'); | ||
cy.get('#saveBot').click(); | ||
cy.get('#doneButton').click(); | ||
|
||
// * Set alias for bot entry in bot list, this also checks that the bot entry exists | ||
cy.get('.backstage-list__item').contains('.backstage-list__item', botName).as('botEntry'); | ||
|
||
cy.get('@botEntry').then((el) => { | ||
// # Find the edit link for the bot | ||
const editLink = el.find('.item-actions>a'); | ||
|
||
if (editLink.text() === 'Edit') { | ||
// # Click the edit link for the bot | ||
cy.wrap(editLink).click(); | ||
|
||
// * Check that user name is as expected | ||
cy.get('#username').should('have.value', botName); | ||
|
||
// * Check that the display name is correct | ||
cy.get('#displayName').should('have.value', 'Test Bot'); | ||
|
||
// * Check that description is empty | ||
cy.get('#description').should('have.value', ''); | ||
|
||
newbotName = `bot-${getRandomId()}`; | ||
|
||
// * Enter the new user name | ||
cy.get('#username').clear().type(newbotName); | ||
|
||
// # Click update button | ||
cy.get('#saveBot').click(); | ||
} | ||
}).then(() => { | ||
// * Set alias for bot entry in bot list, this also checks that the bot entry exists | ||
cy.get('.backstage-list__item').contains('.backstage-list__item', newbotName).as('newbotEntry'); | ||
|
||
// * Get bot entry in bot list by username | ||
cy.get('@newbotEntry').then((el) => { | ||
cy.wrap(el).scrollIntoView(); | ||
}); | ||
}); | ||
}); | ||
}); |