package Ġcom . lambda _ labs . community _ calendar . view Ċ Ċ import Ġandroid . view . View Ċ 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 . 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 Ġcom . lambda _ labs . community _ calendar . R Ċ import Ġorg . hamcrest . Matcher Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith ĊĊ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ @ Large Test Ċ class ĠSearch Fragment Test Ġ{ ĊĊĠĠĠ Ġ@ Rule Ġ// ĠRule Ġfor ĠJ Unit ĊĠĠĠ Ġ@ Jvm Field Ġ// ĠFor ĠKotlin Ġcompatibility ĊĠĠĠ Ġvar Ġactivity Scenario Rule : ĠActivity Scenario Rule < MainActivity > Ġ= ĊĠĠĠĠĠĠĠ ĠActivity Scenario Rule ( MainActivity :: class . java ) Ġ// ĠTo Ġwrap Ġup Ġthe Ġactivity ĊĊĠĠĠ Ġ// val Ġsearch View Matcher : ĠMatcher < View > Ġ= Ġinstance Of ( Custom Search View :: class . java ) ĊĠĠĠ Ġ// val Ġsearch View Matcher : ĠMatcher < View > Ġ= Ġwith Tag Value (` is ` (" search _ bar ")) Ġ// ĠMust Ġmatch Ġtag Ġof ĠSearch View ĊĠĠĠ Ġ// ĠMust Ġmatch Ġhint Ġtext Ġof ĠSearch View ĊĠĠĠ Ġprivate Ġvar Ġsearch View Matcher : ĠMatcher < View > Ġ= Ġwith Hint (" Search ") ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġnavigate _ to _ search _ fragment () Ġ{ ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 5 0 0 0 ) ĊĠĠĠĠĠĠĠ Ġon View ( search View Matcher ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( click ()) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcheck _ back _ button _ behavior () Ġ{ ĊĠĠĠĠĠĠĠ Ġon View ( is Root ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( close Soft Keyboard ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( press Back ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( press Back ()) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . featured _ event _ recycler )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcheck _ function ality _ of _ cancel _ button () Ġ{ ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . btn _ cancel )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( click ()) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . featured _ event _ recycler )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġsearch _ with _ manual _ entry () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġsearch String : ĠString Ġ= Ġ" art " ĊĊĠĠĠĠĠĠĠ Ġon View ( search View Matcher ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( type Text ( search String )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( press I me ActionButton ()) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 1 0 0 0 ) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . txt _ sear ched _ by )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( with Text (" by Ġ\"$ search String \"" ))) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĠĠĠ Ġ} Ċ } ĊĊĊĊĊĊĊĊĊĊĊĊĊĊĊĊ ĊĊĊĊĊĊĊ