-
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.
Merge branch 'NicoleCalderon' into dev
- Loading branch information
Showing
7 changed files
with
134 additions
and
37 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
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
45 changes: 45 additions & 0 deletions
45
app/src/androidTest/java/com/symphony/mrfit/ui/NotificationActivityTest.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,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())) | ||
}*/ | ||
} |
41 changes: 41 additions & 0 deletions
41
app/src/androidTest/java/com/symphony/mrfit/ui/PostWorkoutActivityTest.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,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()))*/ | ||
|
||
} | ||
} |
61 changes: 26 additions & 35 deletions
61
app/src/androidTest/java/com/symphony/mrfit/ui/RegisterActivityTest.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 |
---|---|---|
@@ -1,57 +1,48 @@ | ||
/* | ||
* 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.test.espresso.Espresso | ||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed | ||
import androidx.test.espresso.Espresso.onView | ||
import androidx.test.espresso.action.ViewActions | ||
import androidx.test.espresso.assertion.ViewAssertions | ||
import androidx.test.espresso.matcher.ViewMatchers | ||
import androidx.test.espresso.matcher.ViewMatchers.withId | ||
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.Assert.* | ||
import org.junit.Rule | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
@RunWith(AndroidJUnit4ClassRunner::class) | ||
@LargeTest | ||
class RegisterActivityTest { | ||
|
||
@get:Rule | ||
var activityScenarioRule = activityScenarioRule<RegisterActivity>() | ||
|
||
/** | ||
* Test if the activity is displayed and visible to user | ||
*/ | ||
|
||
|
||
/*tests if register works*/ | ||
@Test | ||
fun checkActivityVisibility() { | ||
Espresso.onView(withId(R.id.layout_registerActivity)) | ||
.check(matches(isDisplayed())) | ||
fun checkValidRegister() { | ||
onView(withId(R.id.registerEmail)) | ||
.perform(ViewActions.typeText(REAL_EMAIL)) | ||
onView(withId(R.id.registerPassword)) | ||
.perform(ViewActions.typeText(LoginActivityTest.REAL_PASS), ViewActions.closeSoftKeyboard()) | ||
onView(withId(R.id.registerButton)) | ||
.perform(ViewActions.click()) | ||
} | ||
|
||
/** | ||
* Test if all the components are visible | ||
*/ | ||
/*tests if empty email/pass gives error*/ | ||
@Test | ||
fun checkViewVisibility() { | ||
Espresso.onView(withId(R.id.registerEmail)) | ||
.check(matches(isDisplayed())) | ||
|
||
Espresso.onView(withId(R.id.registerPassword)) | ||
.check(matches(isDisplayed())) | ||
|
||
Espresso.onView(withId(R.id.confirmPassword)) | ||
.check(matches(isDisplayed())) | ||
fun checkInvalidRegister() { | ||
onView(withId(R.id.registerEmail)) | ||
.perform(ViewActions.typeText(TEST_EMAIL)) | ||
} | ||
|
||
Espresso.onView(withId(R.id.registerButton)) | ||
.check(matches(isDisplayed())) | ||
companion object { | ||
|
||
Espresso.onView(withId(R.id.toLoginTextView)) | ||
.check(matches(isDisplayed())) | ||
const val REAL_EMAIL = "[email protected]" | ||
const val REAL_PASS = "abcd1234" | ||
const val TEST_EMAIL = "" | ||
const val TEST_PASS = "" | ||
} | ||
} |
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
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