* 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
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {Alert} from '@support/ui/component';
|
|
import {HomeScreen} from '@support/ui/screen';
|
|
import {timeouts} from '@support/utils';
|
|
import {expect} from 'detox';
|
|
|
|
class AccountScreen {
|
|
testID = {
|
|
accountScreen: 'account.screen',
|
|
logoutAction: 'account.logout.action',
|
|
};
|
|
|
|
accountScreen = element(by.id(this.testID.accountScreen));
|
|
logoutAction = element(by.id(this.testID.logoutAction));
|
|
|
|
toBeVisible = async () => {
|
|
await waitFor(this.accountScreen).toExist().withTimeout(timeouts.TEN_SEC);
|
|
|
|
return this.accountScreen;
|
|
};
|
|
|
|
open = async () => {
|
|
// # Open account screen
|
|
await HomeScreen.accountTab.tap();
|
|
|
|
return this.toBeVisible();
|
|
};
|
|
|
|
logout = async (serverDisplayName: string | null = null) => {
|
|
await this.logoutAction.tap();
|
|
if (serverDisplayName) {
|
|
await expect(Alert.logoutTitle(serverDisplayName)).toBeVisible();
|
|
}
|
|
await Alert.logoutButton.tap();
|
|
await expect(this.accountScreen).not.toBeVisible();
|
|
};
|
|
}
|
|
|
|
const accountScreen = new AccountScreen();
|
|
export default accountScreen;
|