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

[MM-27231]: cypress test for MM-T1837 #6676

Merged
merged 6 commits into from
Oct 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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