MM-37129 Detox/E2E Maintenance: Fix failing tests - Android (#5559)
This commit is contained in:
parent
fedf636b2f
commit
74d3bad792
6 changed files with 42 additions and 21 deletions
|
|
@ -8,6 +8,7 @@ class LoginScreen {
|
|||
loginScreen: 'login.screen',
|
||||
usernameInput: 'login.username.input',
|
||||
passwordInput: 'login.password.input',
|
||||
backButton: 'screen.back.button',
|
||||
signinButton: 'login.signin.button',
|
||||
errorText: 'login.error.text',
|
||||
}
|
||||
|
|
@ -15,6 +16,7 @@ class LoginScreen {
|
|||
loginScreen = element(by.id(this.testID.loginScreen));
|
||||
usernameInput = element(by.id(this.testID.usernameInput));
|
||||
passwordInput = element(by.id(this.testID.passwordInput));
|
||||
backButton = element(by.id(this.testID.backButton));
|
||||
signinButton = element(by.id(this.testID.signinButton));
|
||||
errorText = element(by.id(this.testID.errorText));
|
||||
|
||||
|
|
@ -31,6 +33,11 @@ class LoginScreen {
|
|||
return this.toBeVisible();
|
||||
}
|
||||
|
||||
back = async () => {
|
||||
await this.backButton.tap();
|
||||
await expect(this.loginScreen).not.toBeVisible();
|
||||
}
|
||||
|
||||
/**
|
||||
* login enters credential on Login screen and then tap "Sign in" button to log in.
|
||||
* @param {Object} user - user to login with username and password
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import {
|
|||
Team,
|
||||
User,
|
||||
} from '@support/server_api';
|
||||
import {isAndroid} from '@support/utils';
|
||||
import {isAndroid, timeouts} from '@support/utils';
|
||||
|
||||
describe('Channel Moderation', () => {
|
||||
const {
|
||||
|
|
@ -76,7 +76,7 @@ describe('Channel Moderation', () => {
|
|||
const removeFromChannelDescriptionText = 'You were removed from the channel.';
|
||||
const removeFromChannelTitle = isAndroid() ? element(by.text(removeFromChannelTitleText)) : element(by.label(removeFromChannelTitleText)).atIndex(0);
|
||||
const removeFromChannelDescription = isAndroid() ? element(by.text(removeFromChannelDescriptionText)) : element(by.label(removeFromChannelDescriptionText)).atIndex(0);
|
||||
await expect(removeFromChannelTitle).toBeVisible();
|
||||
await waitFor(removeFromChannelTitle).toBeVisible().withTimeout(timeouts.TWO_SEC);
|
||||
await expect(removeFromChannelDescription).toBeVisible();
|
||||
|
||||
// # Tap on ok button
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ describe('Channel Link', () => {
|
|||
it('MM-T2970 should be able to open channel by tapping on channel link from main channel', async () => {
|
||||
// # Post a channel link
|
||||
await goToChannel(townSquareChannel.display_name);
|
||||
const channelLink = `${testConfig.siteUrl}/${testTeam.name}/channels/${testChannel.name}`;
|
||||
const channelLink = `${testConfig.serverUrl}/${testTeam.name}/channels/${testChannel.name}`;
|
||||
await postMessage(channelLink);
|
||||
|
||||
// # Tap on the channel link
|
||||
|
|
@ -59,7 +59,7 @@ describe('Channel Link', () => {
|
|||
it('MM-T178 should be able to open channel by tapping on channel link from reply thread', async () => {
|
||||
// # Post a channel link
|
||||
await goToChannel(townSquareChannel.display_name);
|
||||
const channelLink = `${testConfig.siteUrl}/${testTeam.name}/channels/${testChannel.name}`;
|
||||
const channelLink = `${testConfig.serverUrl}/${testTeam.name}/channels/${testChannel.name}`;
|
||||
await postMessage(channelLink);
|
||||
|
||||
// # Tap on the channel link from reply thread
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import {
|
|||
Post,
|
||||
Setup,
|
||||
} from '@support/server_api';
|
||||
import {isIos} from '@support/utils';
|
||||
|
||||
describe('Hashtags', () => {
|
||||
const {postMessage} = ChannelScreen;
|
||||
|
|
@ -103,18 +104,30 @@ describe('Hashtags', () => {
|
|||
// * Verify tapping on hashtag shows result containing post of hashtag
|
||||
await element(by.text(hashtag)).tap();
|
||||
await SearchScreen.toBeVisible();
|
||||
await expect(element(by.text(hashtag)).atIndex(1)).toExist();
|
||||
if (isIos()) {
|
||||
await expect(element(by.text(hashtag)).atIndex(1)).toExist();
|
||||
} else {
|
||||
await expect(element(by.text(hashtag)).atIndex(0)).toExist();
|
||||
}
|
||||
|
||||
// # Open reply thread from search result and tap on hashtag
|
||||
const {post} = await Post.apiGetLastPostInChannel(townSquareChannel.id);
|
||||
const {searchResultPostItemHeaderReply} = await getSearchResultPostItem(post.id, hashtag);
|
||||
await searchResultPostItemHeaderReply.tap();
|
||||
await ThreadScreen.toBeVisible();
|
||||
await element(by.text(hashtag)).atIndex(1).tap();
|
||||
if (isIos()) {
|
||||
await element(by.text(hashtag)).atIndex(1).tap();
|
||||
} else {
|
||||
await element(by.text(hashtag)).atIndex(0).tap();
|
||||
}
|
||||
|
||||
// * Verify tapping on hashtag from reply thread shows result containing post of hashtag
|
||||
await SearchScreen.toBeVisible();
|
||||
await expect(element(by.text(hashtag)).atIndex(1)).toExist();
|
||||
if (isIos()) {
|
||||
await expect(element(by.text(hashtag)).atIndex(1)).toExist();
|
||||
} else {
|
||||
await expect(element(by.text(hashtag)).atIndex(0)).toExist();
|
||||
}
|
||||
|
||||
// # Go back to channel
|
||||
await searchInput.clearText();
|
||||
|
|
|
|||
|
|
@ -22,10 +22,6 @@ describe('Select Server', () => {
|
|||
serverUrlInput,
|
||||
} = SelectServerScreen;
|
||||
|
||||
beforeEach(async () => {
|
||||
await device.reloadReactNative();
|
||||
});
|
||||
|
||||
it('should show Select server screen on initial load', async () => {
|
||||
// * Verify basic elements on Select Server screen
|
||||
await SelectServerScreen.toBeVisible();
|
||||
|
|
@ -38,7 +34,7 @@ describe('Select Server', () => {
|
|||
const screen = await SelectServerScreen.toBeVisible();
|
||||
|
||||
// # Enter an empty server URL
|
||||
await serverUrlInput.typeText(' ');
|
||||
await serverUrlInput.clearText();
|
||||
|
||||
// # Tap anywhere to hide keyboard
|
||||
await screen.tap({x: 5, y: 10});
|
||||
|
|
@ -55,11 +51,12 @@ describe('Select Server', () => {
|
|||
});
|
||||
|
||||
it('should show error on invalid server URL', async () => {
|
||||
await device.reloadReactNative();
|
||||
const screen = await SelectServerScreen.toBeVisible();
|
||||
|
||||
// # Enter invalid server URL
|
||||
await serverUrlInput.clearText();
|
||||
await serverUrlInput.typeText(serverUrl.substring(0, serverUrl.length - 1));
|
||||
await serverUrlInput.replaceText(serverUrl.substring(0, serverUrl.length - 1));
|
||||
|
||||
// # Tap anywhere to hide keyboard
|
||||
await screen.tap({x: 5, y: 10});
|
||||
|
|
@ -79,6 +76,7 @@ describe('Select Server', () => {
|
|||
await SelectServerScreen.toBeVisible();
|
||||
|
||||
// # Enter valid server URL
|
||||
await serverUrlInput.clearText();
|
||||
await serverUrlInput.replaceText(serverUrl);
|
||||
|
||||
// # Tap connect button
|
||||
|
|
@ -86,6 +84,7 @@ describe('Select Server', () => {
|
|||
|
||||
// * Verify that it goes into Login screen
|
||||
await LoginScreen.toBeVisible();
|
||||
await LoginScreen.back();
|
||||
});
|
||||
|
||||
it('MM-T2348 should show untrusted certificate prompt when connecting to a server with invalid SSL or invalid host', async () => {
|
||||
|
|
@ -94,7 +93,7 @@ describe('Select Server', () => {
|
|||
// # Attempt to connect to invalid SSL
|
||||
const invalidSsl = 'expired.badssl.com';
|
||||
await serverUrlInput.clearText();
|
||||
await serverUrlInput.typeText(invalidSsl);
|
||||
await serverUrlInput.replaceText(invalidSsl);
|
||||
await connectButton.tap();
|
||||
|
||||
// * Verify untrusted certificate alert is displayed with invalid SSL
|
||||
|
|
@ -105,7 +104,7 @@ describe('Select Server', () => {
|
|||
// # Attempt to connect to invalid host
|
||||
const invalidHost = 'wrong.host.badssl.com';
|
||||
await serverUrlInput.clearText();
|
||||
await serverUrlInput.typeText(invalidHost);
|
||||
await serverUrlInput.replaceText(invalidHost);
|
||||
await connectButton.tap();
|
||||
|
||||
// * Verify untrusted certificate alert is displayed with invalid host
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ describe('Search', () => {
|
|||
// # Perform search on keyword
|
||||
await SearchScreen.open();
|
||||
await searchInput.clearText();
|
||||
await searchInput.typeText(keyword);
|
||||
await searchInput.replaceText(keyword);
|
||||
await searchInput.tapReturnKey();
|
||||
|
||||
// * Verify user can scroll down multiple times until first matching post is seen
|
||||
|
|
@ -230,14 +230,15 @@ async function postMessageAndSearchFrom(testMessage, testUser, atMentionSuggesti
|
|||
await userAtMentionAutocomplete.tap();
|
||||
|
||||
// # Type end of search term
|
||||
await searchInput.typeText(testPartialSearchTerm);
|
||||
const searchTerms = `${searchFromModifier} ${testUser.username} ${testPartialSearchTerm}`;
|
||||
await searchInput.clearText();
|
||||
await searchInput.replaceText(searchTerms);
|
||||
|
||||
// # Search user
|
||||
await searchInput.tapReturnKey();
|
||||
await expect(atMentionSuggestionList).not.toExist();
|
||||
|
||||
// * Verify recent search item is displayed
|
||||
const searchTerms = `${searchFromModifier} ${testUser.username} ${testPartialSearchTerm}`;
|
||||
const {recentSearchItem} = await getRecentSearchItem(searchTerms);
|
||||
await expect(recentSearchItem).toBeVisible();
|
||||
}
|
||||
|
|
@ -270,14 +271,15 @@ async function postMessageAndSearchIn(testMessage, testChannel, channelMentionSu
|
|||
await channelMentionAutocomplete.tap();
|
||||
|
||||
// # Type end of search term
|
||||
await searchInput.typeText(testPartialSearchTerm);
|
||||
const searchTerms = `${searchInModifier} ${testChannel.name} ${testPartialSearchTerm}`;
|
||||
await searchInput.clearText();
|
||||
await searchInput.replaceText(searchTerms);
|
||||
|
||||
// # Search channel
|
||||
await searchInput.tapReturnKey();
|
||||
await expect(channelMentionSuggestionList).not.toExist();
|
||||
|
||||
// * Verify recent search item is displayed
|
||||
const searchTerms = `${searchInModifier} ${testChannel.name} ${testPartialSearchTerm}`;
|
||||
const {recentSearchItem} = await getRecentSearchItem(searchTerms);
|
||||
await expect(recentSearchItem).toBeVisible();
|
||||
}
|
||||
|
|
@ -296,7 +298,7 @@ async function postMessageAndSearchText(testMessage, testPartialSearchTerm) {
|
|||
|
||||
// # Type beginning of search term
|
||||
await searchInput.clearText();
|
||||
await searchInput.typeText(testPartialSearchTerm);
|
||||
await searchInput.replaceText(testPartialSearchTerm);
|
||||
|
||||
// # Search text
|
||||
await searchInput.tapReturnKey();
|
||||
|
|
|
|||
Loading…
Reference in a new issue