Skip to content

Commit

Permalink
basic unit tests #75
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolekaate committed Apr 22, 2023
1 parent 35eda03 commit 6f20a62
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.symphony.mrfit.ui

import androidx.test.espresso.Espresso
import androidx.test.espresso.assertion.ViewAssertions
import androidx.test.espresso.matcher.ViewMatchers
import com.symphony.mrfit.R
import org.junit.Assert.*

import org.junit.Test
import org.mockito.Mockito;
import org.mockito.Mockito.`when`


class NotificationActivityTest {

//TODO: cant figure out tests for notif activity

/*@Test
fun getHasNotificationPermissionGranted() {
}
@Test
fun setHasNotificationPermissionGranted() {
}*/

//tests if the activity is displayed and visible to user
/*@Test
fun checkActivityVisibility() {
Espresso.onView(ViewMatchers.withId(R.id.layout_notifActivity))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
}
//tests if date picker and time picker are visible
@Test
fun checkViewVisibility() {
Espresso.onView(ViewMatchers.withId(R.id.datePicker))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
Espresso.onView(ViewMatchers.withId(R.id.timePicker))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
}*/
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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 com.symphony.mrfit.R
import org.junit.Assert.*
import org.junit.Rule

import org.junit.Test

class PostWorkoutActivityTest {

@get:Rule
var activityScenarioRule = activityScenarioRule<PostWorkoutActivity>()

//tests if the activity is displayed and visible to user
@Test
fun checkActivityVisibility() {
Espresso.onView(ViewMatchers.withId(R.id.layout_postWorkoutActivity))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
}

//tests if components are visible
@Test
fun checkViewVisibility() {
Espresso.onView(ViewMatchers.withId(R.id.postWorkoutTitle))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))

Espresso.onView(ViewMatchers.withId(R.id.postWorkoutTime))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))

/*Espresso.onView(ViewMatchers.withId(R.id.gotoGoalsButton))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
Espresso.onView(ViewMatchers.withId(R.id.returnHomeButton))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))*/

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class RegisterActivityTest {
@get:Rule
var activityScenarioRule = activityScenarioRule<RegisterActivity>()



/*tests if register works*/
@Test
fun checkValidRegister() {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_notification.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/layout_notifActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_post_workout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/layout_postWorkoutActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.PostWorkoutActivity">
Expand Down

0 comments on commit 6f20a62

Please sign in to comment.