Skip to content

Commit

Permalink
MM-T571 Integration search gives feed back when there are no results. (
Browse files Browse the repository at this point in the history
…mattermost#6922)

* wip

* wip

* done

* Delete only_public_channels_available_in_webhook_spec.js

* additional checks

* refactor

* refactor

* lint fix

* fix after refactor

Co-authored-by: Mattermost <[email protected]>
Co-authored-by: Mattermod <[email protected]>
  • Loading branch information
3 people committed Oct 29, 2020
1 parent 511b891 commit 9658b30
Showing 1 changed file with 105 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
// 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: @integrations

import {getRandomId} from '../../utils';

describe('Integrations', () => {
let teamName;

before(() => {
// # Setup with the new team and channel
cy.apiInitSetup().then(({team, channel}) => {
teamName = team.name;

// # Setup 2 incoming webhooks
Cypress._.times(2, (i) => {
const newIncomingHook = {
channel_id: channel.id,
description: `Incoming webhook Test Description ${i}`,
display_name: `Test ${i}`,
};
cy.apiCreateWebhook(newIncomingHook);
});

// # Setup 2 outgoing webhooks
Cypress._.times(2, (i) => {
const newOutgoingHook = {
team_id: team.id,
display_name: `Test ${i} `,
trigger_words: [`test-trigger-${i}`],
callback_urls: ['https://mattermost.com'],
};
cy.apiCreateWebhook(newOutgoingHook, false);
});

// # Setup 2 Slash Commands
Cypress._.times(2, (i) => {
const slashCommand1 = {
description: `Test Slash Command ${i}`,
display_name: `Test ${i}`,
method: 'P',
team_id: team.id,
trigger: `trigger${i}`,
url: 'https://google.com',
};
cy.apiCreateCommand(slashCommand1);
});

// # Setup 2 bot accounts
Cypress._.times(2, () => {
const randomBotName = `${getRandomId(2)}`;
cy.apiCreateBot(`test-${randomBotName}`);
});

// # Visit the integrations page
cy.visit(`/${teamName}/integrations`);
});
});

it('MM-T571 Integration search gives feed back when there are no results', () => {
// # Shrink the page, set up constants
cy.viewport('ipad-2');
const results = 'Test';
const noResults = `${getRandomId(6)}`;

// * Check incoming webhooks for no match message
cy.get('#incomingWebhooks').click();
cy.get('#searchInput').type(results).then(() => {
cy.get('#emptySearchResultsMessage').should('not.exist');
});
cy.get('#searchInput').clear().type(noResults);
cy.get('#emptySearchResultsMessage').contains(`No incoming webhooks match ${noResults}`);

// * Check outgoing webhooks for no match message
cy.get('#outgoingWebhooks').click();
cy.get('#searchInput').type(results).then(() => {
cy.get('#emptySearchResultsMessage').should('not.exist');
});
cy.get('#searchInput').clear().type(noResults);
cy.get('#emptySearchResultsMessage').contains(`No outgoing webhooks match ${noResults}`);

// * Check slash commands for no match message
cy.get('#slashCommands').click();
cy.get('#searchInput').type(results).then(() => {
cy.get('#emptySearchResultsMessage').should('not.exist');
});
cy.get('#searchInput').clear().type(noResults);
cy.get('#emptySearchResultsMessage').contains(`No commands match ${noResults}`);

// * Check bot accounts for no match message
cy.get('#botAccounts').click();
cy.get('#searchInput').type(results).then(() => {
cy.get('#emptySearchResultsMessage').should('not.exist');
});
cy.get('#searchInput').clear().type(noResults);
cy.get('#emptySearchResultsMessage').contains(`No bot accounts match ${noResults}`);
});
});

0 comments on commit 9658b30

Please sign in to comment.