package Ġorg . wikipedia . search Ċ Ċ import Ġandroid . content . Intent Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġandroidx . test . core . app . Application Provider Ċ import Ġandroidx . test . espress o . Esp ress o Ċ import Ġandroidx . test . espress o . Esp ress o . on View Ċ import Ġandroidx . test . espress o . action . View Actions Ċ import Ġandroidx . test . espress o . assertion . View Assertions . matches Ċ import Ġandroidx . test . espress o . contrib . RecyclerView Actions Ċ import Ġandroidx . test . espress o . matcher . View Matchers .* Ċ import Ġandroidx . test . ext . junit . rules . Activity Scenario Rule Ċ import Ġandroidx . test . ext . junit . runners . Android JUnit 4 Ċ import Ġandroidx . test . filters . Large Test Ċ import Ġandroidx . test . platform . app . Instrumentation Registry Ċ import Ġandroidx . test . uia utom ator . Ui Device Ċ import Ġorg . hamcrest . Matchers . all Of Ċ import Ġorg . hamcrest . Matchers . not Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . wikipedia . Constants Ċ import Ġorg . wikipedia . R Ċ import Ġorg . wikipedia . TestUtil Ċ Ċ @ Large Test Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class Ġclear Recent Search Ġ{ ĊĊĠĠĠ Ġ@ Rule ĊĠĠĠ Ġ@ Jvm Field ĊĠĠĠ Ġvar Ġm Activity Test Rule Ġ= ĠActivity Scenario Rule < Search Activity >( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠIntent ( Application Provider . getApplicationContext (), ĠSearch Activity :: class . java ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. setAction ( Intent . ACTION _ SEND ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. setType ( Constants . PLAIN _ TEXT _ MIME _ TYPE ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. putExtra ( Intent . EXTRA _ TEXT , Ġ" D are dev il ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. setType ( Constants . ACTIVITY _ REQUEST _ OPEN _ SEARCH _ ACTIVITY . toString ()) ĊĊĊĠĠĠ Ġ) ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġclear Search () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdevice Ġ= ĠUi Device . getInstance ( Instrumentation Registry . get Instrumentation ()) ĊĊĠĠĠĠĠĠĠ Ġon View ( all Of ( with Id ( R . id . search _ toolbar ), Ġis Displayed ())) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . type Text (" D are dev il ")) ĊĠĠĠĠĠĠĠ ĠTest Util . delay ( 5 ) ĊĠĠĠĠĠĠĠ Ġon View ( all Of ( with Id ( R . id . list _ title ), Ġis Displayed ())) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠ ĠTest Util . delay ( 5 ) ĊĠĠĠĠĠĠĠ Ġon View ( all Of ( with Id ( R . id . page _ toolbar _ button _ search ), Ġis Displayed ())) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠ ĠTest Util . delay ( 5 ) ĊĠĠĠĠĠĠĠ Ġon View ( all Of ( with Text (" Recent ĠS ear ches "), Ġis Displayed ())) ĊĠĠĠĠĠĠĠ ĠTest Util . delay ( 5 ) ĊĠĠĠĠĠĠĠ Ġon View ( all Of ( with Id ( R . id . recent _ sear ches _ delete _ button ), Ġis Displayed ())) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠ ĠTest Util . delay ( 5 ) ĊĠĠĠĠĠĠĠ Ġon View ( all Of ( with Text (" YES "), Ġis Displayed ())) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠ ĠTest Util . delay ( 5 ) ĊĠĠĠĠĠĠĠ Ġon View ( all Of ( with Id ( R . id . recent _ sear ches _ delete _ button ), Ġnot ( is Displayed ()))) ĊĊĊĊĊ ĊĊĠĠĠ Ġ} Ċ } ĊĊ