Skip to content
Open
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
66 changes: 66 additions & 0 deletions .maestro/tests/room/room.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,77 @@ tags:
env:
message: ${output.randomMessage}

# should send a message in thread and verify avatar tap navigates to RoomInfoView
- extendedWaitUntil:
visible:
text: ${output.randomMessage}
timeout: 60000
- longPressOn:
id: 'message-content-${output.randomMessage}'
- waitForAnimationToEnd:
timeout: 1000
- extendedWaitUntil:
visible:
id: action-sheet
timeout: 60000
- extendedWaitUntil:
visible:
id: message-actions-reply-in-thread
timeout: 60000
- tapOn:
id: message-actions-reply-in-thread
- extendedWaitUntil:
visible:
id: room-view
timeout: 60000
- extendedWaitUntil:
visible:
id: message-composer-input-thread
timeout: 60000
- tapOn:
id: message-composer-input-thread
- inputText: 'thread-reply-message'
- tapOn:
id: message-composer-send
- extendedWaitUntil:
visible:
text: '.*thread-reply-message.*'
timeout: 60000

- runFlow: '../../helpers/go-back.yaml'

# tap on the avatar of the thread reply — should open RoomInfoView
- tapOn:
id: 'avatar-${output.user.username}'
- extendedWaitUntil:
visible:
id: room-info-view-username
timeout: 60000
- extendedWaitUntil:
visible:
text: .*${'@'+output.user.username}.*
timeout: 60000
- waitForAnimationToEnd:
timeout: 2000

# assert thread view did NOT reopen on top of RoomInfoView
- assertNotVisible:
id: message-composer-input-thread

# go-back is causing 2 times back execution, using navigate-to-room after going back
- runFlow: '../../helpers/go-back.yaml'
- runFlow:
file: '../../helpers/navigate-to-room.yaml'
env:
ROOM: ${output.room.name}

