Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
[MM-27231]: cypress test for MM-T1837 (#6676)
Browse files Browse the repository at this point in the history
* [MM-27231]: cypress test for MM-T1837

* fix comment format

* Add tests for plugin bots

* clean up after test

* Apply suggestions from code review

Co-authored-by: Joseph Baylon <joseph.baylon@mattermost.com>

Co-authored-by: Joseph Baylon <joseph.baylon@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
  • Loading branch information
3 people authored and calebroseland committed Oct 27, 2020
1 parent ad5bd80 commit edce780
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions e2e/cypress/integration/messaging/header_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,70 @@ describe('Header', () => {
// # Verify that the Search term input box is still cleared and search term does not reappear when RHS opens
cy.get('#searchBox').should('have.attr', 'value', '').and('be.empty');
});

it('MM-T1837_1 - DM channel with bot displays a normal header', () => {
cy.apiAdminLogin();

// # Enable Bots
cy.apiUpdateConfig({
ServiceSettings: {
EnableBotAccountCreation: true,
},
});

// # Create a bot
const botUsername = 'a-bot-to-dm' + Date.now();
const description = 'A bot to DM';
cy.apiCreateBot(botUsername, 'Bot To DM', description);

// # Open a DM with the bot
cy.get('#addDirectChannel').click().wait(TIMEOUTS.HALF_SEC);
cy.focused().type(botUsername, {force: true}).type('{enter}', {force: true}).wait(TIMEOUTS.HALF_SEC);
cy.get('#saveItems').click().wait(TIMEOUTS.HALF_SEC);

// * Verify Channel Header is visible
cy.get('#channelHeaderInfo').should('be.visible');

// * Verify header content
cy.get('#channelHeaderDescription > .header-description__text').find('p').should('have.text', description);
});

it('MM-T1837_2 - DM channel with bot from plugin displays a normal header', () => {
cy.apiAdminLogin();

// # Enable Bots and plugins
cy.apiUpdateConfig({
ServiceSettings: {
EnableBotAccountCreation: true,
},
PluginSettings: {
Enable: true,
RequirePluginSignature: false,
},
});

// # Try to remove the plugin, just in case
cy.apiRemovePluginById('com.github.matterpoll.matterpoll');

// # Upload and enable "matterpoll" plugin
cy.apiUploadPlugin('com.github.matterpoll.matterpoll.tar.gz').then(() => {
cy.apiEnablePluginById('com.github.matterpoll.matterpoll');
});

// # Open a DM with the bot
cy.get('#addDirectChannel').click().wait(TIMEOUTS.HALF_SEC);
cy.focused().type('matterpoll', {force: true}).type('{enter}', {force: true}).wait(TIMEOUTS.HALF_SEC);
cy.get('#saveItems').click().wait(TIMEOUTS.HALF_SEC);

// * Verify Channel Header is visible
cy.get('#channelHeaderInfo').should('be.visible');

// * Verify header content
cy.get('#channelHeaderDescription > .header-description__text').find('p').should('have.text', 'Poll Bot');

// # Clean up, uninstall "matterpoll" plugin
cy.apiRemovePluginById('com.github.matterpoll.matterpoll');
});
});

function updateAndVerifyChannelHeader(prefix, header) {
Expand Down

0 comments on commit edce780

Please sign in to comment.