Skip to content

Commit

Permalink
test: added e2e tests for profile switchbutton and edit profile
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis3797 committed Jun 20, 2024
1 parent 950ebeb commit 540d7cf
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 5 deletions.
28 changes: 28 additions & 0 deletions .maestro/profile/check-profile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,31 @@ appId: ${APP_ID}
visible:
id: 'followings-pressable'
file: 'explore-followings.yaml'

- assertVisible:
id: 'Achievements-button'

- tapOn:
id: 'Achievements-button'

- swipe:
start: 50%,81%
end: 50%,48%
duration: 300

- assertVisible:
id: 'Statistics-button'

- tapOn:
id: 'Statistics-button'

- swipe:
start: 50%,81%
end: 50%,48%
duration: 300

- runFlow:
when:
visible:
id: 'followers-pressable'
file: 'explore-followers.yaml'
49 changes: 49 additions & 0 deletions .maestro/profile/edit-profile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
appId: ${APP_ID}
---
- assertVisible: 'Edit Profile'

- tapOn: 'Edit Profile'

- assertVisible:
id: 'heading'

- assertVisible:
id: 'back-pressable'

- assertVisible:
id: 'displayname-input'

- assertVisible:
id: 'bio-input'

- tapOn:
id: 'bio-input'

- eraseText: 100

- inputText: 'my new bio'

- tapOn:
point: 17%,27%

- assertVisible: 'Edit Avatar'

- tapOn: 'Edit Avatar'

- assertVisible: 'Choose From Gallery'
- tapOn: 'Choose From Gallery'

- assertVisible: 'Photos'

- assertVisible: 'Foto, 30. März 2018, 21:14'

# choose image
- tapOn: 'Foto, 30. März 2018, 21:14'

- assertVisible: 'Choose'

- tapOn: 'Choose'

- assertVisible: 'Finish'

- tapOn: 'Finish'
4 changes: 2 additions & 2 deletions src/api/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export type UserToAchievement = {
progress: number;
created_at: Date;
updated_at: Date;
achievemnt: Achievement;
achievement: Achievement;
};

export type Follows = {
Expand All @@ -87,7 +87,7 @@ export type Genre = {
percent: number;
days: Days[];
avgViewers: number;
}
};

export type GetUserResponse = TypedResponse<{
user: User & {
Expand Down
1 change: 1 addition & 0 deletions src/components/SwitchButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const SwitchButton: React.FC<SwitchButtonProps> = ({ states, onStateChange }) =>
{states.map((state, index) => {
return (
<Button
testID={`${state}-button`}
key={index}
flex={1}
width="100%"
Expand Down
10 changes: 7 additions & 3 deletions src/screens/EditProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@ const EditProfilePage = () => {
<YStack padding="$4" backgroundColor="$background" gap="$5" flexGrow={1}>
<XStack alignItems="center" justifyContent="space-between">
<XStack alignItems="center">
<Pressable onPress={() => router.back()}>
<Pressable onPress={() => router.back()} testID="back-pressable">
<Feather name="chevron-left" size={28} color="white" />
</Pressable>
<H1 fontSize={24}>Edit Profile</H1>
<H1 fontSize={24} testID="heading">
Edit Profile
</H1>
</XStack>
<Pressable
disabled={
Expand All @@ -112,7 +114,7 @@ const EditProfilePage = () => {
<YStack alignItems="center">
<Avatar circular size="$10" testID="profile-avatar">
<Avatar.Image
accessibilityLabel="Nate Wienert"
accessibilityLabel={data?.data?.user.username ?? ''}
src={
imageUri?.image.uri ??
data?.data?.user.avatar_url ??
Expand All @@ -138,6 +140,7 @@ const EditProfilePage = () => {
</XStack>
<Input
maxLength={20}
testID="displayname-input"
placeholderTextColor="$textWashedOut"
placeholder="displayname"
onChangeText={props.handleChange('displayname')}
Expand All @@ -154,6 +157,7 @@ const EditProfilePage = () => {
</XStack>
<TextArea
maxLength={100}
testID="bio-input"
placeholderTextColor="$textWashedOut"
placeholder="bio"
onChangeText={props.handleChange('bio')}
Expand Down

0 comments on commit 540d7cf

Please sign in to comment.