This commit is contained in:
Anant Bhasin 2021-07-16 02:29:16 +05:30
parent 4cc3d8a26b
commit 047d4e5889
18 changed files with 155 additions and 136 deletions

View File

@ -38,7 +38,7 @@ async function login(username, password) {
async function logout() { async function logout() {
const deviceType = device.getPlatform(); const deviceType = device.getPlatform();
const { scrollViewType } = platformTypes[deviceType]; const { scrollViewType } = platformTypes[deviceType];
await element(by.id('rooms-list-view-sidebar')).tap(); await element(by.id('rooms-list-view-sidebar')).tap();
await waitFor(element(by.id('sidebar-view'))).toBeVisible().withTimeout(2000); await waitFor(element(by.id('sidebar-view'))).toBeVisible().withTimeout(2000);
await waitFor(element(by.id('sidebar-settings'))).toBeVisible().withTimeout(2000); await waitFor(element(by.id('sidebar-settings'))).toBeVisible().withTimeout(2000);
@ -60,48 +60,48 @@ async function mockMessage(message, isThread = false) {
await element(by.id(input)).typeText(`${ data.random }${ message }`); await element(by.id(input)).typeText(`${ data.random }${ message }`);
await element(by.id('messagebox-send-message')).tap(); await element(by.id('messagebox-send-message')).tap();
await waitFor(element(by.text(`${ data.random }${ message }`))).toExist().withTimeout(60000); await waitFor(element(by.text(`${ data.random }${ message }`))).toExist().withTimeout(60000);
await expect(element(by.text(`${ data.random }${ message }`))).toExist(); await expect(element(by.text(`${ data.random }${ message }`))).toExist();
await element(by.text(`${ data.random }${ message }`)).atIndex(0).tap(); await element(by.text(`${ data.random }${ message }`)).atIndex(0).tap();
};
async function starMessage(message){
const messageLabel = `${ data.random }${ message }`
await element(by.text(messageLabel)).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
await element(by.text('Star')).atIndex(0).tap();
await waitFor(element(by.id('action-sheet'))).not.toExist().withTimeout(5000);
};
async function pinMessage(message){
const messageLabel = `${ data.random }${ message }`
await waitFor(element(by.text(messageLabel)).atIndex(0)).toExist();
await element(by.text(messageLabel)).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
await element(by.text('Pin')).atIndex(0).tap();
await waitFor(element(by.id('action-sheet'))).not.toExist().withTimeout(5000);
} }
async function dismissReviewNag(){ async function starMessage(message) {
const deviceType = device.getPlatform(); const messageLabel = `${ data.random }${ message }`;
const { alertButtonType } = platformTypes[deviceType]; await element(by.text(messageLabel)).atIndex(0).longPress();
await waitFor(element(by.text('Are you enjoying this app?'))).toExist().withTimeout(60000); await expect(element(by.id('action-sheet'))).toExist();
await element(by.text('NO').and(by.type(alertButtonType))).tap(); // Tap `no` on ask for review alert await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
await element(by.text('Star')).atIndex(0).tap();
await waitFor(element(by.id('action-sheet'))).not.toExist().withTimeout(5000);
}
async function pinMessage(message) {
const messageLabel = `${ data.random }${ message }`;
await waitFor(element(by.text(messageLabel)).atIndex(0)).toExist();
await element(by.text(messageLabel)).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
await element(by.text('Pin')).atIndex(0).tap();
await waitFor(element(by.id('action-sheet'))).not.toExist().withTimeout(5000);
}
async function dismissReviewNag() {
const deviceType = device.getPlatform();
const { alertButtonType } = platformTypes[deviceType];
await waitFor(element(by.text('Are you enjoying this app?'))).toExist().withTimeout(60000);
await element(by.text('NO').and(by.type(alertButtonType))).tap(); // Tap `no` on ask for review alert
} }
async function mockMessageWithNag(message, isThread = false) { async function mockMessageWithNag(message, isThread = false) {
let input = isThread ? 'messagebox-input-thread' : 'messagebox-input'; const input = isThread ? 'messagebox-input-thread' : 'messagebox-input';
await element(by.id(input)).tap(); await element(by.id(input)).tap();
await element(by.id(input)).typeText(`${ data.random }${ message }`); await element(by.id(input)).typeText(`${ data.random }${ message }`);
await element(by.id('messagebox-send-message')).tap(); await element(by.id('messagebox-send-message')).tap();
await dismissReviewNag(); await dismissReviewNag();
await waitFor(element(by.text(`${ data.random }${ message }`))).toExist().withTimeout(60000); await waitFor(element(by.text(`${ data.random }${ message }`))).toExist().withTimeout(60000);
await expect(element(by.text(`${ data.random }${ message }`))).toExist(); await expect(element(by.text(`${ data.random }${ message }`))).toExist();
await element(by.text(`${ data.random }${ message }`)).atIndex(0).tap(); await element(by.text(`${ data.random }${ message }`)).atIndex(0).tap();
}; }
async function tapBack() { async function tapBack() {
await element(by.id('header-back')).atIndex(0).tap(); await element(by.id('header-back')).atIndex(0).tap();
@ -145,25 +145,26 @@ const checkServer = async(server) => {
}; };
async function closeKeyboard() { async function closeKeyboard() {
if(device.getPlatform() === 'android') if (device.getPlatform() === 'android') {
await device.goBack(); await device.goBack();
}
} }
module.exports = { module.exports = {
navigateToWorkspace, navigateToWorkspace,
navigateToLogin, navigateToLogin,
navigateToRegister, navigateToRegister,
login, login,
logout, logout,
mockMessage, mockMessage,
starMessage, starMessage,
pinMessage, pinMessage,
dismissReviewNag, dismissReviewNag,
tapBack, tapBack,
sleep, sleep,
searchRoom, searchRoom,
tryTapping, tryTapping,
checkServer, checkServer,
closeKeyboard, closeKeyboard,
mockMessageWithNag mockMessageWithNag
}; };

View File

@ -5,51 +5,48 @@ const { sleep } = require('./app');
const defaultLaunchArgs = { permissions: { notifications: 'YES' } }; const defaultLaunchArgs = { permissions: { notifications: 'YES' } };
function runCommand(command) { function runCommand(command) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
exec(command, (error, stdout, stderr) => { exec(command, (error, stdout, stderr) => {
if(error) if (error) {
{ reject(new Error(`exec error: ${ stderr }`));
reject(new Error(`exec error: ${stderr}`)); return;
return; }
} resolve();
resolve(); });
}) });
});
} }
// The Spell Checker and the autofill service introduce additional flakiness, and appear over other elements. // The Spell Checker and the autofill service introduce additional flakiness, and appear over other elements.
// So, we disable them before running the tests. // So, we disable them before running the tests.
exports.prepareAndroid = async () => { exports.prepareAndroid = async() => {
if(device.getPlatform() !== 'android') return; if (device.getPlatform() !== 'android') {
await runCommand('adb shell settings put secure spell_checker_enabled 0'); return;
await runCommand('adb shell settings put secure autofill_service null'); }
} await runCommand('adb shell settings put secure spell_checker_enabled 0');
await runCommand('adb shell settings put secure autofill_service null');
};
exports.launchWithLanguage = async (language, countryCode="US", launchArgs=defaultLaunchArgs) => { exports.launchWithLanguage = async(language, countryCode = 'US', launchArgs = defaultLaunchArgs) => {
if(device.id === undefined) if (device.id === undefined) {
{ await device.launchApp(launchArgs);
await device.launchApp(launchArgs); }
} if (device.getPlatform() === 'android') {
if(device.getPlatform() === 'android') await runCommand('adb root');
{ await runCommand(`adb shell "setprop persist.sys.locale ${ language }-${ countryCode }; setprop ctl.restart zygote"`);
await runCommand('adb root'); await sleep(20000);
await runCommand(`adb shell "setprop persist.sys.locale ${language}-${countryCode}; setprop ctl.restart zygote"`); await device.launchApp(launchArgs);
await sleep(20000); } else {
await device.launchApp(launchArgs); const langLocale = typeof countryCode === 'string' ? `${ language }-${ countryCode }` : language;
} await device.launchApp({
else ...launchArgs,
{ languageAndLocale: {
const langLocale = typeof countryCode === 'string' ? `${language}-${countryCode}` : language; language: langLocale,
await device.launchApp({ locale: langLocale
...launchArgs, }
languageAndLocale: { });
language: langLocale, }
locale: langLocale };
}
});
}
}
exports.closeKeyboardAndroid = async () => { exports.closeKeyboardAndroid = async() => {
await device.pressBack(); // Android-only await device.pressBack(); // Android-only
} };

