mattermost-mobile/detox/e2e/support/ui/screen.js
Elias Nahum fbe2a9e575
MM-28539 Fix wrong participant count in GM info (#4887)
* Fix e2e flaky tests

* MM-28539 Fix wrong participant count in GM info

* Apply suggestions from code review

Co-authored-by: Joseph Baylon <joseph.baylon@mattermost.com>

* Apply suggestions from code review

Co-authored-by: Joseph Baylon <joseph.baylon@mattermost.com>
Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>

* Update detox/e2e/test/autocomplete/edit_post.e2e.js

Co-authored-by: Joseph Baylon <joseph.baylon@mattermost.com>

Co-authored-by: Joseph Baylon <joseph.baylon@mattermost.com>
Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>
2020-10-19 10:13:30 -03:00

62 lines
2.1 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.id('login_screen')).tap({x: 10, y: 10});
await element(by.id('password_input')).replaceText(user.password);
// # Tap anywhere to hide keyboard
await element(by.id('login_screen')).tap({x: 10, y: 10});
await element(by.id('signin_button')).tap();
}
// ****************************************************************
// Channel Screen
// ****************************************************************
export async function toChannelScreen(user) {
await fulfillSelectServerScreen(serverUrl);
await fulfillLoginScreen(user);
}
export async function logoutUser() {
await element(by.id('sidebar.settings.button')).tap();
await element(by.text('Logout')).tap();
await waitFor(element(by.id('select_server_screen'))).toBeVisible();
}