Misc fixes for android

This commit is contained in:
Joseph Baylon
2023-02-06 18:33:35 -08:00
committed by Elisabeth Kulzer
parent 53b834d702
commit 32fbc01d03
11 changed files with 30 additions and 15 deletions

View File

@@ -1,6 +1,7 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {timeouts, wait} from '@support/utils';
import {expect} from 'detox';
import ProfilePicture from './profile_picture';
@@ -111,6 +112,7 @@ class Autocomplete {
};
toBeVisible = async (isVisible = true) => {
await wait(timeouts.ONE_SEC);
if (isVisible) {
await expect(this.autocomplete.atIndex(0)).toBeVisible();
return this.autocomplete;

View File

@@ -124,6 +124,7 @@ class ChannelScreen {
};
back = async () => {
await wait(timeouts.ONE_SEC);
await this.backButton.tap();
await expect(this.channelScreen).not.toBeVisible();
};

View File

@@ -109,7 +109,7 @@ class ChannelInfoScreen {
};
archiveChannel = async (alertArchiveChannelTitle: Detox.NativeElement, {confirm = true} = {}) => {
await waitFor(this.archiveChannelOption).toExist().withTimeout(timeouts.TWO_SEC);
await waitFor(this.archiveChannelOption).toBeVisible().whileElement(by.id(this.testID.scrollView)).scroll(50, 'down');
await this.archiveChannelOption.tap({x: 1, y: 1});
const {
noButton,
@@ -196,7 +196,7 @@ class ChannelInfoScreen {
};
unarchiveChannel = async (alertUnarchiveChannelTitle: Detox.NativeElement, {confirm = true} = {}) => {
await waitFor(this.unarchiveChannelOption).toExist().withTimeout(timeouts.TWO_SEC);
await waitFor(this.unarchiveChannelOption).toBeVisible().whileElement(by.id(this.testID.scrollView)).scroll(50, 'down');
await this.unarchiveChannelOption.tap({x: 1, y: 1});
const {
noButton,

View File

@@ -58,7 +58,9 @@ class CreateDirectMessageScreen {
};
toBeVisible = async () => {
await waitFor(this.createDirectMessageScreen).toExist().withTimeout(timeouts.TEN_SEC);
if (isIos()) {
await waitFor(this.createDirectMessageScreen).toExist().withTimeout(timeouts.TEN_SEC);
}
return this.createDirectMessageScreen;
};
@@ -69,10 +71,7 @@ class CreateDirectMessageScreen {
await wait(timeouts.ONE_SEC);
await ChannelListScreen.openDirectMessageItem.tap();
if (isIos()) {
return this.toBeVisible();
}
return null;
return this.toBeVisible();
};
close = async () => {

View File

@@ -2,6 +2,7 @@
// See LICENSE.txt for license information.
import {PostList} from '@support/ui/component';
import {timeouts, wait} from '@support/utils';
import {expect} from 'detox';
class PermalinkScreen {
@@ -27,6 +28,7 @@ class PermalinkScreen {
};
toBeVisible = async () => {
await wait(timeouts.ONE_SEC);
await expect(this.permalinkScreen).toBeVisible();
return this.permalinkScreen;
@@ -34,6 +36,7 @@ class PermalinkScreen {
jumpToRecentMessages = async () => {
// # Jump to recent messages
await wait(timeouts.ONE_SEC);
await this.jumpToRecentMessagesButton.tap();
await expect(this.permalinkScreen).not.toBeVisible();
};

View File

@@ -53,7 +53,9 @@ class ServerListScreen {
};
toBeVisible = async () => {
await waitFor(this.serverListScreen).toExist().withTimeout(timeouts.TEN_SEC);
if (isIos()) {
await waitFor(this.serverListScreen).toExist().withTimeout(timeouts.TEN_SEC);
}
return this.serverListScreen;
};
@@ -62,10 +64,7 @@ class ServerListScreen {
// # Open server list screen
await ChannelListScreen.serverIcon.tap();
if (isIos()) {
return this.toBeVisible();
}
return null;
return this.toBeVisible();
};
close = async () => {

View File

@@ -72,7 +72,7 @@ describe('Account - Settings - About', () => {
await expect(AboutScreen.termsOfService).toHaveText('Terms of Service');
await expect(AboutScreen.privacyPolicy).toHaveText('Privacy Policy');
await expect(AboutScreen.noticeText).toHaveText('Mattermost is made possible by the open source software used in our server and mobile apps.');
await waitFor(AboutScreen.buildDateTitle).toBeVisible().whileElement(by.id(AboutScreen.testID.scrollView)).scroll(50, 'down');
await waitFor(AboutScreen.buildDateValue).toBeVisible().whileElement(by.id(AboutScreen.testID.scrollView)).scroll(50, 'down');
await expect(AboutScreen.buildHashTitle).toHaveText('Build Hash:');
await expect(AboutScreen.buildHashValue).toBeVisible();
await expect(AboutScreen.buildHashEnterpriseTitle).toHaveText('EE Build Hash:');

View File

@@ -65,6 +65,7 @@ describe('Channels - Channel Info', () => {
await expect(ChannelInfoScreen.copyChannelLinkOption).toBeVisible();
await expect(ChannelInfoScreen.editChannelOption).toBeVisible();
await expect(ChannelInfoScreen.leaveChannelOption).toBeVisible();
await waitFor(ChannelInfoScreen.archiveChannelOption).toBeVisible().whileElement(by.id(ChannelInfoScreen.testID.scrollView)).scroll(50, 'down');
await expect(ChannelInfoScreen.archiveChannelOption).toBeVisible();
// # Go back to channel list screen

View File

@@ -25,6 +25,7 @@ import {
LoginScreen,
ServerScreen,
} from '@support/ui/screen';
import {timeouts, wait} from '@support/utils';
import {expect} from 'detox';
describe('Channels - Find Channels', () => {
@@ -73,6 +74,7 @@ describe('Channels - Find Channels', () => {
await FindChannelsScreen.searchInput.replaceText(testChannel.name);
// * Verify search returns the target public channel item
await wait(timeouts.ONE_SEC);
await expect(FindChannelsScreen.getFilteredChannelItemDisplayName(testChannel.name)).toHaveText(testChannel.display_name);
// # Tap on the target public channel item
@@ -94,6 +96,7 @@ describe('Channels - Find Channels', () => {
await FindChannelsScreen.searchInput.replaceText(searchTerm);
// * Verify empty search state for find channels
await wait(timeouts.ONE_SEC);
await expect(element(by.text(`No matches found for “${searchTerm}`))).toBeVisible();
await expect(element(by.text('Check the spelling or try another search.'))).toBeVisible();
@@ -113,12 +116,14 @@ describe('Channels - Find Channels', () => {
await FindChannelsScreen.searchInput.replaceText(testOtherUser1.username);
// * Verify search returns the target direct message channel item
await wait(timeouts.ONE_SEC);
await expect(FindChannelsScreen.getFilteredChannelItemDisplayName(directMessageChannel.name)).toHaveText(testOtherUser1.username);
// # Search for the group message channel
await FindChannelsScreen.searchInput.replaceText(testOtherUser2.username);
// * Verify search returns the target group message channel item
await wait(timeouts.ONE_SEC);
await expect(FindChannelsScreen.getFilteredChannelItemDisplayName(groupMessageChannel.name)).toHaveText(`${testOtherUser1.username}, ${testOtherUser2.username}, sysadmin`);
// # Go back to channel list screen
@@ -134,6 +139,7 @@ describe('Channels - Find Channels', () => {
await FindChannelsScreen.searchInput.replaceText(archivedChannel.name);
// * Verify search returns the target archived channel item
await wait(timeouts.ONE_SEC);
await expect(FindChannelsScreen.getFilteredChannelItemDisplayName(archivedChannel.name)).toHaveText(archivedChannel.display_name);
// # Go back to channel list screen
@@ -149,12 +155,14 @@ describe('Channels - Find Channels', () => {
await FindChannelsScreen.searchInput.replaceText(joinedPrivateChannel.name);
// * Verify search returns the target joined private channel item
await wait(timeouts.ONE_SEC);
await expect(FindChannelsScreen.getFilteredChannelItemDisplayName(joinedPrivateChannel.name)).toHaveText(joinedPrivateChannel.display_name);
// # Search for an unjoined private channel
await FindChannelsScreen.searchInput.replaceText(unjoinedPrivateChannel.name);
// * Verify empty search state for find channels
await wait(timeouts.ONE_SEC);
await expect(element(by.text(`No matches found for “${unjoinedPrivateChannel.name}`))).toBeVisible();
// # Go back to channel list screen

View File

@@ -151,8 +151,8 @@ describe('Messaging - Emojis and Reactions', () => {
// * Verify emojis exist in recently used section
await expect(element(by.text('RECENTLY USED'))).toExist();
await expect(element(by.text('🦊'))).toExist();
await expect(element(by.text('🐶'))).toExist();
await expect(element(by.text('🦊')).atIndex(0)).toExist();
await expect(element(by.text('🐶')).atIndex(0)).toExist();
// # Go back to channel list screen
await EmojiPickerScreen.close();

View File

@@ -174,6 +174,7 @@ describe('Smoke Test - Messaging', () => {
await PostOptionsScreen.savePostOption.tap();
// * Verify saved text is displayed on the post pre-header
await wait(timeouts.ONE_SEC);
const {postListPostItemPreHeaderText: channelPostListPostItemPreHeaderText} = ChannelScreen.getPostListPostItem(post.id, message);
await expect(channelPostListPostItemPreHeaderText).toHaveText(savedText);
@@ -199,6 +200,7 @@ describe('Smoke Test - Messaging', () => {
await PostOptionsScreen.unpinPostOption.tap();
// * Verify pinned text is not displayed on the post pre-header
await wait(timeouts.ONE_SEC);
await expect(channelPostListPostItemPreHeaderText).not.toBeVisible();
// # Go back to channel list screen