snapshot of https://github.com/mattermost/mattermost.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Nightly Race / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 1s
Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Nightly Race / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 1s
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
// 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: @channels @search
|
||||
|
||||
import * as TIMEOUTS from '@/fixtures/timeouts';
|
||||
import * as MESSAGES from '@/fixtures/messages';
|
||||
|
||||
describe('Search', () => {
|
||||
before(() => {
|
||||
// # Login as test user and visit off-topic
|
||||
cy.apiInitSetup({loginAfter: true}).then(({offTopicUrl}) => {
|
||||
cy.visit(offTopicUrl);
|
||||
});
|
||||
});
|
||||
|
||||
it('QuickInput clear X', () => {
|
||||
// * X should not be visible on empty input
|
||||
cy.uiGetSearchContainer().find('.input-clear-x').should('not.exist');
|
||||
cy.uiGetSearchContainer().click();
|
||||
|
||||
// # Write something on the input
|
||||
cy.uiGetSearchBox().clear().wait(TIMEOUTS.HALF_SEC).type('abc').wait(TIMEOUTS.HALF_SEC).type('{enter}');
|
||||
|
||||
cy.uiGetSearchContainer().click();
|
||||
|
||||
// * The input should contain what we wrote
|
||||
cy.uiGetSearchBox().should('have.value', 'abc');
|
||||
cy.get('#searchBox .icon-close').click();
|
||||
|
||||
// * The X should be visible
|
||||
// # Then click X to clear the input field
|
||||
cy.uiGetSearchContainer().
|
||||
find('.input-clear-x').
|
||||
should('be.visible').
|
||||
click({force: true});
|
||||
|
||||
// * The X should not be visible since the input is cleared
|
||||
cy.uiGetSearchContainer().find('.input-clear-x').should('not.exist');
|
||||
|
||||
// * The value of the input is empty
|
||||
cy.uiGetSearchContainer().click();
|
||||
cy.uiGetSearchBox().should('have.value', '');
|
||||
});
|
||||
|
||||
it('MM-T368 - Text in search box should not clear when Pinned or Saved posts icon is clicked', () => {
|
||||
const searchText = MESSAGES.SMALL;
|
||||
|
||||
// * Verify search input field exists and not search button, as inputs contains placeholder not buttons/icons
|
||||
// and then type in a search text
|
||||
cy.uiGetSearchContainer().click();
|
||||
cy.uiGetSearchBox().clear().wait(TIMEOUTS.HALF_SEC).type(searchText + '{enter}').wait(TIMEOUTS.HALF_SEC);
|
||||
|
||||
// # Now click on the saved post button from the header
|
||||
cy.uiGetSavedPostButton().click();
|
||||
|
||||
// * Verify the pinned post RHS is open
|
||||
cy.uiGetRHS().should('contain', 'Saved messages');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,116 @@
|
||||
// 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.
|
||||
// ***************************************************************
|
||||
|
||||
// Stage: @prod
|
||||
// Group: @channels @search
|
||||
|
||||
function openSidebarMenu() {
|
||||
// # Open the sidebar menu
|
||||
cy.get('button.menu-toggle').click();
|
||||
|
||||
// * Verify the sidebar menu is open
|
||||
cy.get('#sidebar-menu').should('be.visible');
|
||||
}
|
||||
|
||||
function verifyLoadingSpinnerIsGone() {
|
||||
// * Verify that the RHS is open
|
||||
cy.get('#sidebar-right').should('be.visible');
|
||||
|
||||
// * Verify that the loading spinner is eventually gone
|
||||
cy.get('#loadingSpinner').should('not.exist');
|
||||
}
|
||||
|
||||
describe('Mobile Search', () => {
|
||||
let townsquareLink;
|
||||
|
||||
before(() => {
|
||||
// # Login as test user
|
||||
cy.apiInitSetup({loginAfter: true}).then(({team}) => {
|
||||
townsquareLink = `/${team.name}/channels/town-square`;
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
// # Resize window to mobile view
|
||||
cy.viewport('iphone-6');
|
||||
|
||||
// # Visit town-square
|
||||
cy.visit(townsquareLink);
|
||||
});
|
||||
|
||||
it('Opening the Recent Mentions eventually loads the results', () => {
|
||||
// # Open the sidebar menu
|
||||
openSidebarMenu();
|
||||
|
||||
// # Click the Recent Mentions button
|
||||
cy.get('#recentMentions').click();
|
||||
|
||||
// * Verify that the loading spinner is eventually gone
|
||||
verifyLoadingSpinnerIsGone();
|
||||
});
|
||||
|
||||
it('Opening the Saved Posts eventually loads the results', () => {
|
||||
// # Open the sidebar menu
|
||||
openSidebarMenu();
|
||||
|
||||
// # Click the Saved Posts button
|
||||
cy.get('#flaggedPosts').click();
|
||||
|
||||
// * Verify that the loading spinner is eventually gone
|
||||
verifyLoadingSpinnerIsGone();
|
||||
});
|
||||
|
||||
it('Searching eventually loads the results', () => {
|
||||
// * Open the search box
|
||||
cy.get('button.navbar-search').click();
|
||||
|
||||
// * Verify that the search box is open
|
||||
cy.get('#sbrSearchBox').should('be.visible');
|
||||
|
||||
// # Type any string and hit Enter
|
||||
cy.get('#sbrSearchBox').type('test').type('{enter}');
|
||||
|
||||
// * Verify that the loading spinner is eventually gone
|
||||
verifyLoadingSpinnerIsGone();
|
||||
});
|
||||
|
||||
it('MM-64681 should be able to autocomplete users and channels in mobile view', () => {
|
||||
// * Open the search box
|
||||
cy.get('button.navbar-search').click();
|
||||
|
||||
// * Verify that the search box is open
|
||||
cy.get('#sbrSearchBox').should('be.visible');
|
||||
|
||||
// # Trigger the user autocomplete to appear
|
||||
cy.get('#sbrSearchBox').type('from:');
|
||||
|
||||
// * Verify that the autocomplete is visible and contains some result
|
||||
cy.get('[role="listbox"]').get('[role="option"]').should('be.visible').and('contain.text', 'sysadmin');
|
||||
|
||||
// # Select a user
|
||||
cy.get('[role="option"]').contains('sysadmin').click();
|
||||
|
||||
// * Verify that the autocomplete closed and the user's name was added to the result
|
||||
cy.get('[role="listbox"]').should('not.exist');
|
||||
cy.get('#sbrSearchBox').should('have.value', 'from:sysadmin ');
|
||||
|
||||
// # Trigger the channel autocomplete to appear
|
||||
cy.get('#sbrSearchBox').type('in:');
|
||||
|
||||
// * Verify that the autocomplete is visible and contains some results
|
||||
cy.get('[role="listbox"]').get('[role="option"]').should('be.visible');
|
||||
|
||||
// # Select a channel
|
||||
cy.get('[role="option"]').contains('Off-Topic').click();
|
||||
|
||||
// * Verify that the autocomplete closed and the Off-Topic channel was selected was added to the result
|
||||
cy.get('[role="listbox"]').should('not.exist');
|
||||
cy.get('#sbrSearchBox').should('have.value', 'from:sysadmin in:off-topic ');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,50 @@
|
||||
// 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: @channels @search @not_cloud
|
||||
|
||||
import * as TIMEOUTS from '@/fixtures/timeouts';
|
||||
|
||||
describe('Search', () => {
|
||||
before(() => {
|
||||
cy.shouldNotRunOnCloudEdition();
|
||||
|
||||
cy.apiUpdateConfig({
|
||||
ServiceSettings: {
|
||||
EnableTesting: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
cy.apiAdminLogin();
|
||||
cy.apiInitSetup({loginAfter: true}).then(({offTopicUrl}) => {
|
||||
cy.visit(offTopicUrl);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T2286 - Clicking a hashtag from a message opens messages with that hashtag on RHS', () => {
|
||||
const testSearch = '/test url test-search';
|
||||
|
||||
// # Post message
|
||||
cy.postMessage(testSearch);
|
||||
|
||||
// # Expand the test-search message
|
||||
cy.get('#showMoreButton').click().wait(TIMEOUTS.HALF_SEC);
|
||||
|
||||
// # Click the #hello on the test-search message
|
||||
cy.get('[data-hashtag="#hello"]').first().click().wait(TIMEOUTS.HALF_SEC);
|
||||
|
||||
// # RHS should be visible with search results
|
||||
cy.get('#search-items-container').should('be.visible');
|
||||
|
||||
// * Assert search results are present and correct
|
||||
cy.get('[data-testid="search-item-container"]').should('be.visible').should('contain.text', '#hello');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,111 @@
|
||||
// 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.
|
||||
// ***************************************************************
|
||||
|
||||
// Stage: @prod
|
||||
// Group: @channels @search
|
||||
|
||||
import * as TIMEOUTS from '@/fixtures/timeouts';
|
||||
|
||||
describe('Search', () => {
|
||||
let testTeam;
|
||||
|
||||
before(() => {
|
||||
// Initialize a user.
|
||||
cy.apiInitSetup().then(({team}) => {
|
||||
testTeam = team;
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
cy.apiAdminLogin();
|
||||
|
||||
// Visit town square as an admin
|
||||
cy.visit(`/${testTeam.name}/channels/town-square`);
|
||||
});
|
||||
|
||||
it('MM-T1450 - Autocomplete behaviour', () => {
|
||||
// # Post message in town-square
|
||||
cy.postMessage('hello');
|
||||
|
||||
// # Click on searchbox
|
||||
cy.uiGetSearchContainer().should('be.visible').click();
|
||||
|
||||
// * Check the contents in search options
|
||||
assertSearchHintFilesOrMessages();
|
||||
|
||||
// # Search for search term in:
|
||||
cy.uiGetSearchBox().type('in:');
|
||||
|
||||
// # Select option from suggestion list
|
||||
cy.get('.suggestion-list__item').first().click({force: true});
|
||||
|
||||
// * Assert suggestions are not present after selecting item
|
||||
cy.get('.suggestion-list__item').should('not.exist');
|
||||
|
||||
// # Clear search box
|
||||
cy.get('.input-clear-x').first().click({force: true}).wait(TIMEOUTS.HALF_SEC);
|
||||
|
||||
// # Search for search term in:town-square{space}
|
||||
cy.uiGetSearchBox().type('in:town-square ').wait(TIMEOUTS.HALF_SEC);
|
||||
|
||||
// * Check the hint contents are now visible
|
||||
assertSearchHint();
|
||||
|
||||
// # Clear search box
|
||||
cy.uiGetSearchBox().get('.input-clear-x').click({force: true}).wait(TIMEOUTS.HALF_SEC);
|
||||
|
||||
// # Search for search term in:town-square{enter}
|
||||
cy.uiGetSearchBox().type('in:town-square').wait(TIMEOUTS.HALF_SEC);
|
||||
|
||||
// * Assert that channel name displays appropriately
|
||||
cy.get('.suggestion-list__item').first().should('contain.text', 'Town Square~town-square');
|
||||
|
||||
// # Press enter to register search term
|
||||
cy.uiGetSearchBox().type('{enter}');
|
||||
|
||||
// * Check the hint contents are now visible
|
||||
assertSearchHint();
|
||||
|
||||
// * Assert that searchBox now includes a trailing space
|
||||
cy.uiGetSearchBox().should('have.value', 'in:town-square ');
|
||||
|
||||
// # Perform the search
|
||||
cy.uiGetSearchBox().type('{enter}').wait(TIMEOUTS.HALF_SEC);
|
||||
|
||||
// * Assert autocomplete list is gone
|
||||
cy.get('.suggestion-list__item').should('not.exist');
|
||||
});
|
||||
|
||||
it('MM-T2291 - Wildcard Search', () => {
|
||||
const testMessage = 'Hello World!!!';
|
||||
|
||||
// # Post message
|
||||
cy.postMessage(testMessage);
|
||||
|
||||
cy.uiGetSearchContainer().click();
|
||||
|
||||
// # Search for `Hell*`
|
||||
cy.uiGetSearchBox().type('Hell*{enter}').wait(TIMEOUTS.HALF_SEC);
|
||||
|
||||
// # RHS should be visible with search results
|
||||
cy.get('#search-items-container').should('be.visible');
|
||||
|
||||
// * Assert search results are present and correct
|
||||
cy.get('[data-testid="search-item-container"]').should('be.visible');
|
||||
cy.get('.search-highlight').first().should('contain.text', 'Hell');
|
||||
});
|
||||
});
|
||||
|
||||
const assertSearchHintFilesOrMessages = () => {
|
||||
cy.get('#searchHints').should('be.visible');
|
||||
};
|
||||
|
||||
const assertSearchHint = () => {
|
||||
cy.get('#searchHints').should('be.visible');
|
||||
};
|
||||
@@ -0,0 +1,67 @@
|
||||
// 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.
|
||||
// ***************************************************************
|
||||
|
||||
// Stage: @prod
|
||||
// Group: @channels @search
|
||||
|
||||
import {getRandomId} from '@/utils';
|
||||
|
||||
describe('Search', () => {
|
||||
before(() => {
|
||||
// # Login as test user and visit Off-Topic
|
||||
cy.apiInitSetup({loginAfter: true}).then(({team}) => {
|
||||
cy.visit(`/${team.name}/channels/off-topic`);
|
||||
|
||||
// # Post several messages of similar format to add complexity in searching
|
||||
Cypress._.times(5, () => {
|
||||
cy.postMessage(`apple${getRandomId()}`);
|
||||
cy.postMessage(`banana${getRandomId()}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('S19944 Highlighting does not change to what is being typed in the search input box', () => {
|
||||
const apple = `apple${getRandomId()}`;
|
||||
const banana = `banana${getRandomId()}`;
|
||||
|
||||
const message = apple + ' ' + banana;
|
||||
|
||||
// # Post a message as "apple" and "banana"
|
||||
cy.postMessage(message);
|
||||
|
||||
// # Search for "apple"
|
||||
cy.uiGetSearchContainer().click();
|
||||
cy.uiGetSearchBox().should('be.visible').type(apple).type('{enter}');
|
||||
|
||||
// # Get last postId
|
||||
cy.getLastPostId().as('lastPostId');
|
||||
|
||||
// * Search result should return one post with highlight on apple
|
||||
cy.get('@lastPostId').then((postId) => {
|
||||
verifySearchResult(1, postId, message, apple);
|
||||
});
|
||||
|
||||
cy.uiGetSearchContainer().click();
|
||||
|
||||
// * Type banana on search box but don't hit search
|
||||
cy.uiGetSearchBox().clear({force: true}).type(banana, {force: true});
|
||||
|
||||
// * Search result should not change and remain as one result with highlight still on apple
|
||||
cy.get('@lastPostId').then((postId) => {
|
||||
verifySearchResult(1, postId, message, apple);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function verifySearchResult(results, postId, fullMessage, highlightedTerm) {
|
||||
cy.findAllByTestId('search-item-container').should('have.length', results).within(() => {
|
||||
cy.get(`#rhsPostMessageText_${postId}`).should('have.text', `${fullMessage}`);
|
||||
cy.get('.search-highlight').should('be.visible').and('have.text', highlightedTerm);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
// 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: @channels @search @filesearch
|
||||
|
||||
describe('Search', () => {
|
||||
let testTeam;
|
||||
let testUser;
|
||||
let userOne;
|
||||
let userTwo;
|
||||
let userThree;
|
||||
|
||||
before(() => {
|
||||
// # Create new team and users
|
||||
cy.apiInitSetup().then(({team, user}) => {
|
||||
testUser = user;
|
||||
testTeam = team;
|
||||
|
||||
cy.apiCreateUser({prefix: 'aaa'}).then(({user: user1}) => {
|
||||
userOne = user1;
|
||||
cy.apiAddUserToTeam(testTeam.id, userOne.id);
|
||||
});
|
||||
|
||||
cy.apiCreateUser({prefix: 'bbb'}).then(({user: user2}) => {
|
||||
userTwo = user2;
|
||||
cy.apiAddUserToTeam(testTeam.id, userTwo.id);
|
||||
});
|
||||
|
||||
cy.apiCreateUser({prefix: 'ccc'}).then(({user: user3}) => {
|
||||
userThree = user3;
|
||||
cy.apiAddUserToTeam(testTeam.id, userThree.id);
|
||||
});
|
||||
|
||||
cy.apiLogin(testUser);
|
||||
});
|
||||
});
|
||||
|
||||
it('S14673 - Search "in:[username]" returns results in GMs', () => {
|
||||
const groupMembers = [testUser, userOne, userTwo, userThree];
|
||||
cy.apiCreateGroupChannel(groupMembers.map((member) => member.id)).then(({channel}) => {
|
||||
cy.visit(`/${testTeam.name}/messages/${channel.name}`);
|
||||
|
||||
const message = `hello${Date.now()}`;
|
||||
|
||||
// # Post a message
|
||||
cy.postMessage(message);
|
||||
|
||||
cy.uiGetSearchContainer().should('be.visible').click();
|
||||
|
||||
//# Type "in:" text in search input
|
||||
cy.uiGetSearchBox().type('in:');
|
||||
|
||||
const sortedUsernames = groupMembers.
|
||||
map((member) => member.username).
|
||||
sort((a, b) => a.localeCompare(b, 'en', {numeric: true}));
|
||||
|
||||
//# Search group members in the menu
|
||||
cy.uiGetSearchBox().find('.suggestion-list__main').contains(sortedUsernames.join(',')).click();
|
||||
|
||||
//# Press enter to select
|
||||
cy.uiGetSearchBox().type('{enter}');
|
||||
|
||||
//# Search for the message
|
||||
cy.uiGetSearchContainer().should('be.visible').click();
|
||||
cy.uiGetSearchBox().clear().type(`${message}{enter}`);
|
||||
|
||||
// * Should return exactly one result from the group channel and matches the message
|
||||
cy.findAllByTestId('search-item-container').should('be.visible').and('have.length', 1).within(() => {
|
||||
cy.get('.search-channel__name').should('be.visible').and('have.text', sortedUsernames.filter((username) => username !== testUser.username).join(', '));
|
||||
cy.get('.search-highlight').should('be.visible').and('have.text', message);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('Search "in:[username]" returns results file in GMs', () => {
|
||||
const groupMembers = [testUser, userOne, userTwo, userThree];
|
||||
cy.apiCreateGroupChannel(groupMembers.map((member) => member.id)).then(({channel}) => {
|
||||
cy.visit(`/${testTeam.name}/messages/${channel.name}`);
|
||||
|
||||
// # Post file to group
|
||||
cy.get('#advancedTextEditorCell').find('#fileUploadInput').attachFile('word-file.doc');
|
||||
cy.get('.post-image__thumbnail').should('be.visible');
|
||||
cy.uiGetPostTextBox().clear().type('{enter}');
|
||||
|
||||
cy.uiGetSearchContainer().should('be.visible').click();
|
||||
|
||||
//# Type "in:" text in search input
|
||||
cy.uiGetSearchBox().type('in:');
|
||||
|
||||
const sortedUsernames = groupMembers.
|
||||
map((member) => member.username).
|
||||
sort((a, b) => a.localeCompare(b, 'en', {numeric: true}));
|
||||
|
||||
//# Search group members in the menu
|
||||
cy.uiGetSearchBox().find('.suggestion-list__main').contains(sortedUsernames.join(',')).click();
|
||||
|
||||
//# Search for the message
|
||||
cy.uiGetSearchBox().type('word-file{enter}');
|
||||
|
||||
// # Click the files tab
|
||||
cy.get('.files-tab').should('be.visible').click();
|
||||
|
||||
// * Should return exactly one result from the group channel and matches the message
|
||||
cy.findAllByTestId('search-item-container').should('be.visible').and('have.length', 1).within(() => {
|
||||
cy.get('.Tag').should('be.visible').and('have.text', 'Group Message');
|
||||
cy.get('.fileDataName').should('be.visible').and('have.text', 'word-file.doc');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,84 @@
|
||||
// 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: @channels @search @smoke @filesearch
|
||||
|
||||
import * as TIMEOUTS from '@/fixtures/timeouts';
|
||||
|
||||
/**
|
||||
* create new DM channel
|
||||
* @param {String} text - DM channel name
|
||||
*/
|
||||
function createNewDMChannel(channelname) {
|
||||
cy.uiAddDirectMessage().scrollIntoView().click();
|
||||
|
||||
cy.get('#selectItems input').typeWithForce(channelname);
|
||||
|
||||
cy.contains('.more-modal__description', channelname).click({force: true});
|
||||
cy.get('#saveItems').click().wait(TIMEOUTS.ONE_SEC);
|
||||
}
|
||||
|
||||
describe('Search in DMs', () => {
|
||||
let otherUser;
|
||||
|
||||
before(() => {
|
||||
// # Log in as test user and visit test channel
|
||||
cy.apiInitSetup().then(({team, channel, user: testUser}) => {
|
||||
Cypress._.times(5, (i) => {
|
||||
cy.apiCreateUser().then(({user}) => {
|
||||
if (i === 0) {
|
||||
otherUser = user;
|
||||
}
|
||||
|
||||
cy.apiAddUserToTeam(team.id, user.id).then(() => {
|
||||
cy.apiAddUserToChannel(channel.id, user.id);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
cy.apiLogin(testUser);
|
||||
cy.visit(`/${team.name}/channels/${channel.name}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('Search "in:[username]" returns file results in DMs', () => {
|
||||
// # Ensure Direct Message is visible in LHS sidebar
|
||||
cy.uiGetLhsSection('DIRECT MESSAGES').should('be.visible');
|
||||
|
||||
// # Create new DM channel with user's email
|
||||
createNewDMChannel(otherUser.email);
|
||||
|
||||
// # Post file to user
|
||||
cy.get('#advancedTextEditorCell').find('#fileUploadInput').attachFile('word-file.doc');
|
||||
cy.get('.post-image__thumbnail').should('be.visible');
|
||||
cy.uiGetPostTextBox().clear().type('{enter}');
|
||||
|
||||
cy.uiGetSearchContainer().should('be.visible').click();
|
||||
|
||||
// # Type `in:` in searchbox
|
||||
cy.uiGetSearchBox().type('in:');
|
||||
|
||||
// # Select user from suggestion list
|
||||
cy.contains('.suggestion-list__item', `@${otherUser.username}`).scrollIntoView().click();
|
||||
|
||||
// # Validate searchbox contains the username
|
||||
cy.uiGetSearchBox().should('have.value', 'in:@' + otherUser.username + ' ');
|
||||
|
||||
// # Press Enter in searchbox
|
||||
cy.uiGetSearchBox().type('word-file').type('{enter}');
|
||||
|
||||
// # Click the files tab
|
||||
cy.get('.files-tab').should('be.visible').click();
|
||||
|
||||
// # Search message in each filtered result
|
||||
cy.get('#search-items-container').find('.fileDataName').each(($el) => {
|
||||
cy.wrap($el).should('have.text', 'word-file.doc');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user