mattermost-mobile/detox/e2e/support/ui/screen.js
Saturnino Abril f05faaa949
E2E: Initial Detox setup for Mobile UI automation (#4535)
* initial Detox setup for mobile UI automation

* fix iOS allow permission on opening the app, add npm script to root folder, fix test when using longer site URL and add detox dependency to root for android build dependency

* remove detox proguardFile

* update packages and emulator

* change folder build on local and CI

* add test to post a message, ability to have test in isolation, server API commands, server config, dependency updates and update folder structure

* update snapshot

* update detox and do clean up

* update dependencies
2020-08-29 07:18:41 +08:00

56 lines
1.9 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {serverUrl} from '../test_config';
// ****************************************************************
// Select Server Screen
// ****************************************************************
/**
* fulfillSelectServerScreen enters server URL on Select Server screen and then tap connect button.
* @param {String} url - server URL
*/
export async function fulfillSelectServerScreen(url) {
await expect(element(by.id('select_server_screen'))).toBeVisible();
await element(by.id('server_url_input')).replaceText(url);
// # Tap anywhere to hide keyboard
await element(by.text('Enter Server URL')).tap();
await element(by.id('connect_button')).tap();
}
// ****************************************************************
// Login Screen
// ****************************************************************
/**
* fulfillLoginScreen enters credential on Login screen and then tap "Sign in" button to log in.
* @param {Object} user - user to login with username and password
*/
export async function fulfillLoginScreen(user = {}) {
await expect(element(by.id('login_screen'))).toBeVisible();
await element(by.id('username_input')).replaceText(user.username);
// # Tap anywhere to hide keyboard
await element(by.text('Mattermost')).tap();
await element(by.id('password_input')).replaceText(user.password);
// # Tap anywhere to hide keyboard
await element(by.text('Mattermost')).tap();
await element(by.id('signin_button')).tap();
}
// ****************************************************************
// Channel Screen
// ****************************************************************
export async function toChannelScreen(user) {
await fulfillSelectServerScreen(serverUrl);
await fulfillLoginScreen(user);
}