diff --git a/e2e/cypress/integration/messaging/header_spec.js b/e2e/cypress/integration/messaging/header_spec.js index 43b9c62d35bd..71a1b595290e 100644 --- a/e2e/cypress/integration/messaging/header_spec.js +++ b/e2e/cypress/integration/messaging/header_spec.js @@ -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) {