Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android testing Assignment #8

Closed
Closed
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
81 changes: 81 additions & 0 deletions .github/workflows/android_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Android Tests

on:
push:
branches:
- android-testing
pull_request:
branches:
- android-testing

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'

- name: Cache Gradle dependencies
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Run AssessmentsSchoolHistoryDaoTest

Choose a reason for hiding this comment

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

This looks like a good hack, but does this mean every file to be tested would need to be added here? Lots of manual work and error prone approach? Shouldn't we automatically scan all files for tests and run them? There could be a better way to do this?

run: |
./gradlew --stacktrace :ancillaryscreens:testDebug --tests "com.data.db.dao.AssessmentsSchoolHistoryDaoTest"

- name: Run AssessmentStateDaoTest
run: |
./gradlew --stacktrace :ancillaryscreens:testDebug --tests "com.data.db.dao.AssessmentStateDaoTest"

- name: Run AssessmentSubmissionDaoTest
run: |
./gradlew --stacktrace :ancillaryscreens:testDebug --tests "com.data.db.dao.AssessmentSubmissionDaoTest"

- name: Run CycleDetailsDaoTest
run: |
./gradlew --stacktrace :ancillaryscreens:testDebug --tests "com.data.db.dao.CycleDetailsDaoTest"

- name: Run ExaminerPerformanceInsightsDaoTest
run: |
./gradlew --stacktrace :ancillaryscreens:testDebug --tests "com.data.db.dao.ExaminerPerformanceInsightsDaoTest"

- name: Run MetaDataDaoTest
run: |
./gradlew --stacktrace :ancillaryscreens:testDebug --tests "com.data.db.dao.MetaDataDaoTest"

- name: Run SchoolsDaoTest
run: |
./gradlew --stacktrace :ancillaryscreens:testDebug --tests "com.data.db.dao.SchoolsDaoTest"

- name: Run SchoolStatusHistoryDaoTest
run: |
./gradlew --stacktrace :ancillaryscreens:testDebug --tests "com.data.db.dao.SchoolStatusHistoryDaoTest"

- name: Run SchoolSubmissionsDaoTest
run: |
./gradlew --stacktrace :ancillaryscreens:testDebug --tests "com.data.db.dao.SchoolSubmissionsDaoTest"

- name: Run StudentsAssemblyHistoryDaoTest
run: |
./gradlew --stacktrace :ancillaryscreens:testDebug --tests "com.data.db.dao.StudentsAssemblyHistoryDaoTest"

- name: Run StudentsDaoTest
run: |
./gradlew --stacktrace :ancillaryscreens:testDebug --tests "com.data.db.dao.StudentsDaoTest"

- name: Run TeacherPerformanceInsightsDaoTest
run: |
./gradlew --stacktrace :ancillaryscreens:testDebug --tests "com.data.db.dao.TeacherPerformanceInsightsDaoTest"
4 changes: 4 additions & 0 deletions ancillaryscreens/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ android {
maxHeapSize = "2048M"
}
}
execution 'ANDROIDX_TEST_ORCHESTRATOR'
unitTests.all {
// Add more options if needed
}
}
namespace 'com.samagra.ancillaryscreens'
}
Expand Down
172 changes: 172 additions & 0 deletions ancillaryscreens/gradlew
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
#!/usr/bin/env sh

Choose a reason for hiding this comment

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

What is the use of this file? Why do we need it? Should it be a gitignore?


##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn () {
echo "$*"
}

die () {
echo
echo "$*"
echo
exit 1
}

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option

if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
30 changes: 30 additions & 0 deletions app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{

Choose a reason for hiding this comment

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

Kindly remove these and add to gitignore file. We should not commit the services file.

Copy link
Author

@Jasjot784 Jasjot784 Apr 3, 2024

Choose a reason for hiding this comment

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

I am sorry, I forgot to delete those files, I have now deleted them and re initiated pull request

"project_info": {
"project_number": "667148317316",
"firebase_url": "https://sudeshna-1c373-default-rtdb.firebaseio.com",
"project_id": "sudeshna-1c373",
"storage_bucket": "sudeshna-1c373.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:667148317316:android:9caa3a31298de3578488d1",
"android_client_info": {
"package_name": "org.samagra.missionPrerna"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyCZQyE7SAdEfGA4BgEUt-3inVsUSpjF-v0"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ buildscript {
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.5.3"
classpath "com.google.android.gms:oss-licenses-plugin:0.10.6"
classpath("com.android.tools:r8:8.1.56")
}
}
}

