Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolekaate committed Apr 22, 2023
2 parents 2745b4a + cb880ba commit 95a103b
Show file tree
Hide file tree
Showing 63 changed files with 2,427 additions and 728 deletions.
37 changes: 25 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,39 +40,52 @@ 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.espresso:espresso-contrib:3.5.1') {
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'recyclerview-v7'
exclude module: "protobuf-lite"
}
androidTestImplementation "org.hamcrest:hamcrest:2.2"
androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestImplementation 'androidx.test:rules:1.5.0'
androidTestImplementation 'androidx.test:core:1.5.0'
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
Expand All @@ -95,11 +108,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'
Expand Down
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() {
}
}
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"
}
}
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() {

}
}
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(){
}

}
Loading

0 comments on commit 95a103b

Please sign in to comment.