mattermost-mobile/detox/e2e/test/autocomplete/search.e2e.js
Joseph Baylon 4f668f0fdf
MM-30286 Detox/E2E: Add e2e test for MM-T3222 and some cleanup (#4959)
* MM-30286 Detox/E2E: Add e2e test for MM-T3222 and some cleanup

* Fix merge issues

* Fix more issues

* Fixed new line

* Remove redundant check

* Updated instance to getElement

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-17 10:52:03 -08:00

67 lines
2.1 KiB
JavaScript

// 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 {Autocomplete} from '@support/ui/component';
import {ChannelScreen, SearchScreen} from '@support/ui/screen';
import {Setup} from '@support/server_api';
describe('Autocomplete', () => {
const {
atMentionSuggestionList,
channelMentionSuggestionList,
dateSuggestion,
} = Autocomplete;
beforeAll(async () => {
const {user} = await Setup.apiInit();
// # Open search screen
await ChannelScreen.open(user);
await SearchScreen.open();
});
beforeEach(async () => {
await SearchScreen.searchInput.atIndex(0).clearText();
});
afterAll(async () => {
await device.reloadReactNative();
await ChannelScreen.logout();
});
it('MM-T3393_1 should render at_mention component', async () => {
await expect(atMentionSuggestionList).not.toExist();
// # Tap "from:" modifier
await SearchScreen.searchFromSection.tap();
// * Expect at mention to render
await expect(atMentionSuggestionList).toExist();
});
it('MM-T3393_2 should render channel_mention component', async () => {
await expect(channelMentionSuggestionList).not.toExist();
// # Tap "in:" modifier
await SearchScreen.searchInSection.tap();
// * Expect channel mention to render
await expect(channelMentionSuggestionList).toExist();
});
it('MM-T3393_3 should render date_suggestion component', async () => {
await expect(dateSuggestion).not.toExist();
// # Tap "on:" modifier
await SearchScreen.searchOnSection.tap();
// * Expect date suggestion to render
await expect(dateSuggestion).toExist();
});
});