View File

@ -1,13 +1,13 @@
exports.android = { exports.android = {
//Android types // Android types
alertButtonType: 'android.widget.Button', alertButtonType: 'android.widget.Button',
scrollViewType: 'android.widget.ScrollView', scrollViewType: 'android.widget.ScrollView',
textInputType: 'android.widget.EditText', textInputType: 'android.widget.EditText'
}; };
exports.ios = { exports.ios = {
//iOS types // iOS types
alertButtonType: '_UIAlertControllerActionView', alertButtonType: '_UIAlertControllerActionView',
scrollViewType: 'UIScrollView', scrollViewType: 'UIScrollView',
textInputType: '_UIAlertControllerTextField' textInputType: '_UIAlertControllerTextField'
}; };

View File

@ -20,7 +20,7 @@ const checkServer = async(server) => {
const checkBanner = async() => { const checkBanner = async() => {
await waitFor(element(by.id('listheader-encryption').withDescendant(by.text('Save Your Encryption Password')))).toBeVisible().withTimeout(10000); await waitFor(element(by.id('listheader-encryption').withDescendant(by.text('Save Your Encryption Password')))).toBeVisible().withTimeout(10000);
} };
async function navigateToRoom(roomName) { async function navigateToRoom(roomName) {
await searchRoom(`${ roomName }`); await searchRoom(`${ roomName }`);
@ -46,7 +46,8 @@ async function navigateSecurityPrivacy() {
describe('E2E Encryption', () => { describe('E2E Encryption', () => {
const room = `encrypted${ data.random }`; const room = `encrypted${ data.random }`;
const newPassword = 'abc'; const newPassword = 'abc';
let alertButtonType, scrollViewType; let alertButtonType;
let scrollViewType;
before(async() => { before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
@ -206,7 +207,7 @@ describe('E2E Encryption', () => {
await waitFor(element(by.id('login-view'))).toBeVisible().withTimeout(2000); await waitFor(element(by.id('login-view'))).toBeVisible().withTimeout(2000);
await login(testuser.username, testuser.password); await login(testuser.username, testuser.password);
await waitFor(element(by.id('listheader-encryption').withDescendant(by.text('Save Your Encryption Password')))).toBeVisible().withTimeout(2000); await waitFor(element(by.id('listheader-encryption').withDescendant(by.text('Save Your Encryption Password')))).toBeVisible().withTimeout(2000);
}) });
}); });
}); });

