-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
63 changed files
with
2,427 additions
and
728 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
app/src/androidTest/java/com/symphony/mrfit/ui/CalendarActivityTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.symphony.mrfit.ui | ||
|
||
import org.junit.Assert.* | ||
|
||
import org.junit.Test | ||
|
||
class CalendarActivityTest { | ||
//behavioral | ||
@Test | ||
fun onCreate() { | ||
} | ||
@Test | ||
fun onStart() { | ||
} | ||
@Test | ||
fun onSupportNavigateUp() { | ||
} | ||
} |
150 changes: 150 additions & 0 deletions
150
app/src/androidTest/java/com/symphony/mrfit/ui/CoreFunctionalityTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
/* | ||
* Created by Team Symphony on 4/22/23, 6:21 AM | ||
* Copyright (c) 2023 . All rights reserved. | ||
* Last modified 4/22/23, 6:05 AM | ||
*/ | ||
|
||
package com.symphony.mrfit.ui | ||
|
||
import androidx.recyclerview.widget.RecyclerView | ||
import androidx.test.espresso.Espresso | ||
import androidx.test.espresso.action.ViewActions.* | ||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
import androidx.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition | ||
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 CoreFunctionalityTest { | ||
|
||
@get:Rule | ||
var activityScenarioRule = activityScenarioRule<MainActivity>() | ||
|
||
/** | ||
* Test a run through of the app's core functionality. It should: | ||
* Log in with the credentials '[email protected]' and 'pass123' | ||
* Start a new workout | ||
* Make a new workout called "Automated Testing" | ||
* Add 3 exercises to it, whichever 3 are at the top of the list | ||
* Start the workout, wait 5 seconds, then finish the workout | ||
* Return to the home screen after | ||
* Navigate to and delete this new workout | ||
* Navigate to the user's profile and log out | ||
*/ | ||
@Test | ||
fun coreFunctionality() { | ||
// Wait to automatically move past welcome screen | ||
Thread.sleep(100) | ||
Espresso.onView(withId(R.id.layout_loginActivity)) | ||
.check(matches(isDisplayed())) | ||
|
||
// Attempt to log in | ||
Espresso.onView(withId(R.id.loginEmail)) | ||
.perform(typeText(TEST_EMAIL), closeSoftKeyboard()) | ||
Thread.sleep(500) | ||
Espresso.onView(withId(R.id.loginPassword)) | ||
.perform(typeText(TEST_PASS), closeSoftKeyboard()) | ||
Thread.sleep(500) | ||
Espresso.onView(withId(R.id.loginButton)) | ||
.perform(click()) | ||
Thread.sleep(1000) | ||
Espresso.onView(withId(R.id.layout_homeActivity)) | ||
.check(matches(isDisplayed())) | ||
|
||
// Navigate to the Template selection screen | ||
Espresso.onView(withId(R.id.workoutButton)) | ||
.perform(click()) | ||
Thread.sleep(1000) | ||
Espresso.onView(withId(R.id.layout_selectionActivity)) | ||
.check(matches(isDisplayed())) | ||
|
||
// Make a new workout and name it | ||
Espresso.onView(withId(R.id.newWorkoutButton)) | ||
.perform(click()) | ||
Thread.sleep(500) | ||
Espresso.onView(withId(R.id.routineNameEditText)) | ||
.perform(clearText()) | ||
.perform(typeText(TEST_TEMPLATE), closeSoftKeyboard()) | ||
|
||
// Add 3 exercises | ||
// 1st Exercise | ||
Thread.sleep(1000) | ||
Espresso.onView(withId(R.id.newExerciseButton)) | ||
.perform(click()) | ||
Thread.sleep(500) | ||
Espresso.onView(withId(R.id.exerciseListView)) | ||
.perform(actionOnItemAtPosition<RecyclerView.ViewHolder>(0, click())) | ||
Thread.sleep(500) | ||
Espresso.onView(withId(R.id.saveTemplateButton)) | ||
.perform(click()) | ||
Thread.sleep(1000) | ||
// 2nd Exercise | ||
Espresso.onView(withId(R.id.newExerciseButton)) | ||
.perform(click()) | ||
Thread.sleep(500) | ||
Espresso.onView(withId(R.id.exerciseListView)) | ||
.perform(actionOnItemAtPosition<RecyclerView.ViewHolder>(1, click())) | ||
Thread.sleep(500) | ||
Espresso.onView(withId(R.id.saveTemplateButton)) | ||
.perform(click()) | ||
Thread.sleep(1000) | ||
// 3rd Exercise | ||
Espresso.onView(withId(R.id.newExerciseButton)) | ||
.perform(click()) | ||
Thread.sleep(500) | ||
Espresso.onView(withId(R.id.exerciseListView)) | ||
.perform(actionOnItemAtPosition<RecyclerView.ViewHolder>(2, click())) | ||
Thread.sleep(500) | ||
Espresso.onView(withId(R.id.saveTemplateButton)) | ||
.perform(click()) | ||
Thread.sleep(1000) | ||
|
||
// Start the workout and finish it after 10 seconds | ||
Espresso.onView(withId(R.id.startWorkoutButton)) | ||
.perform(click()) | ||
Espresso.onView(withId(R.id.layout_currentActivity)) | ||
.check(matches(isDisplayed())) | ||
Thread.sleep(10000) | ||
Espresso.onView(withId(R.id.finishWorkoutButton)) | ||
.perform(click()) | ||
Espresso.onView(withText("Good job!")).check(matches(isDisplayed())) | ||
Espresso.onView(withText("Return Home")).perform(click()) | ||
|
||
// Navigate back and delete workout | ||
Thread.sleep(1000) | ||
Espresso.onView(withId(R.id.workoutButton)) | ||
.perform(click()) | ||
Thread.sleep(1000) | ||
Espresso.onView(withId(R.id.layout_selectionActivity)) | ||
.check(matches(isDisplayed())) | ||
Espresso.onView(withText(TEST_TEMPLATE)) | ||
.perform(click()) | ||
Thread.sleep(1000) | ||
Espresso.onView(withId(R.id.deleteWorkoutButton)) | ||
.perform(click()) | ||
Espresso.pressBack() | ||
Thread.sleep(1000) | ||
|
||
// Navigate to user profile and log out | ||
Espresso.onView(withId(R.id.userLayout)) | ||
.perform(click()) | ||
Thread.sleep(1000) | ||
Espresso.onView(withId(R.id.layout_profileActivity)) | ||
.check(matches(isDisplayed())) | ||
Espresso.onView(withId(R.id.logoutButton)) | ||
.perform(click()) | ||
} | ||
|
||
companion object { | ||
const val TEST_EMAIL = "[email protected]" | ||
const val TEST_PASS = "pass123" | ||
const val TEST_TEMPLATE = "Automated Testing" | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
app/src/androidTest/java/com/symphony/mrfit/ui/CurrentWorkoutActivityTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.symphony.mrfit.ui | ||
import android.content.ComponentName | ||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.test.core.app.ActivityScenario | ||
import androidx.test.core.app.ApplicationProvider | ||
import androidx.test.ext.junit.rules.activityScenarioRule | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.rule.ActivityTestRule | ||
import org.junit.After | ||
import org.junit.Assert.* | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.Assert.assertEquals | ||
|
||
|
||
|
||
|
||
@RunWith(AndroidJUnit4::class) | ||
class CurrentWorkoutActivityTest { | ||
//behavioral | ||
@Test | ||
fun onCreate() { | ||
|
||
} | ||
//behavioral | ||
@Test | ||
fun onStart() { | ||
|
||
} | ||
@Test | ||
fun gotoHome() { | ||
// Start the activity | ||
val context = ApplicationProvider.getApplicationContext<Context>() | ||
val intent = Intent(context, HomeActivity::class.java) | ||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) | ||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) | ||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) | ||
|
||
val expectedFlags = (Intent.FLAG_ACTIVITY_CLEAR_TOP or | ||
Intent.FLAG_ACTIVITY_CLEAR_TASK or | ||
Intent.FLAG_ACTIVITY_NEW_TASK) | ||
|
||
assertEquals(expectedFlags, intent.flags) | ||
assertEquals(context.packageName, intent.component?.packageName) | ||
assertEquals(HomeActivity::class.java.name, intent.component?.className) | ||
} | ||
//behavioral | ||
@Test | ||
fun onSupportNavigateUp() { | ||
|
||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
app/src/androidTest/java/com/symphony/mrfit/ui/CustomExercisesActivityTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.symphony.mrfit.ui | ||
|
||
import androidx.test.core.app.ApplicationProvider | ||
import com.symphony.mrfit.data.exercise.ExerciseViewModel | ||
import com.symphony.mrfit.data.model.Exercise | ||
import org.junit.Assert.* | ||
import org.junit.Before | ||
|
||
import org.junit.Test | ||
|
||
class CustomExercisesActivityTest { | ||
//behavioral | ||
//TODO | ||
@Test | ||
fun onCreate() { | ||
} | ||
@Test | ||
fun onStart() { | ||
} | ||
@Test | ||
fun onSupportNavigateUp() { | ||
} | ||
@Test | ||
fun deleteExercise(){ | ||
} | ||
|
||
} |
Oops, something went wrong.