mattermost-mobile/detox/e2e/support/ui/screen/home.ts
Joseph Baylon 1d9c371bfb
Detox/E2E: Migrate e2e javascript to typescript (#6059)
* Detox/E2E: Migrate to typescript

* Add jest.config.js

* Add moduleMapper to config.json

* Add cookie jar to axios client, fix tsconfig.json and default_config.json

* Take keyboard into consideration; clean test for now for this migration PR

* Revert changes on path_builder

* Attempt to fix dep issues

* Update detox dep

* Added missing @type dev dependencies

* Fix dep order

* Fix unit tests

* Added dynamic year to email.ts
2022-03-17 17:35:26 -07:00

45 lines
1.3 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {
AccountScreen,
LoginScreen,
} from '@support/ui/screen';
import {timeouts} from '@support/utils';
import {expect} from 'detox';
class HomeScreen {
testID = {
channelListTab: 'tab_bar.channel_list.tab',
searchTab: 'tab_bar.search.tab',
mentionsTab: 'tab_bar.mentions.tab',
accountTab: 'tab_bar.account.tab',
};
channelListTab = element(by.id(this.testID.channelListTab));
searchTab = element(by.id(this.testID.searchTab));
mentionsTab = element(by.id(this.testID.mentionsTab));
accountTab = element(by.id(this.testID.accountTab));
toBeVisible = async () => {
await waitFor(this.channelListTab).toBeVisible().withTimeout(timeouts.TEN_SEC);
return this.channelListTab;
};
open = async (user = {}) => {
// # Open home screen
await LoginScreen.login(user);
return this.toBeVisible();
};
logout = async (serverDisplayName: string | null = null) => {
await AccountScreen.open();
await AccountScreen.logout(serverDisplayName);
await expect(this.channelListTab).not.toBeVisible();
};
}
const homeScreen = new HomeScreen();
export default homeScreen;