mattermost-mobile/detox/e2e/support/ui/screen/search.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

45 lines
1.3 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {ChannelScreen} from '@support/ui/screen';
import {isAndroid} from '@support/utils';
class SearchScreen {
testID = {
searchScreen: 'search.screen',
searchInput: 'searchInput',
searchFromSection: 'search_from.section',
searchInSection: 'search_in.section',
searchOnSection: 'search_on.section',
}
searchScreen = element(by.id(this.testID.searchScreen));
searchInput = element(by.id(this.testID.searchInput));
searchFromSection = element(by.id(this.testID.searchFromSection));
searchInSection = element(by.id(this.testID.searchInSection));
searchOnSection = element(by.id(this.testID.searchOnSection));
toBeVisible = async () => {
await expect(this.searchScreen).toBeVisible();
return this.searchScreen;
}
open = async () => {
// # Open search screen
await ChannelScreen.channelSearchButton.tap();
return this.toBeVisible();
}
cancel = async () => {
if (isAndroid()) {
await device.pressBack();
} else {
await element(by.text('Cancel')).atIndex(0).tap();
}
}
}
const searchScreen = new SearchScreen();
export default searchScreen;