Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/containers/MessageBox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ class MessageBox extends Component {
recording, showEmojiKeyboard, showSend, mentions, trackingType, commandPreview, showCommandPreview
} = this.state;
const {
editing, message, replying, replyCancel, user, getCustomEmoji, theme, Message_AudioRecorderEnabled, children, isActionsEnabled
editing, message, replying, replyCancel, user, getCustomEmoji, theme, Message_AudioRecorderEnabled, children, isActionsEnabled, tmid
} = this.props;

const isAndroidTablet = isTablet && isAndroid ? {
Expand Down Expand Up @@ -936,7 +936,7 @@ class MessageBox extends Component {
underlineColorAndroid='transparent'
defaultValue=''
multiline
testID='messagebox-input'
testID={`messagebox-input${ tmid ? '-thread' : '' }`}
theme={theme}
{...isAndroidTablet}
/>
Expand Down
1 change: 1 addition & 0 deletions app/utils/log/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default {
STATUS_F: 'status_f',
STATUS_CUSTOM: 'status_custom',
STATUS_CUSTOM_F: 'status_custom_f',
SET_STATUS_FAIL: 'set_status_fail',

// ROOMS LIST VIEW
RL_TOGGLE_SERVER_DROPDOWN: 'rl_toggle_server_dropdown',
Expand Down
2 changes: 1 addition & 1 deletion app/views/RoomActionsView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ class RoomActionsView extends React.Component {
return (
<SafeAreaView testID='room-actions-view'>
<StatusBar />
<List.Container>
<List.Container testID='room-actions-scrollview'>
{this.renderRoomInfo()}
{this.renderJitsi()}
{this.renderE2EEncryption()}
Expand Down
5 changes: 2 additions & 3 deletions app/views/StatusView.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class StatusView extends React.Component {
const { statusText } = this.state;
const { user } = this.props;
if (statusText !== user.statusText) {
await this.setCustomStatus();
await this.setCustomStatus(statusText);
}
this.close();
}
Expand All @@ -101,8 +101,7 @@ class StatusView extends React.Component {
navigation.goBack();
}

setCustomStatus = async() => {
const { statusText } = this.state;
setCustomStatus = async(statusText) => {
const { user, setUser } = this.props;

this.setState({ loading: true });
Expand Down
11 changes: 8 additions & 3 deletions e2e/data.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const random = require('./helpers/random');
const value = random(20);
const data = {
server: 'http://localhost:3000',
adminUser: 'admin',
adminPassword: 'password',
server: 'https://mobile.rocket.chat',
adminUser: 'e2e_admin',
adminPassword: 'p7mFh4yLwCRXSnMvG',
alternateServer: 'https://stable.rocket.chat',
users: {
regular: {
Expand Down Expand Up @@ -57,6 +57,11 @@ const data = {
password: `passwordthree${ value }`,
email: `mobile+registeringthree${ value }@rocket.chat`
},
registeringUser4: {
username: `newuserfour${ value }`,
password: `passwordfour${ value }`,
email: `mobile+registeringfour${ value }@rocket.chat`
},
random: value
}
module.exports = data;
23 changes: 11 additions & 12 deletions e2e/helpers/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ async function navigateToWorkspace(server = data.server) {
await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(10000);
await element(by.id('join-workspace')).tap();
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(60000);
await element(by.id('new-server-view-input')).replaceText(server);
await element(by.id('new-server-view-button')).tap();
await element(by.id('new-server-view-input')).typeText(`${server}\n`);
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(60000);
await expect(element(by.id('workspace-view'))).toBeVisible();
}
Expand All @@ -33,7 +32,7 @@ async function login(username, password) {
await element(by.id('login-view-email')).replaceText(username);
await element(by.id('login-view-password')).replaceText(password);
await element(by.id('login-view-submit')).tap();
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(30000);
}

async function logout() {
Expand All @@ -52,24 +51,24 @@ async function logout() {
await expect(element(by.id('onboarding-view'))).toBeVisible();
}

async function mockMessage(message) {
await element(by.id('messagebox-input')).atIndex(0).tap();
await element(by.id('messagebox-input')).atIndex(0).typeText(`${ data.random }${ message }`);
await element(by.id('messagebox-send-message')).atIndex(0).tap();
await waitFor(element(by.label(`${ data.random }${ message }`)).atIndex(0)).toExist().withTimeout(60000);
await expect(element(by.label(`${ data.random }${ message }`)).atIndex(0)).toExist();
async function mockMessage(message, isThread = false) {
let input = isThread ? 'messagebox-input-thread' : 'messagebox-input';
await element(by.id(input)).tap();
await element(by.id(input)).typeText(`${ data.random }${ message }`);
await element(by.id('messagebox-send-message')).tap();
await waitFor(element(by.label(`${ data.random }${ message }`))).toExist().withTimeout(60000);
await expect(element(by.label(`${ data.random }${ message }`))).toExist();
await element(by.label(`${ data.random }${ message }`)).atIndex(0).tap();
};

async function starMessage(message){
const messageLabel = `${ data.random }${ message }`
await waitFor(element(by.label(messageLabel))).toBeVisible().withTimeout(5000);
await element(by.label(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.label('Star')).tap();
await waitFor(element(by.id('action-sheet'))).toNotExist().withTimeout(5000);
await waitFor(element(by.id('action-sheet'))).not.toExist().withTimeout(5000);
};

async function pinMessage(message){
Expand All @@ -80,7 +79,7 @@ async function pinMessage(message){
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
await element(by.label('Pin')).tap();
await waitFor(element(by.id('action-sheet'))).toNotExist().withTimeout(5000);
await waitFor(element(by.id('action-sheet'))).not.toExist().withTimeout(5000);
}

async function dismissReviewNag(){
Expand Down
9 changes: 5 additions & 4 deletions e2e/helpers/data_setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const login = async (username, password) => {
const authToken = response.data.data.authToken
rocketchat.defaults.headers.common['X-User-Id'] = userId
rocketchat.defaults.headers.common['X-Auth-Token'] = authToken
return { authToken, userId };
}

const createUser = async (username, password, name, email) => {
Expand Down Expand Up @@ -91,11 +92,11 @@ const changeChannelJoinCode = async (roomId, joinCode) => {
}
}

const sendMessage = async (user, groupname, msg) => {
console.log(`Sending message to ${groupname}`)
const sendMessage = async (user, channel, msg) => {
console.log(`Sending message to ${channel}`)
try {
await login(user.username, user.password);
await rocketchat.post('chat.postMessage', { channel: `#${groupname}`, msg });
await rocketchat.post('chat.postMessage', { channel, msg });
} catch (infoError) {
console.log(JSON.stringify(infoError))
throw "Failed to find or create private group"
Expand Down Expand Up @@ -146,5 +147,5 @@ const post = (endpoint, body) => {
}

module.exports = {
setup, sendMessage, get, post
setup, sendMessage, get, post, login
}
9 changes: 4 additions & 5 deletions e2e/tests/assorted/01-e2eencryption.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ describe('E2E Encryption', () => {
await navigateToLogin();
await login(testuser.username, testuser.password);
await navigateToRoom(room);
await waitFor(element(by.label(`${ data.random }message`)).atIndex(0)).toNotExist().withTimeout(2000);
await waitFor(element(by.label(`${ data.random }message`)).atIndex(0)).not.toExist().withTimeout(2000);
await expect(element(by.label('Encrypted message')).atIndex(0)).toExist();
});

Expand All @@ -178,7 +178,7 @@ describe('E2E Encryption', () => {
await waitFor(element(by.id('e2e-enter-your-password-view'))).toBeVisible().withTimeout(2000);
await element(by.id('e2e-enter-your-password-view-password')).typeText(newPassword);
await element(by.id('e2e-enter-your-password-view-confirm')).tap();
await waitFor(element(by.id('listheader-encryption'))).toNotExist().withTimeout(10000);
await waitFor(element(by.id('listheader-encryption'))).not.toExist().withTimeout(10000);
await navigateToRoom(room);
await waitFor(element(by.label(`${ data.random }message`)).atIndex(0)).toExist().withTimeout(2000);
});
Expand Down Expand Up @@ -221,8 +221,7 @@ describe('E2E Encryption', () => {

// TODO: refactor
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(60000);
await element(by.id('new-server-view-input')).replaceText(data.alternateServer);
await element(by.id('new-server-view-button')).tap();
await element(by.id('new-server-view-input')).typeText(`${data.alternateServer}\n`);
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(60000);
await element(by.id('workspace-view-register')).tap();
await waitFor(element(by.id('register-view'))).toBeVisible().withTimeout(2000);
Expand All @@ -231,7 +230,7 @@ describe('E2E Encryption', () => {
await element(by.id('register-view-name')).replaceText(data.registeringUser.username);
await element(by.id('register-view-username')).replaceText(data.registeringUser.username);
await element(by.id('register-view-email')).replaceText(data.registeringUser.email);
await element(by.id('register-view-password')).replaceText(data.registeringUser.password);
await element(by.id('register-view-password')).typeText(data.registeringUser.password);
await element(by.id('register-view-submit')).tap();
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(60000);

Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/assorted/02-broadcast.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('Broadcast room', () => {
});

it('should have the message created earlier', async() => {
await waitFor(element(by.label(`${ data.random }message`)).atIndex(0)).toBeVisible().withTimeout(60000);
await waitFor(element(by.label(`${ data.random }message`))).toExist().withTimeout(60000);
});

it('should have reply button', async() => {
Expand Down
13 changes: 5 additions & 8 deletions e2e/tests/assorted/03-profile.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ const profileChangeUser = data.users.profileChanges
const scrollDown = 200;

async function waitForToast() {
// await waitFor(element(by.id('toast'))).toBeVisible().withTimeout(10000);
// await waitFor(element(by.id('toast'))).toBeVisible().withTimeout(1000);
// await expect(element(by.id('toast'))).toBeVisible();
// await waitFor(element(by.id('toast'))).toBeNotVisible().withTimeout(10000);
// await expect(element(by.id('toast'))).toBeNotVisible();
// await waitFor(element(by.id('toast'))).not.toBeNotVisible().withTimeout(1000);
// await expect(element(by.id('toast'))).not.toBeVisible();
Comment thread
diegolmello marked this conversation as resolved.
await sleep(300);
}

Expand Down Expand Up @@ -76,9 +76,8 @@ describe('Profile screen', () => {

describe('Usage', async() => {
it('should change name and username', async() => {
await element(by.type('UIScrollView')).atIndex(1).swipe('down');
await element(by.id('profile-view-name')).replaceText(`${ profileChangeUser.username }new`);
await element(by.id('profile-view-username')).replaceText(`${ profileChangeUser.username }new`);
await element(by.id('profile-view-username')).typeText(`${ profileChangeUser.username }new`);
await element(by.type('UIScrollView')).atIndex(1).swipe('up');
await element(by.id('profile-view-submit')).tap();
await waitForToast();
Expand All @@ -88,9 +87,7 @@ describe('Profile screen', () => {
await element(by.id('profile-view-email')).replaceText(`mobile+profileChangesNew${ data.random }@rocket.chat`);
await element(by.id('profile-view-new-password')).replaceText(`${ profileChangeUser.password }new`);
await element(by.id('profile-view-submit')).tap();
await element(by.type('_UIAlertControllerTextField')).replaceText(`${ profileChangeUser.password }`)
// For some reason, replaceText does some type of submit, which submits the alert for us
// await element(by.label('Save').and(by.type('_UIAlertControllerActionView'))).tap();
await element(by.type('_UIAlertControllerTextField')).typeText(`${ profileChangeUser.password }\n`)
await waitForToast();
});

Expand Down
6 changes: 0 additions & 6 deletions e2e/tests/assorted/04-setting.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@ describe('Settings screen', () => {
await waitFor(element(by.text('This will clear all your offline data.'))).toExist().withTimeout(2000);
await element(by.label('Clear').and(by.type('_UIAlertControllerActionView'))).tap();
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(5000);
// Database was cleared, so the room shouldn't be there anymore while it's fetched again from the server
/**
* FIXME: rooms are fetched to quickly on docker and the test below fails
* We need to think on another way to test database being resetted
*/
// await waitFor(element(by.id(`rooms-list-view-item-${ data.groups.private.name }`))).toNotExist().withTimeout(10000);
await waitFor(element(by.id(`rooms-list-view-item-${ data.groups.private.name }`))).toExist().withTimeout(10000);
})
});
Expand Down
6 changes: 2 additions & 4 deletions e2e/tests/assorted/05-joinpublicroom.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('Join public room', () => {

describe('Room Actions', async() => {
before(async() => {
await navigateToRoomActions('c');
await navigateToRoomActions();
});

it('should have room actions screen', async() => {
Expand Down Expand Up @@ -103,7 +103,6 @@ describe('Join public room', () => {
});

it('should have share', async() => {
await element(by.type('UIScrollView')).atIndex(1).swipe('down');
await expect(element(by.id('room-actions-share'))).toBeVisible();
});

Expand Down Expand Up @@ -142,7 +141,7 @@ describe('Join public room', () => {
});

it('should have disable notifications and leave channel', async() => {
await navigateToRoomActions('c');
await navigateToRoomActions();
await expect(element(by.id('room-actions-view'))).toBeVisible();
await expect(element(by.id('room-actions-info'))).toBeVisible();
// await expect(element(by.id('room-actions-voice'))).toBeVisible();
Expand All @@ -165,7 +164,6 @@ describe('Join public room', () => {
await expect(element(by.text('Yes, leave it!'))).toBeVisible();
await element(by.text('Yes, leave it!')).tap();
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);
// await element(by.id('rooms-list-view-search')).typeText('');
await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toBeNotVisible().withTimeout(60000);
});
});
Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/assorted/06-status.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ describe('Status screen', () => {
});

it('should change status text', async () => {
await element(by.id('status-view-input')).replaceText('status-text-new');
await element(by.id('status-view-input')).typeText('status-text-new');
await element(by.id('status-view-submit')).tap();
await waitForToast();
await waitFor(element(by.label('status-text-new').withAncestor(by.id('sidebar-custom-status')))).toBeVisible().withTimeout(2000);
await waitFor(element(by.label('status-text-new').withAncestor(by.id('sidebar-custom-status')))).toExist().withTimeout(2000);
});
});
});
5 changes: 2 additions & 3 deletions e2e/tests/assorted/07-changeserver.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ describe('Change server', () => {
await element(by.id('rooms-list-header-server-add')).tap();

await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(6000);
await element(by.id('new-server-view-input')).replaceText(data.alternateServer);
await element(by.id('new-server-view-button')).tap();
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(6000);
await element(by.id('new-server-view-input')).typeText(`${data.alternateServer}\n`);
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(10000);
await reopenAndCheckServer(data.server);
});

Expand Down
7 changes: 1 addition & 6 deletions e2e/tests/assorted/08-joinprotectedroom.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,12 @@ async function navigateToRoom() {
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(5000);
}

async function navigateToRoomActions() {
await element(by.id('room-header')).tap();
await waitFor(element(by.id('room-actions-view'))).toBeVisible().withTimeout(5000);
}

async function openJoinCode() {
await element(by.id('room-view-join-button')).tap();
await waitFor(element(by.id('join-code'))).toBeVisible().withTimeout(5000);
}

describe('Join public room', () => {
describe('Join protected room', () => {
before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
await navigateToLogin();
Expand Down
5 changes: 2 additions & 3 deletions e2e/tests/assorted/10-deleteserver.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ describe('Delete server', () => {
await element(by.id('rooms-list-header-server-add')).tap();

await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(10000);
await element(by.id('new-server-view-input')).replaceText(data.alternateServer);
await element(by.id('new-server-view-button')).tap();
await element(by.id('new-server-view-input')).typeText(`${data.alternateServer}\n`);
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(10000);
await element(by.id('workspace-view-register')).tap();
await waitFor(element(by.id('register-view'))).toBeVisible().withTimeout(2000);
Expand All @@ -32,7 +31,7 @@ describe('Delete server', () => {
await element(by.id('register-view-name')).replaceText(data.registeringUser3.username);
await element(by.id('register-view-username')).replaceText(data.registeringUser3.username);
await element(by.id('register-view-email')).replaceText(data.registeringUser3.email);
await element(by.id('register-view-password')).replaceText(data.registeringUser3.password);
await element(by.id('register-view-password')).typeText(data.registeringUser3.password);
await element(by.id('register-view-submit')).tap();
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(60000);

Expand Down
Loading