regression: open self profile from messages (#5554)
* fix: open self profile from messages * fix the inAppFeedback reducer function name * add e2e test to open profile by username * update tests --------- Co-authored-by: Gleidson Daniel Silva <gleidson10daniel@hotmail.com>
This commit is contained in:
parent
2a1b59cd57
commit
f89a28e4f7
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -98,7 +98,7 @@ const User = React.memo(
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<TouchableOpacity style={styles.titleContainer} onPress={onUserPress}>
|
<TouchableOpacity testID={`username-header-${username}`} style={styles.titleContainer} onPress={onUserPress}>
|
||||||
<Text style={[styles.username, { color: colors.titleText }]} numberOfLines={1}>
|
<Text style={[styles.username, { color: colors.titleText }]} numberOfLines={1}>
|
||||||
{textContent}
|
{textContent}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
|
@ -7,7 +7,7 @@ export interface IInAppFeedbackState {
|
||||||
|
|
||||||
export const initialState: IInAppFeedbackState = {};
|
export const initialState: IInAppFeedbackState = {};
|
||||||
|
|
||||||
export default function activeUsers(state = initialState, action: TApplicationActions): IInAppFeedbackState {
|
export default function inAppFeedback(state = initialState, action: TApplicationActions): IInAppFeedbackState {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case IN_APP_FEEDBACK.SET:
|
case IN_APP_FEEDBACK.SET:
|
||||||
const { msgId } = action;
|
const { msgId } = action;
|
||||||
|
|
|
@ -159,7 +159,7 @@ const RoomInfoView = (): React.ReactElement => {
|
||||||
const loadUser = async () => {
|
const loadUser = async () => {
|
||||||
if (isEmpty(roomUser)) {
|
if (isEmpty(roomUser)) {
|
||||||
try {
|
try {
|
||||||
const roomUserId = getUidDirectMessage(room || { rid, t, itsMe });
|
const roomUserId = getUidDirectMessage({ ...(room || { rid, t }), itsMe });
|
||||||
const result = await Services.getUserInfo(roomUserId);
|
const result = await Services.getUserInfo(roomUserId);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
const { user } = result;
|
const { user } = result;
|
||||||
|
|
|
@ -12,7 +12,8 @@ import {
|
||||||
navigateToRoom,
|
navigateToRoom,
|
||||||
navigateToRecentRoom
|
navigateToRecentRoom
|
||||||
} from '../../helpers/app';
|
} from '../../helpers/app';
|
||||||
import { createRandomRoom, createRandomUser, ITestUser, sendMessage } from '../../helpers/data_setup';
|
import { createRandomRoom, createRandomUser, deleteCreatedUsers, ITestUser, sendMessage } from '../../helpers/data_setup';
|
||||||
|
import data from '../../data';
|
||||||
|
|
||||||
describe('Room screen', () => {
|
describe('Room screen', () => {
|
||||||
let room: string;
|
let room: string;
|
||||||
|
@ -237,6 +238,39 @@ describe('Room screen', () => {
|
||||||
await element(by.id('action-sheet-handle')).swipe('down', 'fast', 0.5);
|
await element(by.id('action-sheet-handle')).swipe('down', 'fast', 0.5);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should open the profile view tapping on his username', async () => {
|
||||||
|
const { username } = user;
|
||||||
|
await waitFor(element(by.id(`username-header-${username}`)))
|
||||||
|
.toExist()
|
||||||
|
.withTimeout(2000);
|
||||||
|
await element(by.id(`username-header-${username}`)).tap();
|
||||||
|
await waitFor(element(by.id('room-info-view-username')))
|
||||||
|
.toExist()
|
||||||
|
.withTimeout(2000);
|
||||||
|
await waitFor(element(by[textMatcher](`@${username}`)))
|
||||||
|
.toExist()
|
||||||
|
.withTimeout(2000);
|
||||||
|
await tapBack();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should open the profile view tapping on other username', async () => {
|
||||||
|
const otherUser = await createRandomUser();
|
||||||
|
const { username } = otherUser;
|
||||||
|
await sendMessage(otherUser, room, 'new message');
|
||||||
|
await waitFor(element(by.id(`username-header-${username}`)))
|
||||||
|
.toExist()
|
||||||
|
.withTimeout(2000);
|
||||||
|
await element(by.id(`username-header-${username}`)).tap();
|
||||||
|
await waitFor(element(by.id('room-info-view-username')))
|
||||||
|
.toExist()
|
||||||
|
.withTimeout(2000);
|
||||||
|
await waitFor(element(by[textMatcher](`@${username}`)))
|
||||||
|
.toExist()
|
||||||
|
.withTimeout(2000);
|
||||||
|
await tapBack();
|
||||||
|
await deleteCreatedUsers([{ server: data.server, username }]);
|
||||||
|
});
|
||||||
|
|
||||||
it('should edit message', async () => {
|
it('should edit message', async () => {
|
||||||
const editMessage = await mockMessage('edit');
|
const editMessage = await mockMessage('edit');
|
||||||
const editedMessage = `${editMessage}ed`;
|
const editedMessage = `${editMessage}ed`;
|
||||||
|
|
|
@ -8630,6 +8630,7 @@ builtins@^1.0.3:
|
||||||
resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88"
|
resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88"
|
||||||
integrity sha512-uYBjakWipfaO/bXI7E8rq6kpwHRZK5cNYrUv2OzZSI/FvmdMyXJ2tG9dKcjEC5YHmHpUAwsargWIZNWdxb/bnQ==
|
integrity sha512-uYBjakWipfaO/bXI7E8rq6kpwHRZK5cNYrUv2OzZSI/FvmdMyXJ2tG9dKcjEC5YHmHpUAwsargWIZNWdxb/bnQ==
|
||||||
|
|
||||||
|
|
||||||
bunyamin@^1.5.0:
|
bunyamin@^1.5.0:
|
||||||
version "1.5.2"
|
version "1.5.2"
|
||||||
resolved "https://registry.yarnpkg.com/bunyamin/-/bunyamin-1.5.2.tgz#681db204c0b16531369d5c1f6c89dc8d760b7558"
|
resolved "https://registry.yarnpkg.com/bunyamin/-/bunyamin-1.5.2.tgz#681db204c0b16531369d5c1f6c89dc8d760b7558"
|
||||||
|
|
Loading…
Reference in New Issue