Detox/E2E: Channel List, Browse Channels, Create Direct Message e2e tests in Gekidou (#6114)

* Detox/E2E: Channel List, Browse Channels, Create Direct Message e2e tests in Gekidou

* Fix create_direct_message

* Fix channel_list snapshot test

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
Joseph Baylon
2022-04-05 13:12:57 -07:00
committed by GitHub
parent 31ed25cd61
commit c85914f4ba
46 changed files with 797 additions and 53 deletions

View File

@@ -91,6 +91,7 @@ exports[`components/channel_list should render channels error 1`] = `
"marginLeft": 4,
}
}
testID="channel_list_header.chevron.button"
>
<Icon
name="chevron-down"
@@ -126,6 +127,7 @@ exports[`components/channel_list should render channels error 1`] = `
"width": 28,
}
}
testID="channel_list_header.plus.button"
>
<Icon
name="plus"
@@ -407,6 +409,7 @@ exports[`components/channel_list should render team error 1`] = `
},
]
}
testID="channel_list.search_field.find_channels.input"
/>
</View>
<View
@@ -422,6 +425,7 @@ exports[`components/channel_list should render team error 1`] = `
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
onStartShouldSetResponderCapture={[Function]}
testID="channel_list.threads.button"
>
<View
accessible={true}

View File

@@ -53,6 +53,7 @@ Object {
"paddingLeft": 2,
}
}
testID="category.test_category.channel_list_item.channel.collapsed.false"
>
<View
style={
@@ -109,6 +110,7 @@ Object {
false,
]
}
testID="category.test_category.channel_list_item.channel.display_name"
>
Channel
</Text>

View File

@@ -42,6 +42,7 @@ const CategoryBody = ({currentChannelId, sortedChannels, category, hiddenChannel
channel={item}
isActive={item.id === currentChannelId}
collapsed={category.collapsed}
testID={`category.${category.displayName.replace(/ /g, '_').toLocaleLowerCase()}.channel_list_item`}
/>
);
}, [currentChannelId, category.collapsed]);

View File

@@ -46,6 +46,7 @@ exports[`components/channel_list/categories/body/channel/item should match snaps
"paddingLeft": 2,
}
}
testID="channel_list_item.hello.collapsed.false"
>
<View
style={
@@ -125,6 +126,7 @@ exports[`components/channel_list/categories/body/channel/item should match snaps
false,
]
}
testID="channel_list_item.hello.display_name"
>
Hello!
</Text>

View File