# should show and tap on emoji autocomplete
- extendedWaitUntil:
visible:
id: message-composer-input
timeout: 60000
- tapOn:
id: message-composer-input
- inputText: ':joy'
- extendedWaitUntil:
visible:
Expand Down
5 changes: 3 additions & 2 deletions app/containers/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ const Avatar = React.memo(
roomAvatarExternalProviderUrl,
cdnPrefix,
accessibilityLabel,
accessible = true
accessible = true,
testID
}: IAvatar) => {
if ((!text && !avatar && !emoji && !rid) || !server) {
return null;
Expand Down Expand Up @@ -108,7 +109,7 @@ const Avatar = React.memo(
accessible={accessible}
accessibilityLabel={!onPress ? avatarAccessibilityLabel : undefined}
style={[avatarStyle, style]}
testID='avatar'>
testID={testID ?? 'avatar'}>
{image}
{children}
</View>
Expand Down
1 change: 1 addition & 0 deletions app/containers/Avatar/AvatarContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const AvatarContainer = ({

return (
<Avatar
testID={`avatar-${username}`}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use the avatar subject (or explicit prop) for testID, not the logged-in username.

At Line 53, username is from auth state, so multiple avatars can share the same ID and avatars for other users get a misleading ID. This makes E2E taps ambiguous/flaky.

Suggested fix
 const AvatarContainer = ({
 	style,
 	text = '',
+	testID,
 	avatar,
 	emoji,
 	size,
@@
 	return (
 		<Avatar
-			testID={`avatar-${username}`}
+			testID={testID ?? `avatar-${text || username}`}
 			server={server}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/containers/Avatar/AvatarContainer.tsx` at line 53, The testID currently
uses the logged-in username variable `username` in AvatarContainer (prop
`testID={`avatar-${username}`}`) which causes duplicate/misleading IDs; change
it to use the avatar's subject or an explicit prop instead (e.g., use `subject`
or a passed-in `testID`/`avatarId` prop) so each avatar's testID is unique —
update the `testID` expression in AvatarContainer to `avatar-${subject}` (or
prefer honoring an explicit `testID` prop if provided) and remove reliance on
the auth `username` variable.

server={server}
style={style}
text={text}
Expand Down
1 change: 1 addition & 0 deletions app/containers/Avatar/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { type TGetCustomEmoji } from '../../definitions/IEmoji';
export interface IAvatar {
server?: string;
style?: ViewStyle;
testID?: string;
text?: string;
avatar?: string;
emoji?: string;
Expand Down
6 changes: 3 additions & 3 deletions app/containers/Chip/__snapshots__/Chip.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ exports[`Story Snapshots: ChipText should match snapshot 1`] = `
},
]
}
testID="avatar"
testID="avatar-rocket.cat"
>
<ViewManagerAdapter_ExpoImage
borderRadius={4}
Expand Down Expand Up @@ -368,7 +368,7 @@ exports[`Story Snapshots: ChipWithShortText should match snapshot 1`] = `
},
]
}
testID="avatar"
testID="avatar-rocket.cat"
>
<ViewManagerAdapter_ExpoImage
borderRadius={4}
Expand Down Expand Up @@ -781,7 +781,7 @@ exports[`Story Snapshots: ChipWithoutIcon should match snapshot 1`] = `
},
]
}
testID="avatar"
testID="avatar-rocket.cat"
>
<ViewManagerAdapter_ExpoImage
borderRadius={4}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ exports[`Story Snapshots: CustomStyle should match snapshot 1`] = `
},
]
}
testID="avatar"
testID="avatar-rocket.cat"
>
<ViewManagerAdapter_ExpoImage
borderRadius={4}
Expand Down Expand Up @@ -409,7 +409,7 @@ exports[`Story Snapshots: Default should match snapshot 1`] = `
},
]
}
testID="avatar"
testID="avatar-rocket.cat"
>
<ViewManagerAdapter_ExpoImage
borderRadius={4}
Expand Down Expand Up @@ -689,7 +689,7 @@ exports[`Story Snapshots: DirectMessage should match snapshot 1`] = `
},
]
}
testID="avatar"
testID="avatar-rocket.cat"
>
<ViewManagerAdapter_ExpoImage
borderRadius={4}
Expand Down Expand Up @@ -938,7 +938,7 @@ exports[`Story Snapshots: LongRoomName should match snapshot 1`] = `
},
]
}
testID="avatar"
testID="avatar-rocket.cat"
>
<ViewManagerAdapter_ExpoImage
borderRadius={4}
Expand Down Expand Up @@ -1428,7 +1428,7 @@ exports[`Story Snapshots: TeamMain should match snapshot 1`] = `
},
]
}
testID="avatar"
testID="avatar-rocket.cat"
>
<ViewManagerAdapter_ExpoImage
borderRadius={4}
Expand Down Expand Up @@ -1708,7 +1708,7 @@ exports[`Story Snapshots: WithRightLabel should match snapshot 1`] = `
},
]
}
testID="avatar"
testID="avatar-rocket.cat"
>
<ViewManagerAdapter_ExpoImage
borderRadius={4}
Expand Down Expand Up @@ -2007,7 +2007,7 @@ exports[`Story Snapshots: WithoutDescription should match snapshot 1`] = `
},
]
}
testID="avatar"
testID="avatar-rocket.cat"
>
<ViewManagerAdapter_ExpoImage
borderRadius={4}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ exports[`Story Snapshots: ChannelMessage should match snapshot 1`] = `
},
]
}
testID="avatar"
testID="avatar-rocket.cat"
>
<ViewManagerAdapter_ExpoImage
borderRadius={4}
Expand Down Expand Up @@ -480,7 +480,7 @@ exports[`Story Snapshots: DirectMessage should match snapshot 1`] = `
},
]
}
testID="avatar"
testID="avatar-rocket.cat"
>
<ViewManagerAdapter_ExpoImage
borderRadius={4}
Expand Down Expand Up @@ -826,7 +826,7 @@ exports[`Story Snapshots: WithBlackTheme should match snapshot 1`] = `
},
]
}
testID="avatar"
testID="avatar-rocket.cat"
>
<ViewManagerAdapter_ExpoImage
borderRadius={4}
Expand Down Expand Up @@ -1172,7 +1172,7 @@ exports[`Story Snapshots: WithDarkTheme should match snapshot 1`] = `
},
]
}
testID="avatar"
testID="avatar-rocket.cat"
>
<ViewManagerAdapter_ExpoImage
borderRadius={4}
Expand Down
Loading