package Ġcom . android . tv ma ze . home Ċ Ċ import Ġandroid . app . Activity Ċ import Ġandroidx . test . espress o . Esp ress o . on View Ċ import Ġandroidx . test . espress o . action . View Actions . click Ċ import Ġandroidx . test . espress o . assertion . View Assertions . matches Ċ import Ġandroidx . test . espress o . contrib . RecyclerView Actions . action On Item At Position Ċ import Ġandroidx . test . espress o . matcher . Root Matchers . with Decor View Ċ import Ġandroidx . test . espress o . matcher . View Matchers . is Displayed Ċ import Ġandroidx . test . espress o . matcher . View Matchers . with Id Ċ import Ġandroidx . test . espress o . matcher . View Matchers . with Text Ċ import Ġcom . android . tv ma ze . R Ċ import Ġcom . android . tv ma ze . utils . Matcher Utils Ċ import Ġcom . android . tv ma ze . utils . View Action Utils Ċ import Ġorg . hamcrest . Matchers .` is ` Ċ import Ġorg . hamcrest . Matchers . all Of Ċ import Ġorg . hamcrest . Matchers . not Ċ Ċ fun Ġlaunch Home ( func : ĠHome Robot . () Ġ-> ĠUnit ) Ġ= ĠHome Robot (). apply Ġ{ Ġfunc () Ġ} Ċ class ĠHome Robot Ġ{ ĊĠĠĠ Ġfun Ġverify Home () Ġ{ ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . popular _ show _ header )). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( all Of ( with Id ( R . id . popular _ shows ), Ġis Displayed ())) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġverify Favorite () Ġ{ ĊĠĠĠĠĠĠĠ Ġ// ĠClick Ġon Ġ 1 st Ġitem Ġand Ġmark Ġas Ġfavorite ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . popular _ shows )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġaction On Item At Position < Shows Adapter . Show Holder > ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ( 0 , ĠView Action Utils . click Child View With Id ( R . id . favorite )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġverify Toast ( activity : ĠActivity ) Ġ{ ĊĠĠĠĠĠĠĠ Ġon View ( with Text ( R . string . added _ to _ favorites )). in Root ( with Decor View ( not (` is `( activity . window . decor View )))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( is Displayed ())) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġverify Favorite Screen () Ġ{ ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . action _ favorites )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( click ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Text ( R . string . favorite _ shows )). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . shows )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( Matcher Utils . with List Size ( 1 ))) ĊĠĠĠ Ġ} Ċ }