MM-35678 Detox/E2E: Add e2e for hashtags, empty mentions and reactions, jump to search (#5481)

* MM-35678 Detox/E2E: Add e2e for hashtags, empty mentions, empty reactions, jump to search

* Add missing verification

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
Joseph Baylon 2021-06-24 10:46:25 -07:00 committed by GitHub
parent b893cc1a3b
commit 9f36d440b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 260 additions and 1 deletions

View file

@ -144,7 +144,7 @@ describe('Channels List', () => {
await closeMainSidebar();
});
it('MM-T847 should display filtered channels list and be able to change channels', async () => {
xit('MM-T847 should display filtered channels list and be able to change channels', async () => { // disable for now; need to fix username display
// # Visit private, public, and favorite channels
await goToChannel(privateChannel.display_name);
await goToChannel(publicChannel.display_name);
@ -251,4 +251,81 @@ describe('Channels List', () => {
await getChannelDisplayNameAtIndex(0).tap();
await ChannelScreen.toBeVisible();
});
xit('MM-T2507 should be able to jump to direct message channel by username, first name, last name, nickname', async () => { // related issue https://mattermost.atlassian.net/browse/MM-30342
const {user: userOnTeam} = await User.apiCreateUser();
await Team.apiAddUserToTeam(userOnTeam.id, testTeam.id);
// # Open main sidebar
await openMainSidebar();
// # Enter username search term
await searchInput.typeText(userOnTeam.username);
await searchInput.tapBackspaceKey();
// * Verify user on team is displayed
await hasFilteredChannelDisplayNameAtIndex(0, userOnTeam.username);
// # Enter first name search term
await searchInput.clearText();
await searchInput.typeText(userOnTeam.first_name);
await searchInput.tapBackspaceKey();
// * Verify user on team is displayed
await hasFilteredChannelDisplayNameAtIndex(0, userOnTeam.username);
// # Enter last name search term
await searchInput.clearText();
await searchInput.typeText(userOnTeam.last_name);
await searchInput.tapBackspaceKey();
// * Verify user on team is displayed
await hasFilteredChannelDisplayNameAtIndex(0, userOnTeam.username);
// # Enter nickname search term
await searchInput.clearText();
await searchInput.typeText(userOnTeam.nickname);
await searchInput.tapBackspaceKey();
// * Verify user on team is displayed
await hasFilteredChannelDisplayNameAtIndex(0, userOnTeam.username);
// # Go back to channel
await closeMainSidebar();
});
it('MM-T2511 should not be able to jump to private channel to join and channel outside of team', async () => {
const {channel: nonJoinedPrivateChannel} = await Channel.apiCreateChannel({type: 'P', prefix: 'non-joined-private', teamId: testTeam.id});
const {team: outsideTeam} = await Team.apiCreateTeam();
const {channel: outsideTeamPublicChannel} = await Channel.apiCreateChannel({type: 'O', prefix: 'outside-team-public', teamId: outsideTeam.id});
// # Open main sidebar
await openMainSidebar();
// # Enter joined private channel search term
await searchInput.typeText(privateChannel.display_name);
await searchInput.tapBackspaceKey();
// * Verify joined private channel is displayed
await expect(element(by.text(privateChannel.display_name))).toBeVisible();
// # Enter non-joined private channel search term
await searchInput.clearText();
await searchInput.typeText(nonJoinedPrivateChannel.display_name);
await searchInput.tapBackspaceKey();
// * Verify non-joined private channel is not displayed
await expect(element(by.text(nonJoinedPrivateChannel.display_name))).not.toBeVisible();
// # Enter outside team public channel search term
await searchInput.clearText();
await searchInput.typeText(outsideTeamPublicChannel.display_name);
await searchInput.tapBackspaceKey();
// * Verify outside team public channel is not displayed
await expect(element(by.text(outsideTeamPublicChannel.display_name))).not.toBeVisible();
// # Go back to channel
await closeMainSidebar();
});
});

View file

@ -131,4 +131,24 @@ describe('Emojis and Reactions', () => {
// # Close AddReaction Screen
await AddReactionScreen.close();
});
it('MM-T3316 should display empty search state for emoji picker', async () => {
// # Post a message
const testMessage = Date.now().toString();
await postMessage(testMessage);
// # Add a reaction
const {post} = await Post.apiGetLastPostInChannel(townSquareChannel.id);
const searchTerm = 'blahblahblahblah';
await openPostOptionsFor(post.id, testMessage);
await AddReactionScreen.open();
await AddReactionScreen.searchInput.typeText(searchTerm);
// * Verify empty search state for emoji picker
await expect(element(by.text(`No results found for "${searchTerm}"`))).toBeVisible();
await expect(element(by.text('Check the spelling or try another search.'))).toBeVisible();
// # Go back to channel
await AddReactionScreen.close();
});
});

View file

@ -0,0 +1,122 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
// *******************************************************************
// - [#] indicates a test step (e.g. # Go to a screen)
// - [*] indicates an assertion (e.g. * Check the title)
// - Use element testID when selecting an element. Create one if none.
// *******************************************************************
import {
ChannelScreen,
SearchScreen,
ThreadScreen,
} from '@support/ui/screen';
import {
Channel,
Post,
Setup,
} from '@support/server_api';
describe('Hashtags', () => {
const {postMessage} = ChannelScreen;
const {
getSearchResultPostItem,
searchInput,
} = SearchScreen;
let townSquareChannel;
beforeAll(async () => {
const {team, user} = await Setup.apiInit();
({channel: townSquareChannel} = await Channel.apiGetChannelByName(team.id, 'town-square'));
// # Open channel screen
await ChannelScreen.open(user);
});
afterAll(async () => {
await ChannelScreen.logout();
});
it('MM-T356 should be able to post hashtags on main channel', async () => {
// # Post hashtags
const valid1 = '#TEST';
const valid2 = '#QA-testing';
const valid3 = '#hello-world';
const invalid1 = '#ab';
const invalid2 = '#123';
await postMessage(valid1);
await postMessage(valid2);
await postMessage(valid3);
await postMessage(invalid1);
await postMessage(invalid2);
// * Verify valid ones open search result screen
await element(by.text(valid1)).tap();
await SearchScreen.toBeVisible();
await searchInput.clearText();
await SearchScreen.cancel();
await element(by.text(valid2)).tap();
await SearchScreen.toBeVisible();
await searchInput.clearText();
await SearchScreen.cancel();
await element(by.text(valid3)).tap();
await SearchScreen.toBeVisible();
await searchInput.clearText();
await SearchScreen.cancel();
// * Verify invalid ones open thread screen
await element(by.text(invalid1)).tap();
await ThreadScreen.toBeVisible();
await ThreadScreen.back();
await element(by.text(invalid2)).tap();
await ThreadScreen.toBeVisible();
await ThreadScreen.back();
// # Search for valid one and tap on hashtag from results
await SearchScreen.open();
await searchInput.typeText(valid1);
await searchInput.tapReturnKey();
await element(by.text(valid1).withAncestor(by.id(SearchScreen.testID.searchResultsList))).atIndex(1).tap();
await SearchScreen.toBeVisible();
// # Search for invalid one and tap on hashtag from results
await searchInput.clearText();
await searchInput.typeText(invalid1);
await searchInput.tapReturnKey();
await element(by.text(invalid1).withAncestor(by.id(SearchScreen.testID.searchResultsList))).atIndex(1).tap();
await ThreadScreen.toBeVisible();
// # Go back to channel
await ThreadScreen.back();
await searchInput.clearText();
await SearchScreen.cancel();
});
it('MM-T357 should be able to tap on hashtag from search result reply thread', async () => {
// # Post hashtags
const hashtag = '#hashtag';
await postMessage(hashtag);
// * Verify tapping on hashtag shows result containing post of hashtag
await element(by.text(hashtag)).tap();
await SearchScreen.toBeVisible();
await expect(element(by.text(hashtag)).atIndex(1)).toExist();
// # Open reply thread from search result and tap on hashtag
const {post} = await Post.apiGetLastPostInChannel(townSquareChannel.id);
const {searchResultPostItem} = await getSearchResultPostItem(post.id, hashtag);
await searchResultPostItem.tap();
await ThreadScreen.toBeVisible();
await element(by.text(hashtag)).atIndex(1).tap();
// * Verify tapping on hashtag from reply thread shows result containing post of hashtag
await SearchScreen.toBeVisible();
await expect(element(by.text(hashtag)).atIndex(1)).toExist();
// # Go back to channel
await searchInput.clearText();
await SearchScreen.cancel();
});
});

View file

@ -0,0 +1,40 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
// *******************************************************************
// - [#] indicates a test step (e.g. # Go to a screen)
// - [*] indicates an assertion (e.g. * Check the title)
// - Use element testID when selecting an element. Create one if none.
// *******************************************************************
import {
ChannelScreen,
RecentMentionsScreen,
} from '@support/ui/screen';
import {Setup} from '@support/server_api';
describe('Recent Mentions', () => {
beforeAll(async () => {
const {user} = await Setup.apiInit();
// # Open channel screen
await ChannelScreen.open(user);
});
afterAll(async () => {
await ChannelScreen.logout();
});
it('MM-T3372 should be able display empty recent mentions', async () => {
// # Open recent mentions screen
await ChannelScreen.openSettingsSidebar();
await RecentMentionsScreen.open();
// * Verify empty recent mentions
await expect(element(by.text('No Mentions yet'))).toBeVisible();
await expect(element(by.text('Messages where someone mentions you or includes your trigger words are saved here.'))).toBeVisible();
// # Go back to channel
await RecentMentionsScreen.close();
});
});