@@ -37,6 +37,7 @@ describe('components/channel_list/categories/body/channel/item', () => {
isMuted={false}
collapsed={false}
currentUserId={'id'}
testID='channel_list_item'
/>,
);

View File

@@ -66,9 +66,10 @@ type Props = {
myChannel?: MyChannelModel;
collapsed: boolean;
currentUserId: string;
testID?: string;
}
const ChannelListItem = ({channel, isActive, currentUserId, isMuted, myChannel, collapsed}: Props) => {
const ChannelListItem = ({channel, isActive, currentUserId, isMuted, myChannel, collapsed, testID}: Props) => {
const {formatMessage} = useIntl();
const theme = useTheme();
const styles = getStyleSheet(theme);
@@ -124,7 +125,10 @@ const ChannelListItem = ({channel, isActive, currentUserId, isMuted, myChannel,
return (
<Animated.View style={animatedStyle}>
<TouchableOpacity onPress={switchChannels}>
<View style={styles.container}>
<View
style={styles.container}
testID={`${testID}.${channel.name}.collapsed.${collapsed && !isActive}`}
>
<ChannelIcon
isActive={isActive}
isArchived={channel.deleteAt > 0}
@@ -139,6 +143,7 @@ const ChannelListItem = ({channel, isActive, currentUserId, isMuted, myChannel,
ellipsizeMode='tail'
numberOfLines={1}
style={textStyles}
testID={`${testID}.${channel.name}.display_name`}
>
{displayName}
</Text>

View File

@@ -17,6 +17,7 @@ exports[`components/channel_list/categories/header should match snapshot 1`] = `
"opacity": 1,
}
}
testID="category_header.custom.collapsed.false"
>
<View
style={
@@ -69,6 +70,7 @@ exports[`components/channel_list/categories/header should match snapshot 1`] = `
"lineHeight": 16,
}
}
testID="category_header.custom.display_name"
>
TEST CATEGORY
</Text>

View File

@@ -74,14 +74,20 @@ const CategoryHeader = ({category, hasChannels}: Props) => {
}
return (
<TouchableOpacity onPress={toggleCollapse}>
<TouchableOpacity
onPress={toggleCollapse}
testID={`category_header.${category.type}.collapsed.${category.collapsed}`}
>
<View style={styles.container}>
<AnimatedCompassIcon
name={'chevron-down'}
style={[styles.chevron, animatedStyle]}
size={20}
/>
<Text style={styles.heading}>
<Text
style={styles.heading}
testID={`category_header.${category.type}.display_name`}
>
{category.displayName.toUpperCase()}
</Text>
</View>

View File

@@ -71,6 +71,7 @@ exports[`components/channel_list/header Channel List Header Component should mat
"marginLeft": 4,
}
}
testID="channel_list_header.chevron.button"
>
<Icon
name="chevron-down"
@@ -106,6 +107,7 @@ exports[`components/channel_list/header Channel List Header Component should mat
"width": 28,
}
}
testID="channel_list_header.plus.button"
>
<Icon
name="plus"

View File

@@ -122,7 +122,10 @@ const ChannelListHeader = ({canCreateChannels, canJoinChannels, displayName, ico
>
{displayName}
</Text>
<View style={styles.chevronButton}>
<View
style={styles.chevronButton}
testID='channel_list_header.chevron.button'
>
<CompassIcon
style={styles.chevronIcon}
name={'chevron-down'}
@@ -133,6 +136,7 @@ const ChannelListHeader = ({canCreateChannels, canJoinChannels, displayName, ico
<TouchableWithFeedback
onPress={onPress}
style={styles.plusButton}
testID='channel_list_header.plus.button'
type='opacity'
>
<CompassIcon

View File

@@ -19,16 +19,19 @@ const PlusMenuItem = ({pickerAction, onPress}: PlusMenuItemProps) => {
browseChannels: {
icon: 'globe',
text: intl.formatMessage({id: 'plus_menu.browse_channels.title', defaultMessage: 'Browse Channels'}),
testID: 'plus_menu_item.browse_channels',
},
createNewChannel: {
icon: 'plus',
text: intl.formatMessage({id: 'plus_menu.create_new_channel.title', defaultMessage: 'Create New Channel'}),
testID: 'plus_menu_item.create_new_channel',
},
openDirectMessage: {
icon: 'account-outline',
text: intl.formatMessage({id: 'plus_menu.open_direct_message.title', defaultMessage: 'Open a Direct Message'}),
testID: 'plus_menu_item.open_direct_message',
},
};
const itemType = menuItems[pickerAction];
@@ -38,6 +41,7 @@ const PlusMenuItem = ({pickerAction, onPress}: PlusMenuItemProps) => {
text={itemType.text}
icon={itemType.icon}
onPress={onPress}
testID={itemType.testID}
/>
</View>
);

View File

@@ -55,6 +55,7 @@ exports[`Search Field should match snapshot 1`] = `
},
]
}
testID="channel_list.search_field.find_channels.input"
/>
</View>
`;

View File

@@ -60,6 +60,7 @@ const SearchField = () => {
style={[textStyles, styles.input]}
placeholder='Find Channels'
placeholderTextColor={changeOpacity(theme.sidebarText, 0.72)}
testID='channel_list.search_field.find_channels.input'
/>
</View>
);

View File

@@ -14,6 +14,7 @@ exports[`Threads Component should match snapshot 1`] = `
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
onStartShouldSetResponderCapture={[Function]}
testID="channel_list.threads.button"
>
<View
accessible={true}

View File

@@ -41,7 +41,10 @@ const ThreadsButton = () => {
* - Add right-side number badge
*/
return (
<TouchableWithFeedback onPress={() => goToScreen(Screens.CHANNEL, 'Channel', {}, {topBar: {visible: false}})} >
<TouchableWithFeedback
onPress={() => goToScreen(Screens.CHANNEL, 'Channel', {}, {topBar: {visible: false}})}
testID='channel_list.threads.button'
>
<View style={styles.container}>
<CompassIcon
name='message-text-outline'

View File

@@ -149,14 +149,17 @@ export default function UserListRow({
const showTeammateDisplay = teammateDisplay !== username;
const itemTestID = `${testID}.${id}`;
const displayUsernameTestID = `${testID}.display_username`;
const displayNameTestID = `${itemTestID}.display_name`;
const profilePictureTestID = `${itemTestID}.profile_picture`;
return (
<TouchableWithFeedback
onPress={handlePress}
>
<View style={style.container}>
<View
style={style.container}
testID={itemTestID}
>
<View style={style.profileContainer}>
<ProfilePicture
author={user}
@@ -165,17 +168,14 @@ export default function UserListRow({
testID={profilePictureTestID}
/>
</View>
<View
style={style.textContainer}
testID={itemTestID}
>
<View style={style.textContainer}>
<View>
<View style={style.indicatorContainer}>
<Text
style={style.username}
ellipsizeMode='tail'
numberOfLines={1}
testID={displayUsernameTestID}
testID={displayNameTestID}
>
{usernameDisplay}
</Text>

View File

@@ -125,7 +125,7 @@ export default function ChannelList({
<FlatList
data={channels}
renderItem={renderItem}
testID='browse_channels.flat_list'
testID='browse_channels.channel_list.flat_list'
ListEmptyComponent={loading ? renderLoading : renderNoResults}
onEndReached={onEndReached}
ListFooterComponent={loading && channels.length ? renderLoading : null}

View File

@@ -72,8 +72,8 @@ export default function ChannelListRow({
);
}
const itemTestID = `${testID}.${channel.id}`;
const channelDisplayNameTestID = `${testID}.display_name`;
const itemTestID = `${testID}.${channel.name}`;
const channelDisplayNameTestID = `${itemTestID}.display_name`;
let icon = 'globe';
if (channel.delete_at) {
icon = 'archive-outline';

View File

@@ -117,6 +117,7 @@ const Channel = ({channelId, componentId, displayName, isOwnDirectMessage, membe
style={styles.flex}
mode='margin'
edges={edges}
testID='channel.screen'
>
<NavigationHeader
isLargeTitle={false}

View File

@@ -128,7 +128,10 @@ const DirectChannel = ({channel, currentUserId, isBot, members, theme}: Props) =
{profiles}
</View>
<View style={{flexDirection: 'row'}}>
<Text style={[styles.title, channel.type === General.GM_CHANNEL ? styles.titleGroup : undefined]}>
<Text
style={[styles.title, channel.type === General.GM_CHANNEL ? styles.titleGroup : undefined]}
testID='channel_post_list.intro.display_name'
>
{channel.displayName}
</Text>
{isBot &&

View File

@@ -55,6 +55,7 @@ const IntroOptions = ({channelId, header, favorite, people, theme}: Props) => {
iconName='account-plus-outline'
label={formatMessage({id: 'intro.add_people', defaultMessage: 'Add People'})}
onPress={onAddPeople}
testID='channel_post_list.intro.option_item.add_people'
theme={theme}
/>
}
@@ -64,6 +65,7 @@ const IntroOptions = ({channelId, header, favorite, people, theme}: Props) => {
iconName='pencil-outline'
label={formatMessage({id: 'intro.set_header', defaultMessage: 'Set Header'})}
onPress={onSetHeader}
testID='channel_post_list.intro.option_item.set_header'
theme={theme}
/>
}
@@ -77,6 +79,7 @@ const IntroOptions = ({channelId, header, favorite, people, theme}: Props) => {
iconName='information-outline'
label={formatMessage({id: 'intro.channel_details', defaultMessage: 'Details'})}
onPress={onDetails}
testID='channel_post_list.intro.option_item.channel_details'
theme={theme}
/>
</View>

View File

@@ -14,6 +14,7 @@ type Props = {
iconName: string;
label: string;
onPress: () => void;
testID?: string;
theme: Theme;
}
@@ -40,7 +41,7 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({
},
}));
const IntroItem = ({applyMargin, color, iconName, label, onPress, theme}: Props) => {
const IntroItem = ({applyMargin, color, iconName, label, onPress, testID, theme}: Props) => {
const styles = getStyleSheet(theme);
const pressedStyle = useCallback(({pressed}: PressableStateCallbackType) => {
const style = [styles.container];
@@ -59,6 +60,7 @@ const IntroItem = ({applyMargin, color, iconName, label, onPress, theme}: Props)
<Pressable
onPress={onPress}
style={pressedStyle}
testID={testID}
>
{({pressed}) => (
<>
@@ -67,7 +69,10 @@ const IntroItem = ({applyMargin, color, iconName, label, onPress, theme}: Props)
color={pressed ? theme.linkColor : color || changeOpacity(theme.centerChannelColor, 0.56)}
size={24}
/>
<Text style={[styles.label, {color: pressed ? theme.linkColor : color || changeOpacity(theme.centerChannelColor, 0.56)}]}>
<Text
style={[styles.label, {color: pressed ? theme.linkColor : color || changeOpacity(theme.centerChannelColor, 0.56)}]}
testID={`${testID}.label`}
>
{label}
</Text>
</>

View File

@@ -116,7 +116,10 @@ const PublicOrPrivateChannel = ({channel, creator, roles, theme}: Props) => {
return (
<View style={styles.container}>
{illustration}
<Text style={styles.title}>
<Text
style={styles.title}
testID='channel_post_list.intro.display_name'
>
{channel.displayName}
</Text>
<View style={{flexDirection: 'row'}}>

View File

@@ -46,7 +46,10 @@ const TownSquare = ({channelId, displayName, roles, theme}: Props) => {
return (
<View style={styles.container}>
<TownSquareIllustration theme={theme}/>
<Text style={styles.title}>
<Text
style={styles.title}
testID='channel_post_list.intro.display_name'
>
{displayName}
</Text>
<FormattedText

View File

@@ -288,7 +288,7 @@ export default function CreateDirectMessage({
leftButtons: [{
id: CLOSE_BUTTON,
icon: closeIcon,
testID: 'close.more_direct_messages.button',
testID: 'close.create_direct_message.button',
}],
rightButtons: [{
color: theme.sidebarHeaderTextColor,
@@ -296,7 +296,7 @@ export default function CreateDirectMessage({
text: formatMessage({id: 'mobile.create_direct_message.start', defaultMessage: 'Start'}),
showAsAction: 'always',
enabled: startEnabled,
testID: 'more_direct_messages.start.button',
testID: 'create_direct_message.start.button',
}],
});
}, [intl.locale, theme]);
@@ -359,7 +359,10 @@ export default function CreateDirectMessage({
}
return (
<SafeAreaView style={style.container}>
<SafeAreaView
style={style.container}
testID='create_direct_message.screen'
>
<View style={style.searchBar}>
<Search
testID='create_direct_message.search_bar'
@@ -393,6 +396,7 @@ export default function CreateDirectMessage({
showNoResults={!loading && page.current !== -1}
teammateNameDisplay={teammateNameDisplay}
fetchMore={getProfiles}
testID='create_direct_message.user_list'
/>
</SafeAreaView>
);

View File

@@ -82,7 +82,7 @@ export default function SelectedUsers({
user={selectedIds[id]}
teammateNameDisplay={teammateNameDisplay}
onRemove={onRemove}
testID='more_direct_messages.selected_user'
testID='create_direct_message.selected_user'
/>,
);
}

View File

@@ -85,7 +85,7 @@ export default function SelectedUser({
>
<Text
style={style.text}
testID={`${testID}.${user.id}.display_username`}
testID={`${testID}.${user.id}.display_name`}
>
{displayUsername(user, intl.locale, teammateNameDisplay)}
</Text>

View File

@@ -167,7 +167,7 @@ export default function UserList({
selectable={canAdd}
selected={selected}
enabled={canAdd}
testID='more_direct_messages.user_list.user_item'
testID='create_direct_message.user_list.user_item'
teammateNameDisplay={teammateNameDisplay}
user={item}
/>
@@ -233,7 +233,7 @@ export default function UserList({
renderItem={renderItem}
scrollEventThrottle={SCROLL_EVENT_THROTTLE}
style={style.list}
testID={testID}
testID={`${testID}.flat_list`}
/>
);
};
@@ -257,7 +257,7 @@ export default function UserList({
sections={data}
style={style.list}
stickySectionHeadersEnabled={false}
testID={testID}
testID={`${testID}.section_list`}
onEndReached={fetchMore}
/>
);

View File

@@ -2,7 +2,11 @@
// See LICENSE.txt for license information.
import Alert from './alert';
import NavigationHeader from './navigation_header';
import PlusMenu from './plus_menu';
export {
Alert,
NavigationHeader,
PlusMenu,
};

View File

@@ -0,0 +1,17 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
class NavigationHeader {
testID = {
backButton: 'navigation.header.back',
headerTitle: 'navigation.header.title',
headerSubtitle: 'navigation.header.subtitle',
};
backButton = element(by.id(this.testID.backButton));
headerTitle = element(by.id(this.testID.headerTitle));
headerSubtitle = element(by.id(this.testID.headerSubtitle));
}
const navigationHeader = new NavigationHeader();
export default navigationHeader;

View File

@@ -0,0 +1,17 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
class PlusMenu {
testID = {
browseChannelsItem: 'plus_menu_item.browse_channels',
createNewChannelItem: 'plus_menu_item.create_new_channel',
openDirectMessageItem: 'plus_menu_item.open_direct_message',
};
browseChannelsItem = element(by.id(this.testID.browseChannelsItem));
createNewChannelItem = element(by.id(this.testID.createNewChannelItem));
openDirectMessageItem = element(by.id(this.testID.openDirectMessageItem));
}
const plusMenu = new PlusMenu();
export default plusMenu;

View File

@@ -0,0 +1,54 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {ChannelListScreen} from '@support/ui/screen';
import {timeouts} from '@support/utils';
import {expect} from 'detox';
class BrowseChannelsScreen {
testID = {
browseChannelsScreen: 'browse_channels.screen',
closeButton: 'close.browse_channels.button',
searchInput: 'browse_channels.search_bar.search.input',
searchClearButton: 'browse_channels.search_bar.search.clear.button',
searchCancelButton: 'browse_channels.search_bar.search.cancel.button',
flatChannelList: 'browse_channels.channel_list.flat_list',
};
browseChannelsScreen = element(by.id(this.testID.browseChannelsScreen));
closeButton = element(by.id(this.testID.closeButton));
searchInput = element(by.id(this.testID.searchInput));
searchClearButton = element(by.id(this.testID.searchClearButton));
searchCancelButton = element(by.id(this.testID.searchCancelButton));
flatChannelList = element(by.id(this.testID.flatChannelList));
getChannelItem = (channelName: string) => {
return element(by.id(`browse_channels.custom_list.channel_item.${channelName}`));
};
getChannelItemDisplayName = (channelName: string) => {
return element(by.id(`browse_channels.custom_list.channel_item.${channelName}.display_name`));
};
toBeVisible = async () => {
await waitFor(this.browseChannelsScreen).toExist().withTimeout(timeouts.TEN_SEC);
return this.browseChannelsScreen;
};
open = async () => {
// # Open browse channels screen
await ChannelListScreen.headerPlusButton.tap();
await ChannelListScreen.browseChannelsItem.tap();
return this.toBeVisible();
};
close = async () => {
await this.closeButton.tap();
await expect(this.browseChannelsScreen).not.toBeVisible();
};
}
const browseChannelsScreen = new BrowseChannelsScreen();
export default browseChannelsScreen;

View File

@@ -0,0 +1,50 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {NavigationHeader} from '@support/ui/component';
import {ChannelListScreen} from '@support/ui/screen';
import {timeouts} from '@support/utils';
import {expect} from 'detox';
class ChannelScreen {
testID = {
channelScreen: 'channel.screen',
introDisplayName: 'channel_post_list.intro.display_name',
introOptionAddPeopleItem: 'channel_post_list.intro.option_item.add_people',
introOptionSetHeaderItem: 'channel_post_list.intro.option_item.set_header',
introOptionChannelDetailsItem: 'channel_post_list.intro.option_item.channel_details',
};
channelScreen = element(by.id(this.testID.channelScreen));
introDisplayName = element(by.id(this.testID.introDisplayName));
introOptionAddPeopleItem = element(by.id(this.testID.introOptionAddPeopleItem));
introOptionSetHeaderItem = element(by.id(this.testID.introOptionSetHeaderItem));
introOptionChannelDetailsItem = element(by.id(this.testID.introOptionChannelDetailsItem));
backButton = NavigationHeader.backButton;
headerTitle = NavigationHeader.headerTitle;
getIntroOptionItemLabel = (introOptionItemTestId: string) => {
return element(by.id(`${introOptionItemTestId}.label`));
};
toBeVisible = async () => {
await waitFor(this.channelScreen).toExist().withTimeout(timeouts.TEN_SEC);
return this.channelScreen;
};
open = async (categoryKey: string, channelName: string) => {
// # Open channel screen
await ChannelListScreen.getChannelListItemDisplayName(categoryKey, channelName).tap();
return this.toBeVisible();
};
back = async () => {
await this.backButton.tap();
await expect(this.channelScreen).not.toBeVisible();
};
}
const channelScreen = new ChannelScreen();
export default channelScreen;

View File

@@ -1,6 +1,7 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {PlusMenu} from '@support/ui/component';
import {HomeScreen} from '@support/ui/screen';
import {timeouts} from '@support/utils';
@@ -10,12 +11,47 @@ class ChannelListScreen {
serverIcon: 'channel_list.servers.server_icon',
headerTeamDisplayName: 'channel_list_header.team_display_name',
headerServerDisplayName: 'channel_list_header.server_display_name',
headerChevronButton: 'channel_list_header.chevron.button',
headerPlusButton: 'channel_list_header.plus.button',
findChannelsInput: 'channel_list.search_field.find_channels.input',
threadsButton: 'channel_list.threads.button',
};
channelListScreen = element(by.id(this.testID.channelListScreen));
serverIcon = element(by.id(this.testID.serverIcon));
headerTeamDisplayName = element(by.id(this.testID.headerTeamDisplayName));
headerServerDisplayName = element(by.id(this.testID.headerServerDisplayName));
headerChevronButton = element(by.id(this.testID.headerChevronButton));
headerPlusButton = element(by.id(this.testID.headerPlusButton));
findChannelsInput = element(by.id(this.testID.findChannelsInput));
threadsButton = element(by.id(this.testID.threadsButton));
browseChannelsItem = PlusMenu.browseChannelsItem;
createNewChannelItem = PlusMenu.createNewChannelItem;
openDirectMessageItem = PlusMenu.openDirectMessageItem;
getCategoryCollapsed = (categoryKey: string) => {
return element(by.id(`category_header.${categoryKey}.collapsed.true`));
};
getCategoryExpanded = (categoryKey: string) => {
return element(by.id(`category_header.${categoryKey}.collapsed.false`));
};
getCategoryHeaderDisplayName = (categoryKey: string) => {
return element(by.id(`category_header.${categoryKey}.display_name`));
};
getChannelListItemCollapsed = (categoryKey: string, channelName: string) => {
return element(by.id(`category.${categoryKey}.channel_list_item.${channelName}.collapsed.true`));
};
getChannelListItemExpanded = (categoryKey: string, channelName: string) => {
return element(by.id(`category.${categoryKey}.channel_list_item.${channelName}.collapsed.false`));
};
getChannelListItemDisplayName = (categoryKey: string, channelName: string) => {
return element(by.id(`category.${categoryKey}.channel_list_item.${channelName}.display_name`));
};
toBeVisible = async () => {
await waitFor(this.channelListScreen).toExist().withTimeout(timeouts.TEN_SEC);

View File

@@ -0,0 +1,74 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {ChannelListScreen} from '@support/ui/screen';
import {timeouts} from '@support/utils';
import {expect} from 'detox';
class CreateDirectMessageScreen {
testID = {
createDirectMessageScreen: 'create_direct_message.screen',
closeButton: 'close.create_direct_message.button',
startButton: 'create_direct_message.start.button',
searchInput: 'create_direct_message.search_bar.search.input',
searchClearButton: 'create_direct_message.search_bar.search.clear.button',
searchCancelButton: 'create_direct_message.search_bar.search.cancel.button',
flatUserList: 'create_direct_message.user_list.flat_list',
sectionUserList: 'create_direct_message.user_list.section_list',
};
createDirectMessageScreen = element(by.id(this.testID.createDirectMessageScreen));
closeButton = element(by.id(this.testID.closeButton));
startButton = element(by.id(this.testID.startButton));
searchInput = element(by.id(this.testID.searchInput));
searchClearButton = element(by.id(this.testID.searchClearButton));
searchCancelButton = element(by.id(this.testID.searchCancelButton));
flatUserList = element(by.id(this.testID.flatUserList));
sectionUserList = element(by.id(this.testID.sectionUserList));
getSelectedUser = (userId: string) => {
return element(by.id(`create_direct_message.selected_user.${userId}`));
};
getSelectedUserDisplayName = (userId: string) => {
return element(by.id(`create_direct_message.selected_user.${userId}.display_name`));
};
getSelectedUserRemoveButton = (userId: string) => {
return element(by.id(`create_direct_message.selected_user.${userId}.remove.button`));
};
getUserItem = (userId: string) => {
return element(by.id(`create_direct_message.user_list.user_item.${userId}`));
};
getUserItemProfilePicture = (userId: string) => {
return element(by.id(`create_direct_message.user_list.user_item.${userId}.profile_picture`));
};
getUserItemDisplayName = (userId: string) => {
return element(by.id(`create_direct_message.user_list.user_item.${userId}.display_name`));
};
toBeVisible = async () => {
await waitFor(this.createDirectMessageScreen).toExist().withTimeout(timeouts.TEN_SEC);
return this.createDirectMessageScreen;
};
open = async () => {
// # Open create direct message screen
await ChannelListScreen.headerPlusButton.tap();
await ChannelListScreen.openDirectMessageItem.tap();
return this.toBeVisible();
};
close = async () => {
await this.closeButton.tap();
await expect(this.createDirectMessageScreen).not.toBeVisible();
};
}
const createDirectMessageScreen = new CreateDirectMessageScreen();
export default createDirectMessageScreen;

View File

@@ -2,7 +2,10 @@
// See LICENSE.txt for license information.
import AccountScreen from './account';
import BrowseChannelsScreen from './browse_channels';
import ChannelScreen from './channel';
import ChannelListScreen from './channel_list';
import CreateDirectMessageScreen from './create_direct_message';
import EditServerScreen from './edit_server';
import HomeScreen from './home';
import LoginScreen from './login';
@@ -11,7 +14,10 @@ import ServerListScreen from './server_list';
export {
AccountScreen,
BrowseChannelsScreen,
ChannelScreen,
ChannelListScreen,
CreateDirectMessageScreen,
EditServerScreen,
HomeScreen,
LoginScreen,

View File

@@ -9,6 +9,11 @@ class LoginScreen {
testID = {
loginScreen: 'login.screen',
backButton: 'screen.back.button',
titleLoginToAccount: 'login_options.title.login_to_account',
titleCantLogin: 'login_options.title.cant_login',
descriptionEnterCredentials: 'login_options.description.enter_credentials',
descriptionSelectOption: 'login_options.description.select_option',
descriptionNone: 'login_options.description.none',
usernameInput: 'login_form.username.input',
usernameInputError: 'login_form.username.input.error',
passwordInput: 'login_form.password.input',
@@ -20,6 +25,11 @@ class LoginScreen {
loginScreen = element(by.id(this.testID.loginScreen));
backButton = element(by.id(this.testID.backButton));
titleLoginToAccount = element(by.id(this.testID.titleLoginToAccount));
titleCantLogin = element(by.id(this.testID.titleCantLogin));
descriptionEnterCredentials = element(by.id(this.testID.descriptionEnterCredentials));
descriptionSelectOption = element(by.id(this.testID.descriptionSelectOption));
descriptionNone = element(by.id(this.testID.descriptionNone));
usernameInput = element(by.id(this.testID.usernameInput));
usernameInputError = element(by.id(this.testID.usernameInputError));
passwordInput = element(by.id(this.testID.passwordInput));

View File

@@ -2,6 +2,7 @@
// See LICENSE.txt for license information.
import {timeouts} from '@support/utils';
import {expect} from 'detox';
class ServerScreen {
testID = {
@@ -47,6 +48,11 @@ class ServerScreen {
await this.serverDisplayNameInput.replaceText(serverDisplayName);
await this.connectButton.tap();
};
close = async () => {
await this.closeButton.tap();
await expect(this.serverScreen).not.toBeVisible();
};
}
const serverScreen = new ServerScreen();

View File

@@ -0,0 +1,94 @@
// 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 {
Channel,
Setup,
} from '@support/server_api';
import {
serverOneUrl,
siteOneUrl,
} from '@support/test_config';
import {
BrowseChannelsScreen,
ChannelScreen,
ChannelListScreen,
HomeScreen,
LoginScreen,
ServerScreen,
} from '@support/ui/screen';
import {expect} from 'detox';
describe('Channels - Browse Channels', () => {
const serverOneDisplayName = 'Server 1';
const channelsCategory = 'channels';
let testTeam: any;
beforeAll(async () => {
const {team, user} = await Setup.apiInit(siteOneUrl);
testTeam = team;
// # Log in to server
await ServerScreen.connectToServer(serverOneUrl, serverOneDisplayName);
await LoginScreen.login(user);
});
beforeEach(async () => {
// * Verify on channel list screen
await ChannelListScreen.toBeVisible();
});
afterAll(async () => {
// # Log out
await HomeScreen.logout();
});
it('MM-T4729_1 - should match elements on browse channels screen', async () => {
// # Open browse channels screen
await BrowseChannelsScreen.open();
// * Verify basic elements on browse channels screen
await expect(BrowseChannelsScreen.closeButton).toBeVisible();
await expect(BrowseChannelsScreen.searchInput).toBeVisible();
await expect(BrowseChannelsScreen.flatChannelList).toBeVisible();
// # Go back to channel list screen
await BrowseChannelsScreen.close();
});
it('MM-T4729_2 - should be able to browse and join channels', async () => {
// # As admin, create a new channel so that user can join
const {channel} = await Channel.apiCreateChannel(siteOneUrl, {teamId: testTeam.id});
// * Verify new channel does not appear on channel list screen
await expect(ChannelListScreen.getChannelListItemDisplayName(channelsCategory, channel.display_name)).not.toExist();
// # Open browse channels screen and search for the new channel name to join
await BrowseChannelsScreen.open();
await BrowseChannelsScreen.searchInput.replaceText(channel.name);
// * Verify search returns the new channel item
await expect(BrowseChannelsScreen.getChannelItemDisplayName(channel.name)).toHaveText(channel.display_name);
// # Tap on the new channel item
await BrowseChannelsScreen.getChannelItem(channel.name).tap();
// * Verify on new channel screen
await ChannelScreen.toBeVisible();
await expect(ChannelScreen.headerTitle).toHaveText(channel.display_name);
await expect(ChannelScreen.introDisplayName).toHaveText(channel.display_name);
// # Go back to channel list screen
await ChannelScreen.back();
await ChannelListScreen.toBeVisible();
// * Verify new channel is added to channel list
await expect(ChannelListScreen.getChannelListItemDisplayName(channelsCategory, channel.name)).toBeVisible();
});
});

View File

@@ -0,0 +1,156 @@
// 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 {Setup} from '@support/server_api';
import {
serverOneUrl,
siteOneUrl,
} from '@support/test_config';
import {
BrowseChannelsScreen,
ChannelScreen,
ChannelListScreen,
CreateDirectMessageScreen,
HomeScreen,
LoginScreen,
ServerScreen,
} from '@support/ui/screen';
import {expect} from 'detox';
describe('Channels - Channel List', () => {
const serverOneDisplayName = 'Server 1';
const channelsCategory = 'channels';
const directMessagesCategory = 'direct_messages';
const offTopicChannelName = 'off-topic';
const townSquareChannelName = 'town-square';
let testChannel: any;
let testTeam: any;
beforeAll(async () => {
const {channel, team, user} = await Setup.apiInit(siteOneUrl);
testChannel = channel;
testTeam = team;
// # Log in to server
await ServerScreen.connectToServer(serverOneUrl, serverOneDisplayName);
await LoginScreen.login(user);
});
beforeEach(async () => {
// * Verify on channel list screen
await ChannelListScreen.toBeVisible();
});
afterAll(async () => {
// # Log out
await HomeScreen.logout();
});
it('MM-T4728_1 - should match elements on channel list screen', async () => {
// * Verify basic elements on channel list screen
await expect(ChannelListScreen.serverIcon).toBeVisible();
await expect(ChannelListScreen.headerTeamDisplayName).toHaveText(testTeam.display_name);
await expect(ChannelListScreen.headerServerDisplayName).toHaveText(serverOneDisplayName);
await expect(ChannelListScreen.headerChevronButton).toBeVisible();
await expect(ChannelListScreen.headerPlusButton).toBeVisible();
await expect(ChannelListScreen.threadsButton).toBeVisible();
await expect(ChannelListScreen.getCategoryHeaderDisplayName(channelsCategory)).toHaveText('CHANNELS');
await expect(ChannelListScreen.getChannelListItemDisplayName(channelsCategory, testChannel.name)).toHaveText(testChannel.display_name);
await expect(ChannelListScreen.getChannelListItemDisplayName(channelsCategory, offTopicChannelName)).toHaveText('Off-Topic');
await expect(ChannelListScreen.getChannelListItemDisplayName(channelsCategory, townSquareChannelName)).toHaveText('Town Square');
await expect(ChannelListScreen.getCategoryHeaderDisplayName(directMessagesCategory)).toHaveText('DIRECT MESSAGES');
});
it('MM-T4728_2 - should be able to switch between channels', async () => {
// # Tap on a first channel
await ChannelListScreen.getChannelListItemDisplayName(channelsCategory, testChannel.name).tap();
// * Verify on first channel
await ChannelScreen.toBeVisible();
await expect(ChannelScreen.headerTitle).toHaveText(testChannel.display_name);
await expect(ChannelScreen.introDisplayName).toHaveText(testChannel.display_name);
// # Go back to channel list screen and tap on a second channel
await ChannelScreen.backButton.tap();
await ChannelListScreen.toBeVisible();
await ChannelListScreen.getChannelListItemDisplayName(channelsCategory, offTopicChannelName).tap();
// * Verify on second channel
await ChannelScreen.toBeVisible();
await expect(ChannelScreen.headerTitle).toHaveText('Off-Topic');
await expect(ChannelScreen.introDisplayName).toHaveText('Off-Topic');
// # Go back to channel list screen
await ChannelScreen.back();
});
it('MM-T4728_3 - should be able to collapse and expand categories', async () => {
// # Go to a channel to make it active and go back to channel list screen
await ChannelListScreen.getChannelListItemDisplayName(channelsCategory, testChannel.name).tap();
await ChannelScreen.toBeVisible();
await ChannelScreen.backButton.tap();
// * Verify on channel list screen
await ChannelListScreen.toBeVisible();
// # Toggle channels category to collapse
await ChannelListScreen.getCategoryExpanded(channelsCategory).tap();
// * Verify category is collapsed and only currently active channel is listed
await expect(ChannelListScreen.getCategoryCollapsed(channelsCategory)).toBeVisible();
await expect(ChannelListScreen.getChannelListItemExpanded(channelsCategory, testChannel.name)).toBeVisible();
await expect(ChannelListScreen.getChannelListItemCollapsed(channelsCategory, offTopicChannelName)).toBeVisible();
await expect(ChannelListScreen.getChannelListItemCollapsed(channelsCategory, townSquareChannelName)).toBeVisible();
// # Toggle channels category to expand
await ChannelListScreen.getCategoryCollapsed(channelsCategory).tap();
// * Verify category is expanded and all channels are listed
await expect(ChannelListScreen.getCategoryExpanded(channelsCategory)).toBeVisible();
await expect(ChannelListScreen.getChannelListItemExpanded(channelsCategory, testChannel.name)).toBeVisible();
await expect(ChannelListScreen.getChannelListItemExpanded(channelsCategory, offTopicChannelName)).toBeVisible();
await expect(ChannelListScreen.getChannelListItemExpanded(channelsCategory, townSquareChannelName)).toBeVisible();
});
it('MM-T4728_4 - should be able to go to browse channels screen', async () => {
// # Tap on plus menu button and tap on browse channels item
await ChannelListScreen.headerPlusButton.tap();
await ChannelListScreen.browseChannelsItem.tap();
// * Verify on browse channels screen
await BrowseChannelsScreen.toBeVisible();
// # Go back to channel list screen
await BrowseChannelsScreen.close();
});
it('MM-T4728_5 - should be able to go to create direct message screen', async () => {
// # Tap on plus menu button and tap on open a direct message item
await ChannelListScreen.headerPlusButton.tap();
await ChannelListScreen.openDirectMessageItem.tap();
// * Verify on create direct message screen
await CreateDirectMessageScreen.toBeVisible();
// # Go back to channel list screen
await CreateDirectMessageScreen.close();
});
xit('MM-T4728_6 - should be able to go to create channel screen', async () => {
// NOT YET IMPLEMENTED
});
xit('MM-T4728_7 - should be able to go to threads screen', async () => {
// NOT YET IMPLEMENTED
});
xit('MM-T4728_8 - should be able to find channels', async () => {
// NOT YET IMPLEMENTED
});
});

View File

@@ -0,0 +1,148 @@
// 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 {
Setup,
Team,
User,
} from '@support/server_api';
import {
serverOneUrl,
siteOneUrl,
} from '@support/test_config';
import {
ChannelScreen,
ChannelListScreen,
CreateDirectMessageScreen,
HomeScreen,
LoginScreen,
ServerScreen,
} from '@support/ui/screen';
import {expect} from 'detox';
describe('Channels - Create Direct Message', () => {
const serverOneDisplayName = 'Server 1';
const directMessagesCategory = 'direct_messages';
let testTeam: any;
beforeAll(async () => {
const {team, user} = await Setup.apiInit(siteOneUrl);
testTeam = team;
// # Log in to server
await ServerScreen.connectToServer(serverOneUrl, serverOneDisplayName);
await LoginScreen.login(user);
});
beforeEach(async () => {
// * Verify on channel list screen
await ChannelListScreen.toBeVisible();
});
afterAll(async () => {
// # Log out
await HomeScreen.logout();
});
it('MM-T4730_1 - should match elements on create direct message screen', async () => {
// # Open create direct message screen
await CreateDirectMessageScreen.open();
// * Verify basic elements on create direct message screen
await expect(CreateDirectMessageScreen.closeButton).toBeVisible();
await expect(CreateDirectMessageScreen.startButton).toBeVisible();
await expect(CreateDirectMessageScreen.searchInput).toBeVisible();
await expect(CreateDirectMessageScreen.sectionUserList).toBeVisible();
// # Go back to channel list screen
await CreateDirectMessageScreen.close();
});
it('MM-T4730_2 - should be able to create a direct message', async () => {
// # As admin, create a new user to open direct message with
const {user: newUser} = await User.apiCreateUser(siteOneUrl);
await Team.apiAddUserToTeam(siteOneUrl, newUser.id, testTeam.id);
// * Verify no direct message channel for the new user appears on channel list screen
const newUserDisplayName = newUser.username;
await expect(ChannelListScreen.getChannelListItemDisplayName(directMessagesCategory, newUserDisplayName)).not.toBeVisible();
// # Open create direct message screen and search for the new user
await CreateDirectMessageScreen.open();
await CreateDirectMessageScreen.searchInput.replaceText(newUser.username);
// * Verify search returns the new user item
await expect(CreateDirectMessageScreen.getUserItemDisplayName(newUser.id)).toBeVisible();
// # Tap on the new user item
await CreateDirectMessageScreen.getUserItem(newUser.id).tap();
// * Verify the new user is selected
await expect(CreateDirectMessageScreen.getSelectedUserDisplayName(newUser.id)).toBeVisible();
// # Tap on start button
await CreateDirectMessageScreen.startButton.tap();
// * Verify on direct message channel screen for the new user
await ChannelScreen.toBeVisible();
await expect(ChannelScreen.headerTitle).toHaveText(newUserDisplayName);
await expect(ChannelScreen.introDisplayName).toHaveText(newUserDisplayName);
// # Go back to channel list screen
await ChannelScreen.back();
await ChannelListScreen.toBeVisible();
// * Verify direct message channel for the new user is added to direct message list
await expect(ChannelListScreen.getChannelListItemDisplayName(directMessagesCategory, newUser.id)).toHaveText(newUserDisplayName);
});
it('MM-T4730_3 - should be able to create a group message', async () => {
// # As admin, create two new users to open group message with
const {user: firstNewUser} = await User.apiCreateUser(siteOneUrl, {prefix: 'a'});
await Team.apiAddUserToTeam(siteOneUrl, firstNewUser.id, testTeam.id);
const {user: secondNewUser} = await User.apiCreateUser(siteOneUrl, {prefix: 'b'});
await Team.apiAddUserToTeam(siteOneUrl, secondNewUser.id, testTeam.id);
// * Verify no group message channel for the new users appears on channel list screen
const firstNewUserDisplayName = firstNewUser.username;
const secondNewUserDisplayName = secondNewUser.username;
const groupDisplayName = `${firstNewUserDisplayName}, ${secondNewUserDisplayName}`;
await expect(ChannelListScreen.getChannelListItemDisplayName(directMessagesCategory, groupDisplayName)).not.toBeVisible();
// # Open create direct message screen, search for the first new user and tap on the first new user item
await CreateDirectMessageScreen.open();
await CreateDirectMessageScreen.searchInput.replaceText(firstNewUser.username);
await CreateDirectMessageScreen.getUserItem(firstNewUser.id).tap();
// * Verify the first new user is selected
await expect(CreateDirectMessageScreen.getSelectedUserDisplayName(firstNewUser.id)).toBeVisible();
// # Search for the second new user and tap on the second new user item
await CreateDirectMessageScreen.searchInput.replaceText(secondNewUser.username);
await CreateDirectMessageScreen.getUserItem(secondNewUser.id).tap();
// * Verify the second new user is selected
await expect(CreateDirectMessageScreen.getSelectedUserDisplayName(secondNewUser.id)).toBeVisible();
// # Tap on start button
await CreateDirectMessageScreen.startButton.tap();
// * Verify on group message channel screen for the other two new users
await ChannelScreen.toBeVisible();
await expect(ChannelScreen.headerTitle).toHaveText(groupDisplayName);
await expect(ChannelScreen.introDisplayName).toHaveText(groupDisplayName);
// # Go back to channel list screen
await ChannelScreen.back();
await ChannelListScreen.toBeVisible();
// * Verify group message channel for the other two new users is added to direct message list
await expect(ChannelListScreen.getChannelListItemDisplayName(directMessagesCategory, `${firstNewUser.id}__${secondNewUser.id}`)).toHaveText(groupDisplayName);
});
});

View File

@@ -38,12 +38,12 @@ describe('Server Login - Connect to Server', () => {
it('MM-T4676_1 - should match elements on server screen', async () => {
// * Verify basic elements on server screen
await expect(headerTitleConnectToServer).toBeVisible();
await expect(headerWelcome).toBeVisible();
await expect(headerDescription).toBeVisible();
await expect(headerWelcome).toHaveText('Welcome');
await expect(headerTitleConnectToServer).toHaveText('Lets Connect to a Server');
await expect(headerDescription).toHaveText('A Server is your team\'s communication hub which is accessed through a unique URL');
await expect(serverUrlInput).toBeVisible();
await expect(serverDisplayNameInput).toBeVisible();
await expect(displayHelp).toBeVisible();
await expect(displayHelp).toHaveText('Choose a display name for your server');
await expect(connectButtonDisabled).toBeVisible();
});

View File

@@ -22,11 +22,13 @@ import {expect} from 'detox';
describe('Server Login - Login by Email', () => {
const {
backButton,
descriptionEnterCredentials,
forgotPasswordButton,
passwordInput,
passwordInputError,
signinButton,
signinButtonDisabled,
titleLoginToAccount,
usernameInput,
} = LoginScreen;
const serverOneDisplayName = 'Server 1';
@@ -48,6 +50,8 @@ describe('Server Login - Login by Email', () => {
it('MM-T4677_1 - should match elements on login screen', async () => {
// * Verify basic elements on login screen
await expect(backButton).toBeVisible();
await expect(titleLoginToAccount).toHaveText('Log In to Your Account');
await expect(descriptionEnterCredentials).toHaveText('Enter your login details below.');
await expect(usernameInput).toBeVisible();
await expect(passwordInput).toBeVisible();
await expect(forgotPasswordButton).toBeVisible();

View File

@@ -48,21 +48,37 @@ describe('Server Login - Server List', () => {
await LoginScreen.login(serverOneUser);
});
beforeEach(async () => {
// * Verify on channel list screen
await ChannelListScreen.toBeVisible();
});
afterAll(async () => {
// # Log out
await HomeScreen.logout();
});
it('MM-T4691_1 - should be able to add and log in to new servers', async () => {
it('MM-T4691_1 - should match elements on server list screen', async () => {
// # Open server list screen
await ServerListScreen.open();
// * Verify basic elements on server list screen
await expect(ServerListScreen.serverListTitle).toHaveText('Your servers');
await expect(ServerListScreen.getServerItemActive(serverOneDisplayName)).toBeVisible();
await expect(ServerListScreen.addServerButton).toBeVisible();
// # Go back to channel list screen
await ServerListScreen.getServerItemActive(serverOneDisplayName).tap();
});
it('MM-T4691_2 - should be able to add and log in to new servers', async () => {
// * Verify on channel list screen of the first server
await ChannelListScreen.toBeVisible();
await expect(ChannelListScreen.headerServerDisplayName).toHaveText(serverOneDisplayName);
// # Open server list screen
await ServerListScreen.open();
// * Verify first server is active
await ServerListScreen.toBeVisible();
await expect(ServerListScreen.getServerItemActive(serverOneDisplayName)).toBeVisible();
// # Add a second server and log in to the second server
@@ -81,7 +97,6 @@ describe('Server Login - Server List', () => {
await ServerListScreen.open();
// * Verify second server is active and first server is inactive
await ServerListScreen.toBeVisible();
await expect(ServerListScreen.getServerItemActive(serverTwoDisplayName)).toBeVisible();
await expect(ServerListScreen.getServerItemInactive(serverOneDisplayName)).toBeVisible();
@@ -101,7 +116,6 @@ describe('Server Login - Server List', () => {
await ServerListScreen.open();
// * Verify third server is active, and first and second servers are inactive
await ServerListScreen.toBeVisible();
await expect(ServerListScreen.getServerItemActive(serverThreeDisplayName)).toBeVisible();
await expect(ServerListScreen.getServerItemInactive(serverOneDisplayName)).toBeVisible();
await expect(ServerListScreen.getServerItemInactive(serverTwoDisplayName)).toBeVisible();
@@ -110,9 +124,8 @@ describe('Server Login - Server List', () => {
await ServerListScreen.getServerItemInactive(serverOneDisplayName).tap();
});
it('MM-T4691_2 - should be able to switch to another existing server', async () => {
it('MM-T4691_3 - should be able to switch to another existing server', async () => {
// * Verify on channel list screen of the first server
await ChannelListScreen.toBeVisible();
await expect(ChannelListScreen.headerServerDisplayName).toHaveText(serverOneDisplayName);
// # Open server list screen and tap on third server
@@ -128,9 +141,8 @@ describe('Server Login - Server List', () => {
await ServerListScreen.getServerItemInactive(serverOneDisplayName).tap();
});
it('MM-T4691_3 - should be able to edit server display name of active and inactive servers', async () => {
it('MM-T4691_4 - should be able to edit server display name of active and inactive servers', async () => {
// * Verify on channel list screen of the first server
await ChannelListScreen.toBeVisible();
await expect(ChannelListScreen.headerServerDisplayName).toHaveText(serverOneDisplayName);
// # Open server list screen, swipe left on first server and tap on edit option
@@ -168,9 +180,8 @@ describe('Server Login - Server List', () => {
await ServerListScreen.getServerItemActive(serverOneDisplayName).tap();
});
it('MM-T4691_4 - should be able to remove a server from the list', async () => {
it('MM-T4691_5 - should be able to remove a server from the list', async () => {
// * Verify on channel list screen of the first server
await ChannelListScreen.toBeVisible();
await expect(ChannelListScreen.headerServerDisplayName).toHaveText(serverOneDisplayName);
// # Open server list screen, swipe left on first server and tap on remove option
@@ -196,9 +207,8 @@ describe('Server Login - Server List', () => {
await LoginScreen.login(serverOneUser);
});
it('MM-T4691_5 - should be able to log out a server from the list', async () => {
it('MM-T4691_6 - should be able to log out a server from the list', async () => {
// * Verify on channel list screen of the first server
await ChannelListScreen.toBeVisible();
await expect(ChannelListScreen.headerServerDisplayName).toHaveText(serverOneDisplayName);
// # Open server list screen, swipe left on first server and tap on logout option
@@ -224,9 +234,8 @@ describe('Server Login - Server List', () => {
await LoginScreen.login(serverOneUser);
});
it('MM-T4691_6 - should not be able to add server for an already existing server', async () => {
it('MM-T4691_7 - should not be able to add server for an already existing server', async () => {
// * Verify on channel list screen of the first server
await ChannelListScreen.toBeVisible();
await expect(ChannelListScreen.headerServerDisplayName).toHaveText(serverOneDisplayName);
// # Open server list screen, attempt to add a server already logged in and with inactive session
@@ -250,6 +259,6 @@ describe('Server Login - Server List', () => {
await expect(ServerScreen.serverDisplayNameInputError).toHaveText(sameNameServerError);
// # Close server screen to go back to first server
await ServerScreen.closeButton.tap();
await ServerScreen.close();
});
});

View File

@@ -26,7 +26,7 @@ import {
} from '@support/ui/screen';
import {expect} from 'detox';
describe('Server Login', () => {
describe('Smoke Test - Server Login', () => {
const serverOneDisplayName = 'Server 1';
const serverTwoDisplayName = 'Server 2';

View File

@@ -190,10 +190,8 @@ class TestHelper {
};
fakeChannel = (teamId: string): Channel => {
const name = this.generateId();
return {
name,
name: 'channel',
team_id: teamId,
// @to-do: Make tests more detriministic;