-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from mokhtarmoustafa/Create_test_using_junit_f…
…or_bottom_bar_#9 Create test using junit for bottom bar #9
- Loading branch information
Showing
2 changed files
with
58 additions
and
9 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
50 changes: 50 additions & 0 deletions
50
app/src/androidTest/java/com/example/anotoapp/MainActivityBottomNavigationTest.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,50 @@ | ||
package com.example.anotoapp | ||
|
||
import androidx.test.espresso.Espresso.onView | ||
import androidx.test.espresso.action.ViewActions.click | ||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed | ||
import androidx.test.espresso.matcher.ViewMatchers.withId | ||
import androidx.test.ext.junit.rules.ActivityScenarioRule | ||
import kotlinx.coroutines.delay | ||
import kotlinx.coroutines.runBlocking | ||
import kotlinx.coroutines.withContext | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
|
||
class MainActivityBottomNavigationTest { | ||
|
||
@get:Rule | ||
var activityRule = ActivityScenarioRule( | ||
MainActivity::class.java | ||
) | ||
|
||
@Test | ||
fun testBottomNavigation() { | ||
runBlocking { | ||
|
||
delay(2000) | ||
onView(withId(R.id.frameLayout)).check(matches(isDisplayed())) | ||
|
||
// home | ||
onView(withId(R.id.home)) | ||
.perform(click()) | ||
delay(1000) | ||
|
||
//task | ||
onView(withId(R.id.frameLayout)).check(matches(isDisplayed())) | ||
onView(withId(R.id.task)) | ||
.perform(click()) | ||
delay(1000) | ||
|
||
//profile | ||
onView(withId(R.id.frameLayout)).check(matches(isDisplayed())) | ||
onView(withId(R.id.profile)) | ||
.perform(click()) | ||
delay(1000) | ||
|
||
onView(withId(R.id.frameLayout)).check(matches(isDisplayed())) | ||
} | ||
} | ||
} |