View File

@ -17,7 +17,8 @@ async function waitForToast() {
} }
describe('Profile screen', () => { describe('Profile screen', () => {
let textInputType, scrollViewType; let textInputType;
let scrollViewType;
before(async() => { before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
@ -94,7 +95,9 @@ describe('Profile screen', () => {
await element(by.id('profile-view-submit')).tap(); await element(by.id('profile-view-submit')).tap();
await element(by.type(textInputType)).typeText(`${ profileChangeUser.password }\n`); await element(by.type(textInputType)).typeText(`${ profileChangeUser.password }\n`);
// TODO: Check if this is fine on iOS // TODO: Check if this is fine on iOS
if(device.getPlatform() === 'android') await element(by.text('SAVE')).tap(); if (device.getPlatform() === 'android') {
await element(by.text('SAVE')).tap();
}
await waitForToast(); await waitForToast();
}); });

View File

@ -70,7 +70,7 @@ describe('Settings screen', () => {
await waitFor(element(by.id('settings-view'))).toBeVisible().withTimeout(2000); await waitFor(element(by.id('settings-view'))).toBeVisible().withTimeout(2000);
await element(by.id('settings-view-clear-cache')).tap(); await element(by.id('settings-view-clear-cache')).tap();
await waitFor(element(by.text('This will clear all your offline data.'))).toExist().withTimeout(2000); await waitFor(element(by.text('This will clear all your offline data.'))).toExist().withTimeout(2000);
await element(by.text('Clear').and(by.type(alertButtonType))).tap(); await element(by.text('Clear').and(by.type(alertButtonType))).tap();
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(5000); await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(5000);
await waitFor(element(by.id(`rooms-list-view-item-${ data.groups.private.name }`))).toExist().withTimeout(10000); await waitFor(element(by.id(`rooms-list-view-item-${ data.groups.private.name }`))).toExist().withTimeout(10000);
}); });

View File

@ -34,7 +34,7 @@ describe('Join public room', () => {
describe('Render', () => { describe('Render', () => {
it('should have room screen', async() => { it('should have room screen', async() => {
await expect(element(by.id('room-view'))).toBeVisible(); await expect(element(by.id('room-view'))).toBeVisible();
}); });
// it('should have messages list', async() => { // it('should have messages list', async() => {
// await expect(element(by.id('room-view-messages'))).toBeVisible(); // await expect(element(by.id('room-view-messages'))).toBeVisible();

View File

@ -1,5 +1,7 @@
const data = require('../../data'); const data = require('../../data');
const { navigateToLogin, login, mockMessage, searchRoom } = require('../../helpers/app'); const {
navigateToLogin, login, mockMessage, searchRoom
} = require('../../helpers/app');
const { prepareAndroid } = require('../../helpers/platformFunctions'); const { prepareAndroid } = require('../../helpers/platformFunctions');
const testuser = data.users.regular; const testuser = data.users.regular;

View File

@ -7,7 +7,8 @@ const platformTypes = require('../../helpers/platformTypes');
const { prepareAndroid } = require('../../helpers/platformFunctions'); const { prepareAndroid } = require('../../helpers/platformFunctions');
describe('Delete server', () => { describe('Delete server', () => {
let scrollViewType, alertButtonType; let scrollViewType;
let alertButtonType;
before(async() => { before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
await prepareAndroid(); await prepareAndroid();
@ -48,7 +49,7 @@ describe('Delete server', () => {
await element(by.id('rooms-list-header-server-dropdown-button')).tap(); await element(by.id('rooms-list-header-server-dropdown-button')).tap();
await waitFor(element(by.id('rooms-list-header-server-dropdown'))).toBeVisible().withTimeout(5000); await waitFor(element(by.id('rooms-list-header-server-dropdown'))).toBeVisible().withTimeout(5000);
await element(by.id(`rooms-list-header-server-${ data.server }`)).longPress(1500); await element(by.id(`rooms-list-header-server-${ data.server }`)).longPress(1500);
await element(by.text('Delete').and(by.type(alertButtonType))).tap(); await element(by.text('Delete').and(by.type(alertButtonType))).tap();
await element(by.id('rooms-list-header-server-dropdown-button')).tap(); await element(by.id('rooms-list-header-server-dropdown-button')).tap();
await waitFor(element(by.id('rooms-list-header-server-dropdown'))).toBeVisible().withTimeout(5000); await waitFor(element(by.id('rooms-list-header-server-dropdown'))).toBeVisible().withTimeout(5000);
await waitFor(element(by.id(`rooms-list-header-server-${ data.server }`))).toBeNotVisible().withTimeout(10000); await waitFor(element(by.id(`rooms-list-header-server-${ data.server }`))).toBeNotVisible().withTimeout(10000);

View File

@ -9,7 +9,7 @@ const DEEPLINK_METHODS = { AUTH: 'auth', ROOM: 'room' };
let amp = '&'; let amp = '&';
const getDeepLink = (method, server, params) => { const getDeepLink = (method, server, params) => {
const deeplink = `rocketchat://${ method }?host=${ server.replace(/^(http:\/\/|https:\/\/)/, '') }${amp}${params}`; const deeplink = `rocketchat://${ method }?host=${ server.replace(/^(http:\/\/|https:\/\/)/, '') }${ amp }${ params }`;
console.log(`Deeplinking to: ${ deeplink }`); console.log(`Deeplinking to: ${ deeplink }`);
return deeplink; return deeplink;
}; };
@ -17,11 +17,13 @@ const getDeepLink = (method, server, params) => {
describe('Deep linking', () => { describe('Deep linking', () => {
let userId; let userId;
let authToken; let authToken;
let scrollViewType;
before(async() => { before(async() => {
const loginResult = await login(data.users.regular.username, data.users.regular.password); const loginResult = await login(data.users.regular.username, data.users.regular.password);
({ userId, authToken } = loginResult); ({ userId, authToken } = loginResult);
const deviceType = device.getPlatform(); const deviceType = device.getPlatform();
amp = deviceType == 'android' ? '\\&' : '&'; amp = deviceType === 'android' ? '\\&' : '&';
({ scrollViewType } = platformTypes[deviceType]); ({ scrollViewType } = platformTypes[deviceType]);
}); });
@ -30,7 +32,7 @@ describe('Deep linking', () => {
await device.launchApp({ await device.launchApp({
permissions: { notifications: 'YES' }, permissions: { notifications: 'YES' },
delete: true, delete: true,
url: getDeepLink(DEEPLINK_METHODS.AUTH, data.server, `userId=123${amp}token=abc`), url: getDeepLink(DEEPLINK_METHODS.AUTH, data.server, `userId=123${ amp }token=abc`)
}); });
await prepareAndroid(); await prepareAndroid();
await waitFor(element(by.text('You\'ve been logged out by the server. Please log in again.'))).toExist().withTimeout(10000); // TODO: we need to improve this message await waitFor(element(by.text('You\'ve been logged out by the server. Please log in again.'))).toExist().withTimeout(10000); // TODO: we need to improve this message
@ -40,7 +42,7 @@ describe('Deep linking', () => {
await device.launchApp({ await device.launchApp({
permissions: { notifications: 'YES' }, permissions: { notifications: 'YES' },
newInstance: true, newInstance: true,
url: getDeepLink(DEEPLINK_METHODS.AUTH, data.server, `userId=${ userId }${amp}token=${ authToken }${amp}path=group/${ data.groups.private.name }`), url: getDeepLink(DEEPLINK_METHODS.AUTH, data.server, `userId=${ userId }${ amp }token=${ authToken }${ amp }path=group/${ data.groups.private.name }`)
}); });
await waitFor(element(by.id(`room-view-title-${ data.groups.private.name }`))).toExist().withTimeout(30000); await waitFor(element(by.id(`room-view-title-${ data.groups.private.name }`))).toExist().withTimeout(30000);
await tapBack(); await tapBack();
@ -74,7 +76,7 @@ describe('Deep linking', () => {
await device.launchApp({ await device.launchApp({
permissions: { notifications: 'YES' }, permissions: { notifications: 'YES' },
newInstance: true, newInstance: true,
url: getDeepLink(DEEPLINK_METHODS.ROOM, data.server, `path=group/${ data.groups.private.name }`), url: getDeepLink(DEEPLINK_METHODS.ROOM, data.server, `path=group/${ data.groups.private.name }`)
}); });
await waitFor(element(by.id(`room-view-title-${ data.groups.private.name }`))).toExist().withTimeout(10000); await waitFor(element(by.id(`room-view-title-${ data.groups.private.name }`))).toExist().withTimeout(10000);
@ -85,7 +87,7 @@ describe('Deep linking', () => {
await device.launchApp({ await device.launchApp({
permissions: { notifications: 'YES' }, permissions: { notifications: 'YES' },
newInstance: true, newInstance: true,
url: getDeepLink(DEEPLINK_METHODS.ROOM, data.server, `rid=${ roomResult.data.group._id }`), url: getDeepLink(DEEPLINK_METHODS.ROOM, data.server, `rid=${ roomResult.data.group._id }`)
}); });
await waitFor(element(by.id(`room-view-title-${ data.groups.private.name }`))).toExist().withTimeout(15000); await waitFor(element(by.id(`room-view-title-${ data.groups.private.name }`))).toExist().withTimeout(15000);
@ -104,7 +106,7 @@ describe('Deep linking', () => {
await device.launchApp({ await device.launchApp({
permissions: { notifications: 'YES' }, permissions: { notifications: 'YES' },
newInstance: true, newInstance: true,
url: getDeepLink(DEEPLINK_METHODS.ROOM, data.server, `path=group/${ data.groups.private.name }`), url: getDeepLink(DEEPLINK_METHODS.ROOM, data.server, `path=group/${ data.groups.private.name }`)
}); });
await waitFor(element(by.id(`room-view-title-${ data.groups.private.name }`))).toExist().withTimeout(10000); await waitFor(element(by.id(`room-view-title-${ data.groups.private.name }`))).toExist().withTimeout(10000);
@ -114,7 +116,7 @@ describe('Deep linking', () => {
await device.launchApp({ await device.launchApp({
permissions: { notifications: 'YES' }, permissions: { notifications: 'YES' },
newInstance: true, newInstance: true,
url: getDeepLink(DEEPLINK_METHODS.ROOM, 'https://google.com'), url: getDeepLink(DEEPLINK_METHODS.ROOM, 'https://google.com')
}); });
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000); await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);

View File

@ -19,13 +19,15 @@ const navToLanguage = async() => {
}; };
describe('i18n', () => { describe('i18n', () => {
before(async () => { before(async() => {
await prepareAndroid(); await prepareAndroid();
}); });
describe('OS language', () => { describe('OS language', () => {
it('OS set to \'en\' and proper translate to \'en\'', async() => { it('OS set to \'en\' and proper translate to \'en\'', async() => {
if(device.getPlatform() === "android") return; // Not run on android if (device.getPlatform() === 'android') {
return;
}
await device.launchApp({ await device.launchApp({
...defaultLaunchArgs, ...defaultLaunchArgs,
languageAndLocale: { languageAndLocale: {
@ -40,7 +42,9 @@ describe('i18n', () => {
}); });
it('OS set to unavailable language and fallback to \'en\'', async() => { it('OS set to unavailable language and fallback to \'en\'', async() => {
if(device.getPlatform() === "android") return; // Not run on android if (device.getPlatform() === 'android') {
return;
}
await device.launchApp({ await device.launchApp({
...defaultLaunchArgs, ...defaultLaunchArgs,
languageAndLocale: { languageAndLocale: {

View File

@ -1,7 +1,9 @@
const { const {
device, expect, element, by, waitFor device, expect, element, by, waitFor
} = require('detox'); } = require('detox');
const { login, navigateToLogin, logout, tapBack, searchRoom } = require('../../helpers/app'); const {
login, navigateToLogin, logout, tapBack, searchRoom
} = require('../../helpers/app');
const { prepareAndroid } = require('../../helpers/platformFunctions'); const { prepareAndroid } = require('../../helpers/platformFunctions');
const data = require('../../data'); const data = require('../../data');

View File

@ -1,7 +1,9 @@
const { const {
device, expect, element, by, waitFor device, expect, element, by, waitFor
} = require('detox'); } = require('detox');
const { login, navigateToLogin, logout, tapBack } = require('../../helpers/app'); const {
login, navigateToLogin, logout, tapBack
} = require('../../helpers/app');
const { prepareAndroid } = require('../../helpers/platformFunctions'); const { prepareAndroid } = require('../../helpers/platformFunctions');
const data = require('../../data'); const data = require('../../data');

View File

@ -1,5 +1,7 @@
const data = require('../../data'); const data = require('../../data');
const { tapBack, navigateToLogin, login, tryTapping } = require('../../helpers/app'); const {
tapBack, navigateToLogin, login, tryTapping
} = require('../../helpers/app');
const { prepareAndroid } = require('../../helpers/platformFunctions'); const { prepareAndroid } = require('../../helpers/platformFunctions');

View File

@ -187,7 +187,7 @@ describe('Room screen', () => {
it('should star message', async() => { it('should star message', async() => {
await starMessage('message'); await starMessage('message');
await sleep(1000); //https://github.com/RocketChat/Rocket.Chat.ReactNative/issues/2324 await sleep(1000); // https://github.com/RocketChat/Rocket.Chat.ReactNative/issues/2324
await element(by.text(`${ data.random }message`)).atIndex(0).longPress(); await element(by.text(`${ data.random }message`)).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist(); await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible(); await expect(element(by.id('action-sheet-handle'))).toBeVisible();

View File

@ -1,7 +1,9 @@
const data = require('../../data'); const data = require('../../data');
const { navigateToLogin, login, tapBack, sleep, searchRoom, mockMessage, starMessage, pinMessage } = require('../../helpers/app'); const {
navigateToLogin, login, tapBack, sleep, searchRoom, mockMessage, starMessage, pinMessage
} = require('../../helpers/app');
const { prepareAndroid } = require('../../helpers/platformFunctions'); const { prepareAndroid } = require('../../helpers/platformFunctions');
const { sendMessage } = require('../../helpers/data_setup') const { sendMessage } = require('../../helpers/data_setup');
const platformTypes = require('../../helpers/platformTypes'); const platformTypes = require('../../helpers/platformTypes');
@ -213,14 +215,14 @@ describe('Room actions screen', () => {
await element(by.id('room-header')).tap(); await element(by.id('room-header')).tap();
await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000); await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000);
//Go to starred messages // Go to starred messages
await element(by.id('room-actions-view')).swipe('up'); await element(by.id('room-actions-view')).swipe('up');
await waitFor(element(by.id('room-actions-starred'))).toExist(); await waitFor(element(by.id('room-actions-starred'))).toExist();
await element(by.id('room-actions-starred')).tap(); await element(by.id('room-actions-starred')).tap();
await waitFor(element(by.id('starred-messages-view'))).toExist().withTimeout(2000); await waitFor(element(by.id('starred-messages-view'))).toExist().withTimeout(2000);
await waitFor(element(by.text(`${ data.random }messageToStar`).withAncestor(by.id('starred-messages-view')))).toExist().withTimeout(60000); await waitFor(element(by.text(`${ data.random }messageToStar`).withAncestor(by.id('starred-messages-view')))).toExist().withTimeout(60000);
//Unstar message // Unstar message
await element(by.text(`${ data.random }messageToStar`)).atIndex(0).longPress(); await element(by.text(`${ data.random }messageToStar`)).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist(); await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible(); await expect(element(by.id('action-sheet-handle'))).toBeVisible();

View File

@ -15,7 +15,7 @@ const navigateToRoom = async() => {
describe('Discussion', () => { describe('Discussion', () => {
let scrollViewType; let scrollViewType;
before(async() => { before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, newInstance: true, delete: true }); await device.launchApp({ permissions: { notifications: 'YES' }, newInstance: true, delete: true });
await prepareAndroid(); await prepareAndroid();
@ -68,7 +68,7 @@ describe('Discussion', () => {
const discussionName = `${ data.random }message`; const discussionName = `${ data.random }message`;
await element(by.text(discussionName)).atIndex(0).longPress(); await element(by.text(discussionName)).atIndex(0).longPress();
await waitFor(element(by.id('action-sheet'))).toExist().withTimeout(2000); await waitFor(element(by.id('action-sheet'))).toExist().withTimeout(2000);
await element(by.text(`Start a Discussion`)).atIndex(0).tap(); await element(by.text('Start a Discussion')).atIndex(0).tap();
await waitFor(element(by.id('create-discussion-view'))).toExist().withTimeout(2000); await waitFor(element(by.id('create-discussion-view'))).toExist().withTimeout(2000);
await element(by.id('create-discussion-submit')).tap(); await element(by.id('create-discussion-submit')).tap();
await waitFor(element(by.id('room-view'))).toExist().withTimeout(10000); await waitFor(element(by.id('room-view'))).toExist().withTimeout(10000);

View File

@ -3,7 +3,7 @@ const {
navigateToLogin, login, searchRoom, sleep navigateToLogin, login, searchRoom, sleep
} = require('../../helpers/app'); } = require('../../helpers/app');
const { prepareAndroid } = require('../../helpers/platformFunctions'); const { prepareAndroid } = require('../../helpers/platformFunctions');
const { sendMessage } = require('../../helpers/data_setup') const { sendMessage } = require('../../helpers/data_setup');
async function navigateToRoom(user) { async function navigateToRoom(user) {
await searchRoom(`${ user }`); await searchRoom(`${ user }`);