Skip to content

Commit

Permalink
NotificationTest.kt passed
Browse files Browse the repository at this point in the history
  • Loading branch information
azzumw committed Mar 5, 2022
1 parent 9a48700 commit 92d4060
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.watermeproject

import android.util.Log
import androidx.test.espresso.Espresso
import androidx.test.espresso.action.ViewActions
import androidx.test.espresso.matcher.ViewMatchers
Expand All @@ -16,17 +17,14 @@ import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class NotificationTest {

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class NotificationTest {

private val timeout: Long = 6000

private val plantName = "Carrot"
Expand Down Expand Up @@ -60,9 +58,11 @@ class NotificationTest {
notification.click()
uiDevice.wait(Until.hasObject(By.pkg("com.example.waterme")
.depth(0)), 1000)
val pkg = uiDevice.findObject(UiSelector().packageName("com.example.waterme"))
val context = InstrumentationRegistry.getInstrumentation().targetContext
val packageName = context.packageName
Log.e("TEST",packageName)
val pkg = uiDevice.findObject(UiSelector().packageName(packageName))
.exists()
Assert.assertTrue("Could not find package", pkg)
}
}
}

0 comments on commit 92d4060

Please sign in to comment.