* 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> Co-authored-by: Joseph Baylon <joseph.baylon@mattermost.com> Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>
This commit is contained in:
parent
f23190cf29
commit
abab4855d2
24 changed files with 166 additions and 25 deletions
|
|
@ -186,6 +186,7 @@ export function goToScreen(name, title, passProps = {}, options = {}) {
|
|||
backButton: {
|
||||
color: theme.sidebarHeaderTextColor,
|
||||
title: '',
|
||||
testID: 'screen.back.button',
|
||||
},
|
||||
background: {
|
||||
color: theme.sidebarHeaderBg,
|
||||
|
|
|
|||
|
|
@ -188,6 +188,7 @@ describe('@actions/navigation', () => {
|
|||
backButton: {
|
||||
color: theme.sidebarHeaderTextColor,
|
||||
title: '',
|
||||
testID: 'screen.back.button',
|
||||
},
|
||||
background: {
|
||||
color: theme.sidebarHeaderBg,
|
||||
|
|
@ -494,4 +495,4 @@ describe('@actions/navigation', () => {
|
|||
expect(popToRoot).toHaveBeenCalledWith(topComponentId);
|
||||
expect(EventEmitter.emit).toHaveBeenCalledWith(NavigationTypes.NAVIGATION_DISMISS_AND_POP_TO_ROOT);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ export default class ChannelIcon extends React.PureComponent {
|
|||
<CompassIcon
|
||||
name='archive-outline'
|
||||
style={[style.icon, unreadIcon, activeIcon, {fontSize: size}]}
|
||||
testID='channel_icon.archive'
|
||||
/>
|
||||
);
|
||||
} else if (isBot) {
|
||||
|
|
@ -91,6 +92,7 @@ export default class ChannelIcon extends React.PureComponent {
|
|||
<CompassIcon
|
||||
name='robot-happy'
|
||||
style={[style.icon, unreadIcon, activeIcon, {fontSize: size, left: -1.5, top: -1}]}
|
||||
testID='channel_icon.bot'
|
||||
/>
|
||||
);
|
||||
} else if (hasDraft) {
|
||||
|
|
@ -98,6 +100,7 @@ export default class ChannelIcon extends React.PureComponent {
|
|||
<CompassIcon
|
||||
name='pencil-outline'
|
||||
style={[style.icon, unreadIcon, activeIcon, {fontSize: size}]}
|
||||
testID='channel_icon.draft'
|
||||
/>
|
||||
);
|
||||
} else if (type === General.OPEN_CHANNEL) {
|
||||
|
|
@ -105,6 +108,7 @@ export default class ChannelIcon extends React.PureComponent {
|
|||
<CompassIcon
|
||||
name='globe'
|
||||
style={[style.icon, unreadIcon, activeIcon, {fontSize: size}]}
|
||||
testID='channel_icon.public'
|
||||
/>
|
||||
);
|
||||
} else if (type === General.PRIVATE_CHANNEL) {
|
||||
|
|
@ -112,12 +116,17 @@ export default class ChannelIcon extends React.PureComponent {
|
|||
<CompassIcon
|
||||
name='lock-outline'
|
||||
style={[style.icon, unreadIcon, activeIcon, {fontSize: size, left: 0.5}]}
|
||||
testID='channel_icon.private'
|
||||
/>
|
||||
);
|
||||
} else if (type === General.GM_CHANNEL) {
|
||||
const fontSize = (size - 10);
|
||||
icon = (
|
||||
<View style={[style.groupBox, unreadGroupBox, activeGroupBox, {width: size + 1, height: size + 1}]}>
|
||||
<Text style={[style.group, unreadGroup, activeGroup, {fontSize: (size - 4)}]}>
|
||||
<View style={[style.groupBox, unreadGroupBox, activeGroupBox, {width: size, height: size}]}>
|
||||
<Text
|
||||
style={[style.group, unreadGroup, activeGroup, {fontSize}]}
|
||||
testID='channel_icon.gm_member_count'
|
||||
>
|
||||
{membersCount}
|
||||
</Text>
|
||||
</View>
|
||||
|
|
@ -129,6 +138,7 @@ export default class ChannelIcon extends React.PureComponent {
|
|||
<CompassIcon
|
||||
name='clock'
|
||||
style={[style.icon, unreadIcon, activeIcon, {fontSize: size, color: theme.awayIndicator}]}
|
||||
testID='channel_icon.away'
|
||||
/>
|
||||
);
|
||||
break;
|
||||
|
|
@ -137,6 +147,7 @@ export default class ChannelIcon extends React.PureComponent {
|
|||
<CompassIcon
|
||||
name='minus-circle'
|
||||
style={[style.icon, unreadIcon, activeIcon, {fontSize: size, color: theme.dndIndicator}]}
|
||||
testID='channel_icon.dnd'
|
||||
/>
|
||||
);
|
||||
break;
|
||||
|
|
@ -145,6 +156,7 @@ export default class ChannelIcon extends React.PureComponent {
|
|||
<CompassIcon
|
||||
name='check-circle'
|
||||
style={[style.icon, unreadIcon, activeIcon, {fontSize: size, color: theme.onlineIndicator}]}
|
||||
testID='channel_icon.online'
|
||||
/>
|
||||
);
|
||||
break;
|
||||
|
|
@ -153,6 +165,7 @@ export default class ChannelIcon extends React.PureComponent {
|
|||
<CompassIcon
|
||||
name='circle-outline'
|
||||
style={[style.icon, unreadIcon, activeIcon, {fontSize: size, color: offlineColor}]}
|
||||
testID='channel_icon.offline'
|
||||
/>
|
||||
);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ export default class CustomListRow extends React.PureComponent {
|
|||
children: CustomPropTypes.Children,
|
||||
item: PropTypes.object,
|
||||
isLandscape: PropTypes.bool.isRequired,
|
||||
testID: PropTypes.string,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
|
|
@ -35,6 +36,7 @@ export default class CustomListRow extends React.PureComponent {
|
|||
touchable={Boolean(this.props.enabled && this.props.onPress)}
|
||||
onPress={this.props.onPress}
|
||||
style={style.touchable}
|
||||
testID={this.props.testID}
|
||||
>
|
||||
<View style={[style.container, padding(this.props.isLandscape)]}>
|
||||
{this.props.selectable &&
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ export default class CustomList extends PureComponent {
|
|||
theme: PropTypes.object.isRequired,
|
||||
shouldRenderSeparator: PropTypes.bool,
|
||||
isLandscape: PropTypes.bool.isRequired,
|
||||
testID: PropTypes.string,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
|
|
@ -148,6 +149,7 @@ export default class CustomList extends PureComponent {
|
|||
scrollEventThrottle={60}
|
||||
style={style.list}
|
||||
stickySectionHeadersEnabled={true}
|
||||
testID={this.props.testID}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
@ -201,6 +203,7 @@ export default class CustomList extends PureComponent {
|
|||
sections={data}
|
||||
style={style.list}
|
||||
stickySectionHeadersEnabled={false}
|
||||
testID={this.props.testID}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ export default class UserListRow extends React.PureComponent {
|
|||
theme: PropTypes.object.isRequired,
|
||||
user: PropTypes.object.isRequired,
|
||||
teammateNameDisplay: PropTypes.string.isRequired,
|
||||
testID: PropTypes.string,
|
||||
...CustomListRow.propTypes,
|
||||
};
|
||||
|
||||
|
|
@ -73,6 +74,7 @@ export default class UserListRow extends React.PureComponent {
|
|||
selectable={selectable}
|
||||
selected={selected}
|
||||
isLandscape={isLandscape}
|
||||
testID={this.props.testID}
|
||||
>
|
||||
<View style={style.profileContainer}>
|
||||
<ProfilePicture
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export default class KeyboardLayout extends PureComponent {
|
|||
static propTypes = {
|
||||
children: PropTypes.node,
|
||||
style: CustomPropTypes.Style,
|
||||
testID: PropTypes.string,
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
|
|
@ -60,7 +61,10 @@ export default class KeyboardLayout extends PureComponent {
|
|||
}
|
||||
|
||||
return (
|
||||
<View style={layoutStyle}>
|
||||
<View
|
||||
style={layoutStyle}
|
||||
testID={this.props.testID}
|
||||
>
|
||||
{this.props.children}
|
||||
</View>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ export default class PostBody extends PureComponent {
|
|||
shouldRenderJumboEmoji: PropTypes.bool.isRequired,
|
||||
theme: PropTypes.object,
|
||||
location: PropTypes.string,
|
||||
mentionKeys: PropTypes.array.isRequired,
|
||||
mentionKeys: PropTypes.array,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
|
|
@ -80,6 +80,7 @@ export default class PostBody extends PureComponent {
|
|||
onFailedPostPress: emptyFunction,
|
||||
onPress: emptyFunction,
|
||||
replyBarStyle: [],
|
||||
mentionKeys: [],
|
||||
message: '',
|
||||
postProps: {},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -327,11 +327,7 @@ export default class List extends PureComponent {
|
|||
renderSectionHeader = ({section}) => {
|
||||
const {styles, isLandscape} = this.props;
|
||||
const {intl} = this.context;
|
||||
const {
|
||||
action,
|
||||
defaultMessage,
|
||||
id,
|
||||
} = section;
|
||||
const {action, defaultMessage, id} = section;
|
||||
|
||||
const anchor = (id === 'sidebar.types.recent' || id === 'mobile.channel_list.channels');
|
||||
|
||||
|
|
|
|||
|
|
@ -253,6 +253,7 @@ export default class SettingsSidebarBase extends PureComponent {
|
|||
isDestructor={true}
|
||||
onPress={this.logout}
|
||||
separator={false}
|
||||
testID='sidebar.settings.logout'
|
||||
theme={theme}
|
||||
/>
|
||||
</View>
|
||||
|
|
|
|||
|
|
@ -271,6 +271,7 @@ export default class SlideUpPanel extends PureComponent {
|
|||
<Animated.View
|
||||
style={[styles.backdrop, backdropStyle]}
|
||||
pointerEvents='box-only'
|
||||
testID='slide_up_panel'
|
||||
/>
|
||||
</PanGestureHandler>
|
||||
</Animated.View>
|
||||
|
|
|
|||
|
|
@ -184,6 +184,7 @@ export default class ChannelBase extends PureComponent {
|
|||
leftButtons: [{
|
||||
id: 'close-info',
|
||||
icon: source,
|
||||
testID: 'screen.channel_info.close',
|
||||
}],
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ exports[`SettingDrawerButton should match, full snapshot 1`] = `
|
|||
"width": 44,
|
||||
}
|
||||
}
|
||||
testID="sidebar.settings.button"
|
||||
>
|
||||
<View
|
||||
style={
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ export class SettingDrawerButton extends PureComponent {
|
|||
accessibilityHint={accessibilityHint}
|
||||
accessibilityLabel={accessibilityLabel}
|
||||
accessibilityRole='button'
|
||||
testID='sidebar.settings.button'
|
||||
onPress={this.handlePress}
|
||||
style={style.container}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ exports[`channel_info_header should match snapshot 1`] = `
|
|||
isBot={false}
|
||||
isInfo={true}
|
||||
isUnread={false}
|
||||
membersCount={2}
|
||||
membersCount={3}
|
||||
size={24}
|
||||
status="status"
|
||||
theme={
|
||||
|
|
@ -343,7 +343,7 @@ exports[`channel_info_header should match snapshot when DM and hasGuests and is
|
|||
isBot={false}
|
||||
isInfo={true}
|
||||
isUnread={false}
|
||||
membersCount={2}
|
||||
membersCount={3}
|
||||
size={24}
|
||||
status="status"
|
||||
theme={
|
||||
|
|
@ -684,7 +684,7 @@ exports[`channel_info_header should match snapshot when DM and hasGuests but its
|
|||
isBot={false}
|
||||
isInfo={true}
|
||||
isUnread={false}
|
||||
membersCount={2}
|
||||
membersCount={3}
|
||||
size={24}
|
||||
status="status"
|
||||
theme={
|
||||
|
|
@ -994,7 +994,7 @@ exports[`channel_info_header should match snapshot when GM and hasGuests 1`] = `
|
|||
isBot={false}
|
||||
isInfo={true}
|
||||
isUnread={false}
|
||||
membersCount={2}
|
||||
membersCount={3}
|
||||
size={24}
|
||||
status="status"
|
||||
theme={
|
||||
|
|
@ -1335,7 +1335,7 @@ exports[`channel_info_header should match snapshot when is group constrained 1`]
|
|||
isBot={false}
|
||||
isInfo={true}
|
||||
isUnread={false}
|
||||
membersCount={2}
|
||||
membersCount={3}
|
||||
size={24}
|
||||
status="status"
|
||||
theme={
|
||||
|
|
@ -1667,7 +1667,7 @@ exports[`channel_info_header should match snapshot when public channel and hasGu
|
|||
isBot={false}
|
||||
isInfo={true}
|
||||
isUnread={false}
|
||||
membersCount={2}
|
||||
membersCount={3}
|
||||
size={24}
|
||||
status="status"
|
||||
theme={
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ export default class ChannelInfoHeader extends React.PureComponent {
|
|||
<View style={[style.channelNameContainer, style.row, padding(isLandscape)]}>
|
||||
<ChannelIcon
|
||||
isInfo={true}
|
||||
membersCount={memberCount - 1}
|
||||
membersCount={memberCount}
|
||||
size={24}
|
||||
status={status}
|
||||
theme={theme}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ function mapStateToProps(state) {
|
|||
const teammateNameDisplay = getTeammateNameDisplaySetting(state);
|
||||
const currentChannelCreatorName = displayUsername(currentChannelCreator, teammateNameDisplay);
|
||||
const currentChannelStats = getCurrentChannelStats(state);
|
||||
const currentChannelMemberCount = currentChannelStats && currentChannelStats.member_count;
|
||||
let currentChannelMemberCount = currentChannelStats && currentChannelStats.member_count;
|
||||
let currentChannelGuestCount = (currentChannelStats && currentChannelStats.guest_count) || 0;
|
||||
const currentUserId = getCurrentUserId(state);
|
||||
|
||||
|
|
@ -46,6 +46,10 @@ function mapStateToProps(state) {
|
|||
}
|
||||
}
|
||||
|
||||
if (currentChannel.type === General.GM_CHANNEL) {
|
||||
currentChannelMemberCount = currentChannel.display_name.split(',').length;
|
||||
}
|
||||
|
||||
return {
|
||||
currentChannel,
|
||||
currentChannelCreatorName,
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ export default class EditPost extends PureComponent {
|
|||
|
||||
leftButton = {
|
||||
id: 'close-edit-post',
|
||||
testID: 'edit_post.close',
|
||||
};
|
||||
|
||||
rightButton = {
|
||||
|
|
|
|||
|
|
@ -350,6 +350,7 @@ export default class MoreDirectMessages extends PureComponent {
|
|||
text: formatMessage({id: 'mobile.more_dms.start', defaultMessage: 'Start'}),
|
||||
showAsAction: 'always',
|
||||
enabled: startEnabled,
|
||||
testID: START_BUTTON,
|
||||
}],
|
||||
});
|
||||
};
|
||||
|
|
@ -365,6 +366,7 @@ export default class MoreDirectMessages extends PureComponent {
|
|||
selectable={true}
|
||||
selected={selected}
|
||||
enabled={true}
|
||||
testID='more_dms.user'
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
@ -475,7 +477,7 @@ export default class MoreDirectMessages extends PureComponent {
|
|||
}
|
||||
|
||||
return (
|
||||
<KeyboardLayout>
|
||||
<KeyboardLayout testID='direct_channels_screen'>
|
||||
<StatusBar/>
|
||||
<View style={style.searchBar}>
|
||||
<View style={padding(isLandscape)}>
|
||||
|
|
@ -517,6 +519,7 @@ export default class MoreDirectMessages extends PureComponent {
|
|||
onLoadMore={this.getProfiles}
|
||||
onRowPress={this.handleSelectProfile}
|
||||
renderItem={this.renderItem}
|
||||
testID='more_dms.list'
|
||||
theme={theme}
|
||||
/>
|
||||
</KeyboardLayout>
|
||||
|
|
|
|||
|
|
@ -54,3 +54,9 @@ 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();
|
||||
}
|
||||
|
|
|
|||
54
detox/e2e/test/channel_info/header.e2e.js
Normal file
54
detox/e2e/test/channel_info/header.e2e.js
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
// *******************************************************************
|
||||
// - [#] indicates a test step (e.g. # Go to a screen)
|
||||
// - [*] indicates an assertion (e.g. * Check the title)
|
||||
// - Use element testID when selecting an element. Create one if none.
|
||||
// *******************************************************************
|
||||
|
||||
import {logoutUser, toChannelScreen} from '@support/ui/screen';
|
||||
import {timeouts, wait} from '@support/utils';
|
||||
|
||||
import {Setup} from '@support/server_api';
|
||||
|
||||
describe('Channel Info Header', () => {
|
||||
beforeAll(async () => {
|
||||
const {user} = await Setup.apiInit();
|
||||
await toChannelScreen(user);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await logoutUser();
|
||||
});
|
||||
|
||||
it('MM-T3406 should render correct GM member count in channel info header', async () => {
|
||||
// # Open drawer
|
||||
await element(by.id('channel_drawer.button')).tap();
|
||||
await expect(element(by.text('DIRECT MESSAGES'))).toBeVisible();
|
||||
|
||||
// # Open Direct Channels screen
|
||||
await element(by.id('action_button_sidebar.direct')).tap();
|
||||
await expect(element(by.id('direct_channels_screen'))).toBeVisible();
|
||||
|
||||
// # Wait for some profiles to load
|
||||
await wait(timeouts.ONE_SEC);
|
||||
|
||||
// # Select 3 profiles
|
||||
await element(by.id('more_dms.user').withAncestor(by.id('more_dms.list'))).atIndex(0).tap();
|
||||
await element(by.id('more_dms.user').withAncestor(by.id('more_dms.list'))).atIndex(1).tap();
|
||||
await element(by.id('more_dms.user').withAncestor(by.id('more_dms.list'))).atIndex(2).tap();
|
||||
|
||||
// # Create a GM with selected profiles
|
||||
await element(by.id('start-conversation')).tap();
|
||||
|
||||
// # Open channel info modal
|
||||
await element(by.id('channel.title.button')).tap();
|
||||
|
||||
// * Verify GM member count is 3
|
||||
await expect(element(by.id('channel_icon.gm_member_count')).atIndex(0)).toHaveText('3');
|
||||
|
||||
// # Close channel info screen
|
||||
await element(by.id('screen.channel_info.close')).tap();
|
||||
});
|
||||
});
|
||||
|
|
@ -1,7 +1,13 @@
|
|||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {toChannelScreen} from '@support/ui/screen';
|
||||
// *******************************************************************
|
||||
// - [#] indicates a test step (e.g. # Go to a screen)
|
||||
// - [*] indicates an assertion (e.g. * Check the title)
|
||||
// - Use element testID when selecting an element. Create one if none.
|
||||
// *******************************************************************
|
||||
|
||||
import {logoutUser, toChannelScreen} from '@support/ui/screen';
|
||||
|
||||
import {Setup} from '@support/server_api';
|
||||
|
||||
|
|
@ -12,6 +18,10 @@ describe('Messaging', () => {
|
|||
await toChannelScreen(user);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await logoutUser();
|
||||
});
|
||||
|
||||
it('should post a message on tap to paper send button', async () => {
|
||||
await expect(element(by.id('channel_screen'))).toBeVisible();
|
||||
await expect(element(by.id('post_input'))).toExist();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import nodeExpect from 'expect';
|
||||
|
||||
import {toChannelScreen} from '@support/ui/screen';
|
||||
import {logoutUser, toChannelScreen} from '@support/ui/screen';
|
||||
import {Channel, Post, Setup} from '@support/server_api';
|
||||
|
||||
describe('Messaging', () => {
|
||||
|
|
@ -16,6 +16,10 @@ describe('Messaging', () => {
|
|||
await toChannelScreen(user);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await logoutUser();
|
||||
});
|
||||
|
||||
it('MM-T109 User can\'t send the same message repeatedly', async () => {
|
||||
const message = Date.now().toString();
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import {Setup} from '@support/server_api';
|
||||
import {serverUrl} from '@support/test_config';
|
||||
import {fulfillSelectServerScreen} from '@support/ui/screen';
|
||||
import {fulfillSelectServerScreen, logoutUser} from '@support/ui/screen';
|
||||
import {isAndroid, timeouts, wait} from '@support/utils';
|
||||
|
||||
describe('On boarding', () => {
|
||||
|
|
@ -17,6 +17,10 @@ describe('On boarding', () => {
|
|||
await device.reloadReactNative();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await logoutUser();
|
||||
});
|
||||
|
||||
it('should show Select server screen on initial load', async () => {
|
||||
// Verify basic elements on Select Server screen
|
||||
await expect(element(by.id('select_server_screen'))).toBeVisible();
|
||||
|
|
@ -24,11 +28,38 @@ describe('On boarding', () => {
|
|||
await expect(element(by.id('connect_button'))).toBeVisible();
|
||||
});
|
||||
|
||||
it('MM-T3383 should show error on empty server URL', async () => {
|
||||
await expect(element(by.id('select_server_screen'))).toBeVisible();
|
||||
|
||||
// # Enter an empty server URL
|
||||
await element(by.id('server_url_input')).typeText(' ');
|
||||
|
||||
// # Tap anywhere to hide keyboard
|
||||
await element(by.text('Enter Server URL')).tap();
|
||||
|
||||
// * Verify that the error message does not exist
|
||||
await waitFor(element(by.id('error_text'))).not.toExist().withTimeout(timeouts.HALF_SEC);
|
||||
|
||||
// # Tap connect button
|
||||
await element(by.id('connect_button')).tap();
|
||||
|
||||
// # Explicitly wait on Android before verifying error message
|
||||
if (isAndroid()) {
|
||||
await wait(timeouts.ONE_SEC);
|
||||
}
|
||||
|
||||
// * Verify error message
|
||||
await waitFor(element(by.id('error_text'))).toBeVisible().withTimeout(timeouts.ONE_SEC);
|
||||
await expect(element(by.id('error_text'))).toHaveText('Please enter a valid server URL');
|
||||
});
|
||||
|
||||
it('should show error on invalid server URL', async () => {
|
||||
await expect(element(by.id('select_server_screen'))).toBeVisible();
|
||||
|
||||
// Enter invalid server URL
|
||||
await element(by.id('server_url_input')).typeText('http://invalid:8065');
|
||||
const input = element(by.id('server_url_input'));
|
||||
await input.clearText();
|
||||
await input.typeText('http://invalid:8065');
|
||||
|
||||
// Tap anywhere to hide keyboard
|
||||
await element(by.text('Enter Server URL')).tap();
|
||||
|
|
@ -41,11 +72,11 @@ describe('On boarding', () => {
|
|||
|
||||
// Explicitly wait on Android before verifying error message
|
||||
if (isAndroid()) {
|
||||
await wait(timeouts.ONE_MIN);
|
||||
await wait(timeouts.TWO_SEC);
|
||||
}
|
||||
|
||||
// Verify error message
|
||||
await waitFor(element(by.id('error_text'))).toBeVisible().withTimeout(timeouts.ONE_MIN);
|
||||
await waitFor(element(by.id('error_text'))).toBeVisible().withTimeout(timeouts.ONE_SEC);
|
||||
await expect(element(by.id('error_text'))).toHaveText('Cannot connect to the server. Please check your server URL and internet connection.');
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue