regression: open self profile from messages ()

* 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:
Reinaldo Neto 2024-02-15 18:07:48 -03:00 committed by GitHub
parent 2a1b59cd57
commit f89a28e4f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 80 additions and 45 deletions
__tests__
containers/message/__snapshots__
views/RoomView/LoadMore/__snapshots__
app
containers/message
reducers
views/RoomInfoView
e2e/tests/room
yarn.lock

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -98,7 +98,7 @@ const User = React.memo(
return (
<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}>
{textContent}
</Text>

View File

@ -7,7 +7,7 @@ export interface 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) {
case IN_APP_FEEDBACK.SET:
const { msgId } = action;

View File

@ -159,7 +159,7 @@ const RoomInfoView = (): React.ReactElement => {
const loadUser = async () => {
if (isEmpty(roomUser)) {
try {
const roomUserId = getUidDirectMessage(room || { rid, t, itsMe });
const roomUserId = getUidDirectMessage({ ...(room || { rid, t }), itsMe });
const result = await Services.getUserInfo(roomUserId);
if (result.success) {
const { user } = result;

View File

@ -12,7 +12,8 @@ import {
navigateToRoom,
navigateToRecentRoom
} 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', () => {
let room: string;
@ -237,6 +238,39 @@ describe('Room screen', () => {
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 () => {
const editMessage = await mockMessage('edit');
const editedMessage = `${editMessage}ed`;

View File

@ -8630,6 +8630,7 @@ builtins@^1.0.3:
resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88"
integrity sha512-uYBjakWipfaO/bXI7E8rq6kpwHRZK5cNYrUv2OzZSI/FvmdMyXJ2tG9dKcjEC5YHmHpUAwsargWIZNWdxb/bnQ==
bunyamin@^1.5.0:
version "1.5.2"
resolved "https://registry.yarnpkg.com/bunyamin/-/bunyamin-1.5.2.tgz#681db204c0b16531369d5c1f6c89dc8d760b7558"