diff --git a/app/build.gradle b/app/build.gradle index 2854a2e..04ce123 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -42,22 +42,23 @@ android { dependencies { - implementation 'androidx.core:core-ktx:1.9.0' + implementation 'androidx.core:core-ktx:1.10.0' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'com.google.android.material:material:1.8.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'com.google.firebase:firebase-database-ktx:20.1.0' - implementation 'com.google.firebase:firebase-database:20.1.0' + implementation 'com.google.firebase:firebase-database-ktx:20.2.0' + implementation 'com.google.firebase:firebase-database:20.2.0' implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.4" - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.0" - implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.6.0" + implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1' + implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1' implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3' implementation 'androidx.navigation:navigation-ui-ktx:2.5.3' // Testing dependencies + implementation 'androidx.arch.core:core-testing:2.2.0' testImplementation 'junit:junit:4.13.2' testImplementation 'org.junit.jupiter:junit-jupiter' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' androidTestImplementation 'androidx.test:runner:1.5.2' @@ -66,13 +67,17 @@ dependencies { androidTestImplementation 'androidx.test:core-ktx:1.5.0' androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.5' + // https://mvnrepository.com/artifact/net.bytebuddy/byte-buddy + implementation 'net.bytebuddy:byte-buddy-android:1.14.4' + // Optional -- Mockito framework - testImplementation 'org.mockito:mockito-core:5.0.0' + testImplementation 'org.mockito:mockito-core:5.3.1' + testImplementation 'org.mockito:mockito-android:5.3.1' testImplementation 'org.mockito.kotlin:mockito-kotlin:4.1.0' - testImplementation 'io.mockk:mockk:1.13.4' + testImplementation 'io.mockk:mockk:1.13.5' // Import the BoM for the Firebase platform - implementation platform('com.google.firebase:firebase-bom:31.1.0') + implementation platform('com.google.firebase:firebase-bom:31.5.0') // Add the dependency for the Firebase library // When using the BoM, you don't specify versions in Firebase library dependencies @@ -95,11 +100,11 @@ dependencies { implementation 'com.firebaseui:firebase-ui-storage:8.0.2' // Also add the dependency for the Google Play services library and specify its version - implementation 'com.google.android.gms:play-services-auth:20.4.1' + implementation 'com.google.android.gms:play-services-auth:20.5.0' // Add the dependency for Glide - implementation 'com.github.bumptech.glide:glide:4.15.0' - kapt 'com.github.bumptech.glide:compiler:4.15.0' + implementation 'com.github.bumptech.glide:glide:4.15.1' + kapt 'com.github.bumptech.glide:compiler:4.15.1' // Konfetti by https://github.com/DanielMartinus/Konfetti implementation 'nl.dionsegijn:konfetti-xml:2.0.2' diff --git a/app/src/androidTest/java/com/symphony/mrfit/ui/ExerciseTest.kt b/app/src/androidTest/java/com/symphony/mrfit/ui/ExerciseTest.kt new file mode 100644 index 0000000..eeeef0e --- /dev/null +++ b/app/src/androidTest/java/com/symphony/mrfit/ui/ExerciseTest.kt @@ -0,0 +1,69 @@ +/* + * Created by Team Symphony on 4/21/23, 10:18 PM + * Copyright (c) 2023 . All rights reserved. + * Last modified 4/21/23, 10:18 PM + */ + +package com.symphony.mrfit.ui + +import androidx.test.espresso.Espresso +import androidx.test.espresso.assertion.ViewAssertions +import androidx.test.espresso.matcher.ViewMatchers +import androidx.test.ext.junit.rules.activityScenarioRule +import androidx.test.filters.LargeTest +import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner +import com.symphony.mrfit.R +import org.hamcrest.Matchers +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4ClassRunner::class) +@LargeTest +class ExerciseTest { + + @Before + fun setUp() { + } + + @get:Rule + var activityScenarioRule = activityScenarioRule() + + /** + * Test if the activity is displayed and visible to user + */ + @Test + fun checkActivityVisibility() { + Espresso.onView(ViewMatchers.withId(R.id.layout_exerciseSelectionActivity)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + } + + /** + * Test if all the appropriate components are visible + */ + @Test + fun checkViewVisibility() { + Thread.sleep(500) + Espresso.onView(ViewMatchers.withId(R.id.exerciseScreenView)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.exerciseListView)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.exerciseSearchTextView)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.exerciseSearchEditText)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.exerciseSearchButton)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.button2)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.loadingSpinner)) + .check(ViewAssertions.matches(Matchers.not(ViewMatchers.isDisplayed()))) + } +} \ No newline at end of file diff --git a/app/src/androidTest/java/com/symphony/mrfit/ui/HomeActivityTest.kt b/app/src/androidTest/java/com/symphony/mrfit/ui/HomeActivityTest.kt new file mode 100644 index 0000000..f6576e3 --- /dev/null +++ b/app/src/androidTest/java/com/symphony/mrfit/ui/HomeActivityTest.kt @@ -0,0 +1,83 @@ +/* + * Created by Team Symphony on 4/21/23, 10:18 PM + * Copyright (c) 2023 . All rights reserved. + * Last modified 4/21/23, 10:18 PM + */ + +package com.symphony.mrfit.ui + +import androidx.test.espresso.Espresso +import androidx.test.espresso.assertion.ViewAssertions +import androidx.test.espresso.matcher.ViewMatchers +import androidx.test.ext.junit.rules.activityScenarioRule +import androidx.test.filters.LargeTest +import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner +import com.symphony.mrfit.R +import org.hamcrest.Matchers.not +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4ClassRunner::class) +@LargeTest +class HomeActivityTest { + + @Before + fun setUp() { + } + + @get:Rule + var activityScenarioRule = activityScenarioRule() + + /** + * Test if the activity is displayed and visible to user + */ + @Test + fun checkActivityVisibility() { + Espresso.onView(ViewMatchers.withId(R.id.layout_homeActivity)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + } + + /** + * Test if all the appropriate components are visible + */ + @Test + fun checkViewVisibility() { + Thread.sleep(1000) + Espresso.onView(ViewMatchers.withId(R.id.homeScreenView)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.userLayout)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.homeProfilePicture)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.homeWelcomeTextView)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.homeNameTextView)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + Espresso.onView(ViewMatchers.withId(R.id.homeScreenView)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.settingsCog)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.scheduleButton)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.pastWorkout)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.workoutButton)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.historyList)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.loadingSpinner)) + .check(ViewAssertions.matches(not(ViewMatchers.isDisplayed()))) + } +} \ No newline at end of file diff --git a/app/src/androidTest/java/com/symphony/mrfit/ui/RegisterActivityTest.kt b/app/src/androidTest/java/com/symphony/mrfit/ui/RegisterActivityTest.kt new file mode 100644 index 0000000..b7ffa8d --- /dev/null +++ b/app/src/androidTest/java/com/symphony/mrfit/ui/RegisterActivityTest.kt @@ -0,0 +1,56 @@ +/* + * Created by Team Symphony on 4/21/23, 5:08 PM + * Copyright (c) 2023 . All rights reserved. + * Last modified 4/21/23, 4:12 PM + */ + +package com.symphony.mrfit.ui + +import androidx.test.espresso.Espresso +import androidx.test.espresso.assertion.ViewAssertions +import androidx.test.espresso.matcher.ViewMatchers +import androidx.test.ext.junit.rules.activityScenarioRule +import androidx.test.filters.LargeTest +import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner +import com.symphony.mrfit.R +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4ClassRunner::class) +@LargeTest +class RegisterActivityTest { + + @get:Rule + var activityScenarioRule = activityScenarioRule() + + /** + * Test if the activity is displayed and visible to user + */ + @Test + fun checkActivityVisibility() { + Espresso.onView(ViewMatchers.withId(R.id.layout_registerActivity)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + } + + /** + * Test if all the components are visible + */ + @Test + fun checkViewVisibility() { + Espresso.onView(ViewMatchers.withId(R.id.registerEmail)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.registerPassword)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.confirmPassword)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.registerButton)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.toLoginTextView)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + } +} \ No newline at end of file diff --git a/app/src/androidTest/java/com/symphony/mrfit/ui/TemplateSelectionActivityTest.kt b/app/src/androidTest/java/com/symphony/mrfit/ui/TemplateSelectionActivityTest.kt new file mode 100644 index 0000000..b63420f --- /dev/null +++ b/app/src/androidTest/java/com/symphony/mrfit/ui/TemplateSelectionActivityTest.kt @@ -0,0 +1,60 @@ +/* + * Created by Team Symphony on 4/21/23, 10:18 PM + * Copyright (c) 2023 . All rights reserved. + * Last modified 4/21/23, 9:24 PM + */ + +package com.symphony.mrfit.ui + +import androidx.test.espresso.Espresso +import androidx.test.espresso.assertion.ViewAssertions +import androidx.test.espresso.matcher.ViewMatchers +import androidx.test.ext.junit.rules.activityScenarioRule +import androidx.test.filters.LargeTest +import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner +import com.symphony.mrfit.R +import org.hamcrest.Matchers +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4ClassRunner::class) +@LargeTest +class TemplateSelectionActivityTest { + + @Before + fun setUp() { + } + + @get:Rule + var activityScenarioRule = activityScenarioRule() + + /** + * Test if the activity is displayed and visible to user + */ + @Test + fun checkActivityVisibility() { + Espresso.onView(ViewMatchers.withId(R.id.layout_selectionActivity)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + } + + /** + * Test if all the appropriate components are visible + */ + @Test + fun checkViewVisibility() { + Thread.sleep(500) + Espresso.onView(ViewMatchers.withId(R.id.selectionScreenView)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.routineListView)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.newWorkoutButton)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.loadingSpinner)) + .check(ViewAssertions.matches(Matchers.not(ViewMatchers.isDisplayed()))) + } +} \ No newline at end of file diff --git a/app/src/androidTest/java/com/symphony/mrfit/ui/UserProfileActivityTest.kt b/app/src/androidTest/java/com/symphony/mrfit/ui/UserProfileActivityTest.kt new file mode 100644 index 0000000..851d757 --- /dev/null +++ b/app/src/androidTest/java/com/symphony/mrfit/ui/UserProfileActivityTest.kt @@ -0,0 +1,99 @@ +/* + * Created by Team Symphony on 4/21/23, 10:18 PM + * Copyright (c) 2023 . All rights reserved. + * Last modified 4/21/23, 8:55 PM + */ + +package com.symphony.mrfit.ui + +import androidx.test.espresso.Espresso +import androidx.test.espresso.assertion.ViewAssertions +import androidx.test.espresso.matcher.ViewMatchers +import androidx.test.ext.junit.rules.activityScenarioRule +import androidx.test.filters.LargeTest +import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner +import com.symphony.mrfit.R +import org.hamcrest.Matchers +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4ClassRunner::class) +@LargeTest +class UserProfileActivityTest { + + @Before + fun setUp() { + } + + @get:Rule + var activityScenarioRule = activityScenarioRule() + + /** + * Test if the activity is displayed and visible to user + */ + @Test + fun checkActivityVisibility() { + Espresso.onView(ViewMatchers.withId(R.id.layout_profileActivity)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + } + + /** + * Test if all the appropriate components are visible + */ + @Test + fun checkViewVisibility() { + Thread.sleep(500) + Espresso.onView(ViewMatchers.withId(R.id.profileScreenView)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.profilePicture)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.profileNameTextView)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.editProfileButton)) + .check(ViewAssertions.matches(Matchers.not(ViewMatchers.isDisplayed()))) + + Espresso.onView(ViewMatchers.withId(R.id.heightLayout)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.weightLayout)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.ageLayout)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.stuffLayout)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.goalsButton)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.notificationsButton)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.historyButton)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.customExercisesButton)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.settingLayout)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.notificationToggle)) + .check(ViewAssertions.matches(Matchers.not(ViewMatchers.isDisplayed()))) + + Espresso.onView(ViewMatchers.withId(R.id.logoutButton)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.deleteButton)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.loadingSpinner)) + .check(ViewAssertions.matches(Matchers.not(ViewMatchers.isDisplayed()))) + } +} \ No newline at end of file diff --git a/app/src/androidTest/java/com/symphony/mrfit/ui/WorkoutRoutineActivityTest.kt b/app/src/androidTest/java/com/symphony/mrfit/ui/WorkoutRoutineActivityTest.kt new file mode 100644 index 0000000..317caf6 --- /dev/null +++ b/app/src/androidTest/java/com/symphony/mrfit/ui/WorkoutRoutineActivityTest.kt @@ -0,0 +1,92 @@ +/* + * Created by Team Symphony on 4/21/23, 10:18 PM + * Copyright (c) 2023 . All rights reserved. + * Last modified 4/21/23, 10:18 PM + */ + +package com.symphony.mrfit.ui + +import android.content.Intent +import androidx.test.core.app.ApplicationProvider +import androidx.test.espresso.Espresso +import androidx.test.espresso.assertion.ViewAssertions +import androidx.test.espresso.matcher.ViewMatchers +import androidx.test.ext.junit.rules.activityScenarioRule +import androidx.test.filters.LargeTest +import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner +import com.symphony.mrfit.R +import org.hamcrest.Matchers +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4ClassRunner::class) +@LargeTest +class WorkoutRoutineActivityTest { + + @Before + fun setUp() { + } + + @get:Rule + var activityScenarioRule = activityScenarioRule( + intent = Intent( + ApplicationProvider.getApplicationContext(), + WorkoutRoutineActivity::class.java + ) + .putExtra(WorkoutTemplateActivity.EXTRA_IDENTITY, "test") + ) + + /** + * Test if the activity is displayed and visible to user + */ + @Test + fun checkActivityVisibility() { + Espresso.onView(ViewMatchers.withId(R.id.layout_workoutBuilderActivity)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + } + + /** + * Test if all the appropriate components are visible + */ + @Test + fun checkViewVisibility() { + Thread.sleep(1000) + Espresso.onView(ViewMatchers.withId(R.id.routineScreenView)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.headerLayout)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.routineNameEditText)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.workoutPlaylistEditText)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.openPlaylistButton)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.workoutListView)) + .check(ViewAssertions.matches(Matchers.not(ViewMatchers.isDisplayed()))) + + Espresso.onView(ViewMatchers.withId(R.id.routineScreenButtons)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.startWorkoutButton)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.newExerciseButton)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.saveWorkoutButton)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.deleteWorkoutButton)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.loadingSpinner)) + .check(ViewAssertions.matches(Matchers.not(ViewMatchers.isDisplayed()))) + } +} \ No newline at end of file diff --git a/app/src/androidTest/java/com/symphony/mrfit/ui/WorkoutTemplateActivityTest.kt b/app/src/androidTest/java/com/symphony/mrfit/ui/WorkoutTemplateActivityTest.kt new file mode 100644 index 0000000..e96a27b --- /dev/null +++ b/app/src/androidTest/java/com/symphony/mrfit/ui/WorkoutTemplateActivityTest.kt @@ -0,0 +1,85 @@ +/* + * Created by Team Symphony on 4/21/23, 10:18 PM + * Copyright (c) 2023 . All rights reserved. + * Last modified 4/21/23, 10:18 PM + */ + +package com.symphony.mrfit.ui + +import android.content.Intent +import androidx.test.core.app.ApplicationProvider +import androidx.test.espresso.Espresso +import androidx.test.espresso.assertion.ViewAssertions +import androidx.test.espresso.matcher.ViewMatchers +import androidx.test.ext.junit.rules.activityScenarioRule +import androidx.test.filters.LargeTest +import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner +import com.symphony.mrfit.R +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4ClassRunner::class) +@LargeTest +class WorkoutTemplateActivityTest { + + @Before + fun setUp() { + } + + @get:Rule + var activityScenarioRule = activityScenarioRule( + intent = Intent( + ApplicationProvider.getApplicationContext(), + WorkoutTemplateActivity::class.java + ) + .putExtra(WorkoutRoutineActivity.EXTRA_ROUTINE, "test") + .putExtra(WorkoutTemplateActivity.EXTRA_IDENTITY, "test") + .putExtra(WorkoutTemplateActivity.EXTRA_EXERCISE, "test") + .putExtra(WorkoutTemplateActivity.EXTRA_LIST, ArrayList()) + ) + + /** + * Test if the activity is displayed and visible to user + */ + @Test + fun checkActivityVisibility() { + Espresso.onView(ViewMatchers.withId(R.id.layout_exerciseBuilderActivity)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + } + + /** + * Test if all the appropriate components are visible + */ + @Test + fun checkViewVisibility() { + Thread.sleep(500) + Espresso.onView(ViewMatchers.withId(R.id.templateScreenView)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.exerciseCardView)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.editDuration)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.editDistance)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.repsAndSetsLayout)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.editReps)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.editSets)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.deleteTemplateButton)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + + Espresso.onView(ViewMatchers.withId(R.id.saveTemplateButton)) + .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/symphony/mrfit/ui/WorkoutRoutineActivity.kt b/app/src/main/java/com/symphony/mrfit/ui/WorkoutRoutineActivity.kt index 7fc296b..51fd8bb 100644 --- a/app/src/main/java/com/symphony/mrfit/ui/WorkoutRoutineActivity.kt +++ b/app/src/main/java/com/symphony/mrfit/ui/WorkoutRoutineActivity.kt @@ -1,7 +1,7 @@ /* - * Created by Team Symphony on 4/20/23, 2:11 AM + * Created by Team Symphony on 4/21/23, 10:18 PM * Copyright (c) 2023 . All rights reserved. - * Last modified 4/20/23, 2:08 AM + * Last modified 4/21/23, 9:57 PM */ package com.symphony.mrfit.ui @@ -81,7 +81,6 @@ class WorkoutRoutineActivity : AppCompatActivity() { placeholderText.visibility = View.VISIBLE workoutList.visibility = View.GONE - spinner.visibility = View.VISIBLE /** * Retrieve the extras passed to this intent @@ -109,6 +108,7 @@ class WorkoutRoutineActivity : AppCompatActivity() { routinePlaylist.setText(BLANK) } if (routine.workoutList != null) { + spinner.visibility = View.VISIBLE placeholderText.visibility = View.GONE workoutList.visibility = View.VISIBLE passedList = routine.workoutList diff --git a/app/src/main/res/layout/activity_exercise.xml b/app/src/main/res/layout/activity_exercise.xml index 5a040ec..290e077 100644 --- a/app/src/main/res/layout/activity_exercise.xml +++ b/app/src/main/res/layout/activity_exercise.xml @@ -1,19 +1,21 @@ - + diff --git a/app/src/main/res/layout/activity_routine_selection.xml b/app/src/main/res/layout/activity_routine_selection.xml index ec3be1f..b682128 100644 --- a/app/src/main/res/layout/activity_routine_selection.xml +++ b/app/src/main/res/layout/activity_routine_selection.xml @@ -1,13 +1,14 @@ diff --git a/app/src/main/res/layout/activity_user_profile.xml b/app/src/main/res/layout/activity_user_profile.xml index dd950a8..0adfb7d 100644 --- a/app/src/main/res/layout/activity_user_profile.xml +++ b/app/src/main/res/layout/activity_user_profile.xml @@ -1,13 +1,14 @@ @@ -15,7 +16,9 @@ + android:layout_height="match_parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> @@ -33,8 +30,8 @@ android:visibility="visible" /> @@ -84,8 +81,8 @@ android:layout_height="wrap_content" android:layout_marginEnd="5dp" android:layout_weight="1" - android:hint="@string/hint_reps" android:digits="0123456789." + android:hint="@string/hint_reps" android:inputType="numberDecimal" android:maxLength="4" android:visibility="visible" /> @@ -105,8 +102,8 @@ android:layout_height="wrap_content" android:layout_marginStart="5dp" android:layout_weight="1" - android:hint="@string/hint_sets" android:digits="0123456789." + android:hint="@string/hint_sets" android:inputType="numberDecimal" android:maxLength="4" /> diff --git a/app/src/main/res/layout/card_goal.xml b/app/src/main/res/layout/card_goal.xml index 13c4270..a5a82d0 100644 --- a/app/src/main/res/layout/card_goal.xml +++ b/app/src/main/res/layout/card_goal.xml @@ -1,7 +1,7 @@ diff --git a/app/src/main/res/layout/card_history.xml b/app/src/main/res/layout/card_history.xml index fdaf71a..96d8a85 100644 --- a/app/src/main/res/layout/card_history.xml +++ b/app/src/main/res/layout/card_history.xml @@ -25,7 +25,8 @@ will add padding in API v21+ as well to have the same measurements with previous diff --git a/app/src/main/res/layout/popup_new_exercise.xml b/app/src/main/res/layout/popup_new_exercise.xml index 6b6e2d8..6958cbc 100644 --- a/app/src/main/res/layout/popup_new_exercise.xml +++ b/app/src/main/res/layout/popup_new_exercise.xml @@ -1,7 +1,7 @@ + android:inputType="textLongMessage|text" /> + android:inputType="textLongMessage|text" />