Skip to content

Commit

Permalink
tests: Utilize NotificationManager to prevent test failures from hidd…
Browse files Browse the repository at this point in the history
…en notifications
  • Loading branch information
devinbileck committed Jan 9, 2025
1 parent b6a0858 commit bc6a096
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/src/androidTest/java/bisq/android/tests/NotificationTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package bisq.android.tests

import android.app.Notification
import android.app.NotificationManager
import android.content.Context
import android.os.Build
import androidx.test.core.app.ApplicationProvider
Expand Down Expand Up @@ -117,11 +119,13 @@ class NotificationTest {
val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
device.openNotification()
device.wait(Until.hasObject(By.text("Bisq")), WAIT_CONDITION_TIMEOUT_MS)
val manager = applicationContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
bisqNotifications.forEach { bisqNotification ->
val title: UiObject2 = device.getObject(By.text(bisqNotification.title!!))
val text: UiObject2 = device.getObject(By.text(bisqNotification.message!!))
assertThat(title.text).isEqualTo(bisqNotification.title)
assertThat(text.text).isEqualTo(bisqNotification.message)
assertThat(
manager.activeNotifications.find {
it.notification.extras.getString(Notification.EXTRA_TEXT).equals(bisqNotification.message)
}
).isNotNull
}
}

Expand Down

0 comments on commit bc6a096

Please sign in to comment.