Merge branch 'detoxRunner' of https://github.com/aKn1ghtOut/Rocket.Chat.ReactNative into circleciForDetoxAndroid
This commit is contained in:
commit
beadac063c
|
@ -1,8 +1,24 @@
|
|||
const {
|
||||
expect, element, by, waitFor
|
||||
} = require('detox');
|
||||
const { exec } = require('child_process');
|
||||
const data = require('../data');
|
||||
const platformTypes = require('./platformTypes');
|
||||
|
||||
const platformTypes = {
|
||||
android: {
|
||||
// Android types
|
||||
alertButtonType: 'android.widget.Button',
|
||||
scrollViewType: 'android.widget.ScrollView',
|
||||
textInputType: 'android.widget.EditText'
|
||||
},
|
||||
ios: {
|
||||
// iOS types
|
||||
alertButtonType: '_UIAlertControllerActionView',
|
||||
scrollViewType: 'UIScrollView',
|
||||
textInputType: '_UIAlertControllerTextField'
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
async function navigateToWorkspace(server = data.server) {
|
||||
await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(10000);
|
||||
|
@ -145,6 +161,29 @@ const checkServer = async(server) => {
|
|||
await element(by.id('sidebar-close-drawer')).tap();
|
||||
};
|
||||
|
||||
function runCommand(command) {
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(command, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
reject(new Error(`exec error: ${ stderr }`));
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function prepareAndroid() {
|
||||
if (device.getPlatform() !== 'android') {
|
||||
return;
|
||||
}
|
||||
await runCommand('adb shell settings put secure spell_checker_enabled 0');
|
||||
await runCommand('adb shell settings put secure autofill_service null');
|
||||
await runCommand('adb shell settings put global window_animation_scale 0.0');
|
||||
await runCommand('adb shell settings put global transition_animation_scale 0.0');
|
||||
await runCommand('adb shell settings put global animator_duration_scale 0.0');
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
navigateToWorkspace,
|
||||
navigateToLogin,
|
||||
|
@ -160,5 +199,7 @@ module.exports = {
|
|||
searchRoom,
|
||||
tryTapping,
|
||||
checkServer,
|
||||
mockMessageWithNag
|
||||
mockMessageWithNag,
|
||||
platformTypes,
|
||||
prepareAndroid
|
||||
};
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
const { exec } = require('child_process');
|
||||
const { device } = require('detox');
|
||||
|
||||
function runCommand(command) {
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(command, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
reject(new Error(`exec error: ${ stderr }`));
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// The Spell Checker and the autofill service introduce additional flakiness, and appear over other elements.
|
||||
// So, we disable them before running the tests.
|
||||
exports.prepareAndroid = async() => {
|
||||
if (device.getPlatform() !== 'android') {
|
||||
return;
|
||||
}
|
||||
await runCommand('adb shell settings put secure spell_checker_enabled 0');
|
||||
await runCommand('adb shell settings put secure autofill_service null');
|
||||
await runCommand('adb shell settings put global window_animation_scale 0.0');
|
||||
await runCommand('adb shell settings put global transition_animation_scale 0.0');
|
||||
await runCommand('adb shell settings put global animator_duration_scale 0.0');
|
||||
};
|
||||
|
||||
exports.closeKeyboardAndroid = async() => {
|
||||
await device.pressBack(); // Android-only
|
||||
};
|
|
@ -1,13 +0,0 @@
|
|||
exports.android = {
|
||||
// Android types
|
||||
alertButtonType: 'android.widget.Button',
|
||||
scrollViewType: 'android.widget.ScrollView',
|
||||
textInputType: 'android.widget.EditText'
|
||||
};
|
||||
|
||||
exports.ios = {
|
||||
// iOS types
|
||||
alertButtonType: '_UIAlertControllerActionView',
|
||||
scrollViewType: 'UIScrollView',
|
||||
textInputType: '_UIAlertControllerTextField'
|
||||
};
|
|
@ -1,9 +1,7 @@
|
|||
const {
|
||||
navigateToLogin, login, sleep, tapBack, mockMessage, searchRoom, logout
|
||||
navigateToLogin, login, sleep, tapBack, mockMessage, searchRoom, logout, platformTypes
|
||||
} = require('../../helpers/app');
|
||||
|
||||
const platformTypes = require('../../helpers/platformTypes');
|
||||
|
||||
const data = require('../../data');
|
||||
|
||||
const testuser = data.users.regular;
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
const { navigateToLogin, login, sleep } = require('../../helpers/app');
|
||||
const {
|
||||
navigateToLogin,
|
||||
login,
|
||||
sleep,
|
||||
platformTypes
|
||||
} = require('../../helpers/app');
|
||||
const data = require('../../data');
|
||||
|
||||
const platformTypes = require('../../helpers/platformTypes');
|
||||
|
||||
const profileChangeUser = data.users.profileChanges;
|
||||
|
||||
const scrollDown = 200;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
const { navigateToLogin, login } = require('../../helpers/app');
|
||||
const { navigateToLogin, login, platformTypes } = require('../../helpers/app');
|
||||
|
||||
const platformTypes = require('../../helpers/platformTypes');
|
||||
|
||||
const data = require('../../data');
|
||||
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
const data = require('../../data');
|
||||
const {
|
||||
navigateToLogin, login, mockMessage, tapBack, searchRoom
|
||||
navigateToLogin, login, mockMessage, tapBack, searchRoom, platformTypes
|
||||
} = require('../../helpers/app');
|
||||
|
||||
const platformTypes = require('../../helpers/platformTypes');
|
||||
|
||||
const testuser = data.users.regular;
|
||||
const room = data.channels.detoxpublic.name;
|
||||
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
const data = require('../../data');
|
||||
const {
|
||||
sleep, navigateToLogin, login, checkServer
|
||||
sleep, navigateToLogin, login, checkServer, platformTypes
|
||||
} = require('../../helpers/app');
|
||||
|
||||
const platformTypes = require('../../helpers/platformTypes');
|
||||
|
||||
describe('Delete server', () => {
|
||||
let scrollViewType;
|
||||
let alertButtonType;
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
const data = require('../../data');
|
||||
const { tapBack, checkServer, navigateToRegister } = require('../../helpers/app');
|
||||
const {
|
||||
tapBack,
|
||||
checkServer,
|
||||
navigateToRegister,
|
||||
platformTypes
|
||||
} = require('../../helpers/app');
|
||||
const { get, login } = require('../../helpers/data_setup');
|
||||
const platformTypes = require('../../helpers/platformTypes');
|
||||
|
||||
const DEEPLINK_METHODS = { AUTH: 'auth', ROOM: 'room' };
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ describe('i18n', () => {
|
|||
describe('OS language', () => {
|
||||
it('OS set to \'en\' and proper translate to \'en\'', async() => {
|
||||
if (device.getPlatform() === 'android') {
|
||||
return;
|
||||
return; // FIXME: Passing language with launch parameters doesn't work with Android
|
||||
}
|
||||
await device.launchApp({
|
||||
...defaultLaunchArgs,
|
||||
|
@ -41,7 +41,7 @@ describe('i18n', () => {
|
|||
|
||||
it('OS set to unavailable language and fallback to \'en\'', async() => {
|
||||
if (device.getPlatform() === 'android') {
|
||||
return;
|
||||
return; // FIXME: Passing language with launch parameters doesn't work with Android
|
||||
}
|
||||
await device.launchApp({
|
||||
...defaultLaunchArgs,
|
||||
|
|
|
@ -2,7 +2,7 @@ const detox = require('detox');
|
|||
const adapter = require('detox/runners/mocha/adapter');
|
||||
const config = require('../../package.json').detox;
|
||||
const { setup } = require('../helpers/data_setup');
|
||||
const { prepareAndroid } = require('../helpers/platformFunctions');
|
||||
const { prepareAndroid } = require('../helpers/app');
|
||||
|
||||
before(async() => {
|
||||
await Promise.all([setup(), detox.init(config, { launchApp: false })]);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const data = require('../../data');
|
||||
const {
|
||||
navigateToLogin, login, mockMessage, tapBack, sleep, searchRoom, starMessage, pinMessage, dismissReviewNag, tryTapping
|
||||
navigateToLogin, login, mockMessage, tapBack, sleep, searchRoom, starMessage, pinMessage, dismissReviewNag, tryTapping, mockMessageWithNag
|
||||
} = require('../../helpers/app');
|
||||
|
||||
async function navigateToRoom(roomName) {
|
||||
|
@ -69,21 +69,24 @@ describe('Room screen', () => {
|
|||
await expect(element(by.text(`${ data.random }message`)).atIndex(0)).toExist();
|
||||
});
|
||||
|
||||
|
||||
it('should show/hide emoji keyboard', async() => {
|
||||
if (device.getPlatform() === 'android') {
|
||||
await element(by.id('messagebox-open-emoji')).tap();
|
||||
await waitFor(element(by.id('messagebox-keyboard-emoji'))).toExist().withTimeout(10000);
|
||||
await expect(element(by.id('messagebox-close-emoji'))).toExist();
|
||||
await expect(element(by.id('messagebox-open-emoji'))).toBeNotVisible();
|
||||
await element(by.id('messagebox-close-emoji')).tap();
|
||||
await waitFor(element(by.id('messagebox-keyboard-emoji'))).toBeNotVisible().withTimeout(10000);
|
||||
await expect(element(by.id('messagebox-close-emoji'))).toBeNotVisible();
|
||||
await expect(element(by.id('messagebox-open-emoji'))).toExist();
|
||||
}
|
||||
});
|
||||
// FIXME: Detox tests halt on android while rendering GIFs
|
||||
// it('should show/hide emoji keyboard', async() => {
|
||||
// if (device.getPlatform() === 'android') {
|
||||
// await element(by.id('messagebox-open-emoji')).tap();
|
||||
// await waitFor(element(by.id('messagebox-keyboard-emoji'))).toExist().withTimeout(10000);
|
||||
// await expect(element(by.id('messagebox-close-emoji'))).toExist();
|
||||
// await expect(element(by.id('messagebox-open-emoji'))).toBeNotVisible();
|
||||
// await element(by.id('messagebox-close-emoji')).tap();
|
||||
// await waitFor(element(by.id('messagebox-keyboard-emoji'))).toBeNotVisible().withTimeout(10000);
|
||||
// await expect(element(by.id('messagebox-close-emoji'))).toBeNotVisible();
|
||||
// await expect(element(by.id('messagebox-open-emoji'))).toExist();
|
||||
// }
|
||||
// });
|
||||
|
||||
it('should show/hide emoji autocomplete', async() => {
|
||||
if (device.getPlatform() === 'android') {
|
||||
return; // FIXME: Detox tests halt on android while rendering GIFs
|
||||
}
|
||||
await element(by.id('messagebox-input')).tap();
|
||||
await element(by.id('messagebox-input')).typeText(':joy');
|
||||
await waitFor(element(by.id('messagebox-container'))).toExist().withTimeout(10000);
|
||||
|
@ -92,6 +95,9 @@ describe('Room screen', () => {
|
|||
});
|
||||
|
||||
it('should show and tap on emoji autocomplete', async() => {
|
||||
if (device.getPlatform() === 'android') {
|
||||
return; // FIXME: Detox tests halt on android while rendering GIFs
|
||||
}
|
||||
await element(by.id('messagebox-input')).tap();
|
||||
await element(by.id('messagebox-input')).typeText(':');
|
||||
await element(by.id('messagebox-input')).typeText('joy'); // workaround for number keyboard
|
||||
|
@ -195,6 +201,9 @@ describe('Room screen', () => {
|
|||
});
|
||||
|
||||
it('should react to message', async() => {
|
||||
if (device.getPlatform() === 'android') {
|
||||
return; // FIXME: Detox tests halt on android while rendering GIFs
|
||||
}
|
||||
await waitFor(element(by.id('action-sheet-handle'))).toBeNotVisible();
|
||||
await sleep(300);
|
||||
await element(by.text(`${ data.random }message`)).atIndex(0).longPress();
|
||||
|
@ -210,6 +219,9 @@ describe('Room screen', () => {
|
|||
});
|
||||
|
||||
it('should react to message with frequently used emoji', async() => {
|
||||
if (device.getPlatform() === 'android') {
|
||||
return; // FIXME: Detox tests halt on android while rendering GIFs
|
||||
}
|
||||
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-handle'))).toBeVisible();
|
||||
|
@ -220,6 +232,9 @@ describe('Room screen', () => {
|
|||
});
|
||||
|
||||
it('should show reaction picker on add reaction button pressed and have frequently used emoji, and dismiss review nag', async() => {
|
||||
if (device.getPlatform() === 'android') {
|
||||
return; // FIXME: Detox tests halt on android while rendering GIFs
|
||||
}
|
||||
await element(by.id('message-add-reaction')).tap();
|
||||
await waitFor(element(by.id('reaction-picker'))).toExist().withTimeout(2000);
|
||||
await waitFor(element(by.id('reaction-picker-grinning'))).toExist().withTimeout(2000);
|
||||
|
@ -236,13 +251,16 @@ describe('Room screen', () => {
|
|||
// Moved in previous test because toExist doesn't detect element while review popup covers it, on Android
|
||||
|
||||
it('should remove reaction', async() => {
|
||||
if (device.getPlatform() === 'android') {
|
||||
return; // FIXME: Detox tests halt on android while rendering GIFs
|
||||
}
|
||||
await element(by.id('message-reaction-:grinning:')).tap();
|
||||
await waitFor(element(by.id('message-reaction-:grinning:'))).toBeNotVisible().withTimeout(60000);
|
||||
});
|
||||
|
||||
it('should edit message', async() => {
|
||||
if (device.getPlatform() === 'android') {
|
||||
return; // Failing on android
|
||||
return; // FIXME: Failing on android
|
||||
}
|
||||
await mockMessage('edit');
|
||||
await element(by.text(`${ data.random }edit`)).atIndex(0).longPress();
|
||||
|
@ -270,7 +288,7 @@ describe('Room screen', () => {
|
|||
|
||||
it('should pin message', async() => {
|
||||
if (device.getPlatform() === 'android') {
|
||||
return; // Failing on android
|
||||
return; // FIXME: Failing on android
|
||||
}
|
||||
await mockMessage('pin');
|
||||
await pinMessage('pin');
|
||||
|
@ -286,7 +304,7 @@ describe('Room screen', () => {
|
|||
});
|
||||
|
||||
it('should delete message', async() => {
|
||||
await mockMessage('delete');
|
||||
await mockMessageWithNag('delete');
|
||||
|
||||
await waitFor(element(by.text(`${ data.random }delete`)).atIndex(0)).toBeVisible();
|
||||
await element(by.text(`${ data.random }delete`)).atIndex(0).longPress();
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
const data = require('../../data');
|
||||
const {
|
||||
navigateToLogin, login, tapBack, sleep, searchRoom, mockMessage, starMessage, pinMessage
|
||||
navigateToLogin, login, tapBack, sleep, searchRoom, mockMessage, starMessage, pinMessage, platformTypes
|
||||
} = require('../../helpers/app');
|
||||
const { sendMessage } = require('../../helpers/data_setup');
|
||||
|
||||
const platformTypes = require('../../helpers/platformTypes');
|
||||
|
||||
async function navigateToRoomActions(type) {
|
||||
let room;
|
||||
if (type === 'd') {
|
||||
|
@ -232,7 +230,7 @@ describe('Room actions screen', () => {
|
|||
|
||||
it('should show pinned message and unpin it', async() => {
|
||||
if (device.getPlatform() === 'android') {
|
||||
return; // Failing on android
|
||||
return; // FIXME: Failing on android
|
||||
}
|
||||
// Go back to room and send a message
|
||||
await tapBack();
|
||||
|
@ -376,11 +374,19 @@ describe('Room actions screen', () => {
|
|||
|
||||
const openActionSheet = async(username) => {
|
||||
await waitFor(element(by.id(`room-members-view-item-${ username }`))).toExist().withTimeout(5000);
|
||||
await element(by.id(`room-members-view-item-${ username }`)).tap();
|
||||
await sleep(300);
|
||||
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');
|
||||
let n = 0;
|
||||
while (n < 3) {
|
||||
// Max tries three times, in case it does not register the click
|
||||
try {
|
||||
await element(by.id(`room-members-view-item-${ username }`)).tap();
|
||||
await waitFor(element(by.id('action-sheet'))).toExist().withTimeout(5000);
|
||||
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
||||
await element(by.id('action-sheet-handle')).swipe('up');
|
||||
return;
|
||||
} catch (e) {
|
||||
n += 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const closeActionSheet = async() => {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
const data = require('../../data');
|
||||
const {
|
||||
navigateToLogin, tapBack, login, searchRoom, sleep
|
||||
navigateToLogin, tapBack, login, searchRoom, sleep, platformTypes
|
||||
} = require('../../helpers/app');
|
||||
const platformTypes = require('../../helpers/platformTypes');
|
||||
|
||||
async function navigateToRoom(roomName) {
|
||||
await searchRoom(`${ roomName }`);
|
||||
|
@ -29,7 +28,7 @@ async function clearCache() {
|
|||
async function waitForLoading() {
|
||||
if (device.getPlatform() === 'android') {
|
||||
await sleep(10000);
|
||||
return;
|
||||
return; // Loading indicator doesn't animate properly on android
|
||||
}
|
||||
await waitFor(element(by.id('loading'))).toBeVisible().withTimeout(5000); // Fails on Android
|
||||
await waitFor(element(by.id('loading'))).toBeNotVisible().withTimeout(10000);
|
||||
|
@ -56,7 +55,7 @@ describe('Room', () => {
|
|||
|
||||
it('should tap FAB and scroll to bottom', async() => {
|
||||
if (device.getPlatform() === 'android') {
|
||||
return;
|
||||
return; // 'Room' tests don't work well on Android currently
|
||||
}
|
||||
await waitFor(element(by.id('nav-jump-to-bottom'))).toExist().withTimeout(5000);
|
||||
await element(by.id('nav-jump-to-bottom')).tap();
|
||||
|
@ -66,7 +65,7 @@ describe('Room', () => {
|
|||
|
||||
it('should load messages on scroll', async() => {
|
||||
if (device.getPlatform() === 'android') {
|
||||
return;
|
||||
return; // 'Room' tests don't work well on Android currently
|
||||
}
|
||||
await navigateToRoom('jumping');
|
||||
await waitFor(element(by.id('room-view-messages'))).toExist().withTimeout(5000);
|
||||
|
@ -86,7 +85,7 @@ describe('Room', () => {
|
|||
|
||||
it('should search for old message and load its surroundings', async() => {
|
||||
if (device.getPlatform() === 'android') {
|
||||
return;
|
||||
return; // 'Room' tests don't work well on Android currently
|
||||
}
|
||||
await navigateToRoom('jumping');
|
||||
await element(by.id('room-view-search')).tap();
|
||||
|
@ -103,7 +102,7 @@ describe('Room', () => {
|
|||
|
||||
it('should load newer and older messages', async() => {
|
||||
if (device.getPlatform() === 'android') {
|
||||
return;
|
||||
return; // 'Room' tests don't work well on Android currently
|
||||
}
|
||||
await element(by.id('room-view-messages')).atIndex(0).swipe('down', 'fast', 0.8);
|
||||
await waitFor(element(by.text('5'))).toExist().withTimeout(10000);
|
||||
|
|
|
@ -63,7 +63,7 @@ describe('Create team screen', () => {
|
|||
|
||||
it('should delete team', async() => {
|
||||
if (device.getPlatform() === 'android') {
|
||||
return; // Failing on android
|
||||
return; // FIXME: Failing on android
|
||||
}
|
||||
await element(by.id('room-info-view-edit-button')).tap();
|
||||
await element(by.id('room-info-edit-view-list')).swipe('up', 'fast', 0.5);
|
||||
|
|
Loading…
Reference in New Issue