package Ġm ba as . com . n if cloud . kotlin payload app Ċ Ċ import Ġandroidx . test . espress o . Esp ress o . on Data Ċ import Ġandroidx . test . espress o . Esp ress o . on View Ċ import Ġandroidx . test . espress o . matcher . View Matchers .* Ċ import Ġandroidx . test . internal . runner . junit 4 . Android JUnit 4 Class Runner Ċ import Ġandroidx . test . platform . app . Instrumentation Registry Ċ import Ġandroidx . test . rule . Activity Test Rule Ċ import Ġandroidx . test . uia utom ator . By Ċ import Ġandroidx . test . uia utom ator . Ui Device Ċ import Ġandroidx . test . uia utom ator . Ui Object 2 Ċ import Ġandroidx . test . uia utom ator . Until Ċ import Ġm ba as . com . n if cloud . kotlin payload app . Utils . send Push With Search Condition Ċ import Ġorg . hamcrest . Core Matchers .* Ċ import Ġorg . junit . Assert Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . junit . Assert . assertEquals ĊĊ Ċ private Ġconst Ġval ĠTIME OUT Ġ= Ġ 1 5 0 0 0 0 L Ċ Ċ @ RunWith ( Android JUnit 4 Class Runner :: class ) Ċ class ĠApplication Test Ġ{ ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġdevice : ĠUi Device ĊĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġvar Ġm Activity Rule : ĠActivity Test Rule < MainActivity > Ġ= ĠActivity Test Rule ( MainActivity :: class . java ) ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġinit () Ġ{ ĊĠĠĠĠĠĠĠ Ġdevice Ġ= ĠUi Device . getInstance ( Instrumentation Registry . get Instrumentation ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġuse AppContext () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġapp Context Ġ= ĠInstrument ation Registry . get Instrumentation (). target Context ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals (" mb a as . com . n if cloud . kotlin payload app ", Ġapp Context . packageName ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġvalidate Display Screen () Ġ{ ĊĠĠĠĠĠĠĠ Ġon View ( all Of ( with Text (" Kotlin Payload App "), Ġis Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( all Of ( with Text (" com . n if cloud . mb a as . push Id "), Ġis Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( all Of ( with Text (" com . n if cloud . mb a as . rich Url "), Ġis Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( all Of ( with Text (" data Ġ( JSON )"), Ġis Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( all Of ( with Id ( R . id . txt Push id ), Ġwith Text (" "))) ĊĠĠĠĠĠĠĠ Ġon View ( all Of ( with Id ( R . id . txt Rich url ), Ġwith Text (" "))) ĊĠĠĠĠĠĠĠ Ġon Data ( all Of (` is `( instance Of ( String . java Class )), Ġ` is ` (" Key : ĠNo Ġkey ")) ). in Adapter View ( with Id ( R . id . ls Json )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( InterruptedException :: class ) ĊĠĠĠ Ġfun Ġclick On Send Notification () Ġ{ ĊĠĠĠĠĠĠĠ Ġsend Push With Search Condition () ĊĠĠĠĠĠĠĠ Ġdevice . open Notification () ĊĠĠĠĠĠĠĠ Ġdevice . wait ( Until . has Object ( By . text ( NOTIFICATION _ TITLE )), ĠTIME OUT . to Long ()) ĊĠĠĠĠĠĠĠ Ġval Ġtitle : ĠUi Object 2 Ġ= Ġdevice . find Object ( By . text ( NOTIFICATION _ TITLE )) ĊĠĠĠĠĠĠĠ Ġval Ġtext : ĠUi Object 2 Ġ= Ġdevice . find Object ( By . text ( NOTIFICATION _ TEXT )) ĊĠĠĠĠĠĠĠ ĠassertEquals ( NOTIFICATION _ TITLE , Ġtitle . text ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( NOTIFICATION _ TEXT , Ġtext . text ) ĊĠĠĠĠĠĠĠ Ġtitle . click () ĊĠĠĠ Ġ} Ċ }