Skip to content

Commit

Permalink
Add testing ids (#14)
Browse files Browse the repository at this point in the history
* feat: add testIDs for components

Signed-off-by: andrei-zgirvaci <[email protected]>

* ci: split build & deploy jobs

Signed-off-by: andrei-zgirvaci <[email protected]>

---------

Signed-off-by: andrei-zgirvaci <[email protected]>
  • Loading branch information
andrei-zgirvaci authored Apr 9, 2024
1 parent b830fc4 commit 7071f48
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 24 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ on:
push:
branches: [main]

env:
SAMPLE_APP_PATH: 'apps/sample-app/android'

jobs:
build_and_deploy:
build-sample-app:
runs-on: ubuntu-latest

env:
SAMPLE_APP_PATH: 'apps/sample-app/android'

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -44,6 +44,12 @@ jobs:
cd ${{ env.SAMPLE_APP_PATH }}
./gradlew assembleRelease
deploy-sample-app:
needs: build-sample-app

runs-on: ubuntu-latest

steps:
- name: Upload .apk to App Center
uses: wzieba/AppCenter-Github-Action@v1
with:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Lint, typecheck files and run unit tests
name: Lint, typecheck files & run unit tests

on:
pull_request:
branches: [main]
types: [opened, synchronize]

jobs:
lint:
lint-typecheck-unit-test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
24 changes: 20 additions & 4 deletions apps/sample-app/src/screens/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,26 @@ export default function HomeScreen() {

return (
<View style={styles.container}>
<Button onPress={onGoogleSignIn} title="Sign in with Google" />
<Button onPress={onFacebookSignIn} title="Sign in with Facebook" />
<Button onPress={onDropboxSignIn} title="Sign in with Dropbox" />
<Button onPress={onMicrosoftSignIn} title="Sign in with Microsoft" />
<Button
onPress={onGoogleSignIn}
title="Sign in with Google"
testID="sign-in-google"
/>
<Button
onPress={onFacebookSignIn}
title="Sign in with Facebook"
testID="sign-in-facebook"
/>
<Button
onPress={onMicrosoftSignIn}
title="Sign in with Microsoft"
testID="sign-in-microsoft"
/>
<Button
onPress={onDropboxSignIn}
title="Sign in with Dropbox"
testID="sign-in-dropbox"
/>
</View>
);
}
Expand Down
44 changes: 30 additions & 14 deletions apps/sample-app/src/screens/SignedInScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,31 +111,47 @@ export default function SignedInScreen() {
return (
<View style={styles.container}>
<View style={styles.userProfileContainer}>
<Image style={styles.userProfileImage} source={{uri: profileImage}} />
<Image
style={styles.userProfileImage}
source={{uri: profileImage}}
testID="profile-image"
/>

<View style={styles.userProfileContents}>
<Text>Name: {userProfile?.name}</Text>
<Text testID="name">Name: {userProfile?.name}</Text>

<Text>Surname: {userProfile?.surname}</Text>
<Text testID="surname">Surname: {userProfile?.surname}</Text>

<Text>Email: {userProfile?.email}</Text>
<Text testID="email">Email: {userProfile?.email}</Text>

<Text>Token:</Text>
</View>
</View>

<Text>{accessToken}</Text>
<Text testID="token">{accessToken}</Text>

<View style={styles.actionButtons}>
<Button onPress={onGetAccessToken} title="Get access token" />

<Button onPress={onGetUser} title="Get user" />

<Button onPress={onRefreshAccessToken} title="Refresh access token" />

<Button onPress={onRevokeAccessToken} title="Revoke access token" />

<Button onPress={onSignOut} title="Sign out" />
<Button
onPress={onGetAccessToken}
title="Get access token"
testID="get-access-token"
/>

<Button onPress={onGetUser} title="Get user" testID="get-user" />

<Button
onPress={onRefreshAccessToken}
title="Refresh access token"
testID="refresh-access-token"
/>

<Button
onPress={onRevokeAccessToken}
title="Revoke access token"
testID="revoke-access-token"
/>

<Button onPress={onSignOut} title="Sign out" testID="sign-out" />
</View>
</View>
);
Expand Down

0 comments on commit 7071f48

Please sign in to comment.