allprojects {
Expand Down Expand Up @@ -114,4 +114,4 @@ ext {

task clean(type: Delete) {
delete rootProject.buildDir
}
}
45 changes: 45 additions & 0 deletions local.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## This file must *NOT* be checked into Version Control Systems,

Choose a reason for hiding this comment

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

Kindly remove these and add to gitignore file. We should not commit the local properties file.

# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Tue Aug 21 21:48:15 IST 2023
## NL
# Should add
## Endpoint of hasura you spun up along with it's token
STAGING_HASURA_URL=https://sandbox.hasura.nl.samagra.io
STAGING_HASURA_SERVER_AUTH_TOKEN=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjRwSFNCOUYteGw5OGZLSnJ0LVEyVDV6UjQ3cyJ9.eyJhdWQiOiIxMjM0NTY3OC0zZDg0LTRkOGEtYTE5MS1kYTRlOTcyYzI5NTEiLCJleHAiOjE5OTM0MTA4NTYsImlhdCI6MTY2MTg3NDg1NiwiaXNzIjoiYWNtZS5jb20iLCJzdWIiOiJhYzEyYzliMy05OWVkLTQzOTYtYjFlZC01NDRmMzY4NjIzYjkiLCJqdGkiOiI3NmNmMGNlMi0wYTUxLTQzM2EtYWFmOC1lMGMyNzUwOTg2MmIiLCJhdXRoZW50aWNhdGlvblR5cGUiOiJQQVNTV09SRCIsInByZWZlcnJlZF91c2VybmFtZSI6Im5sYXBwQHNhbWFncmEiLCJhcHBsaWNhdGlvbklkIjoiMTIzNDU2NzgtM2Q4NC00ZDhhLWExOTEtZGE0ZTk3MmMyOTUxIiwicm9sZXMiOlsiT3BlblJvbGUiXSwic2lkIjoiMzQ4YWU5ODgtMWFmMS00YTE2LWFmNzgtNmJkZjNlNWZkYTUwIiwiYXV0aF90aW1lIjoxNjYxODc0ODU2LCJ0aWQiOiIwMTA1NjZmZC1lMWNiLWM2NTgtYjY1OS1hMWQzZTA3MGJhYTgiLCJodHRwczovL2hhc3VyYS5pby9qd3QvY2xhaW1zIjp7IngtaGFzdXJhLWFsbG93ZWQtcm9sZXMiOlsiT3BlblJvbGUiLCJESUVUIiwibWFuYXZfc2FtcGFkYSJdLCJ4LWhhc3VyYS1kZWZhdWx0LXJvbGUiOiJPcGVuUm9sZSIsIlgtSGFzdXJhLVVzZXItSWQiOiJubGFwcEBzYW1hZ3JhMTIzIn19.NMLZrjDDDAy0sEVhrjewZfC1q35bt4QGZcT2tSQC0FGLFi1gHATw2DM3am5PtIJi02-ZqP1KOMOO_ysTh5AJYYGJFE-hWdRGFQIs8oUAks_4uF0TVsOXWJF0tIHZKRaEDwXiT3TeO8gPVs_hgeSBrBidnTXvRNjPMyq8Bmjlg7WD5h-j5sHg5hNybiVroioc-d5gMJDDiTQMWcnr_D9oSOzPBBbJymPf5muCvQuYPCfRT2yNptvdj1611ogYMW3DkiLU148cYC66JoqQK6gn61sML5s3yh3tBgFrXnv5qeYCEyjNwDKbwCOj6zrIicQFlg_ZlmdGymIT-WIN0NknhA
## ODK Central instance you spun up in installation
STAGING_ODK_SERVER_URL=https://sandbox.central.nl.samagra.io/v1/key/PQJRIpVKS74ZaeVHh1EZdYDxJH0isL8iiDwmnXrxLRc2TnenS9qOtYbvr!osE6NQ/projects/2
## Hash & link of the ODK forms zip. Hash is used to know if a new download is required
STAGING_FORM_ZIP_HASH=adc
STAGING_FORM_ZIP_URL=https://sandbox.forms.nl.samagra.io
## User service endpoint and info you are hosting.
## Keep empty if you have `ENFORCE_PARENT_FLOW` as true
STAGING_LOGINSERVICE_URL=https://sandbox.us.nl.samagra.io/api/
DEFAULT_FUSION_AUTH_API_KEY=az79nHy-pQ2clijhJys4KrlgT8QO73TBdAqyMGIlBbmiM
DEFAULT_FUSION_AUTH_PASSWORD=sandbox@demo123
DEFAULT_FUSION_AUTH_APPLICATION_ID=12345678-3d84-4d8a-a191-da4e972c2951
## Endpoint of the NL APIs you are hosting
DEFAULT_API_BASE_URL=https://sandbox.api.nl.samagra.io/api/
##
AUTH_API_BASE_URL=https://sandbox.us.nl.samagra.io
##
REFRESH_JWT_BASE=https://sandbox.fa.nl.samagra.io
##
DEFAULT_AUTH_BASE_URL=https://sandbox.api.nl.samagra.io/auth/
## URLs of the gatekeeper service you spun up in NL APIs
STAGING_GATEKEEPER_URL=https://sandbox.gatekeeper.nl.samagra.io
STAGING_GATEKEEPER_API_KEY=my$e37r3836
## URLs to be used by the UCI powered chatbot build
DEFAULT_CHATBOT_URLS={\\\"socketUrl\\\":\\\"ws://www.xyz.com:9898\\\",\\\"chatHistoryUrl\\\":\\\"http://www.xyz.com:9898/\\\",\\\"botDetailsUrl\\\":\\\"http://www.xyz.com:9898\\\",\\\"servicesUrl\\\":\\\"http://www.xyz.com:9898/\\\"}
ENFORCE_PARENT_FLOW=false
# Can ignore
SLACK_BEARER=XYZ
SLACK_CHANNEL=XYZ
DEFAULT_POSTHOG_SERVER_URL=https://www.abc.com
DEFAULT_POSTHOG_SERVER_API_KEY=ABC
STORE_PASSWORD=A
KEY_ALIAS=B
KEY_PASSWORD=C
Loading