package Ġorg . fn ives . test . show case . test utils . configuration Ċ Ċ import Ġandroid . view . View Ċ import Ġandroidx . annotation . String Res Ċ import Ġandroidx . test . espress o . Esp ress o Ċ import Ġandroidx . test . espress o . Ui Controller Ċ import Ġandroidx . test . espress o . View Action Ċ import Ġandroidx . test . espress o . action . View Actions Ċ import Ġandroidx . test . espress o . assertion . View Assertions Ċ import Ġandroidx . test . espress o . matcher . View Matchers Ċ import Ġcom . google . android . material . R Ċ import Ġcom . google . android . material . sn ackbar . Snackbar Ċ import Ġorg . hamcrest . Matcher Ċ import Ġorg . hamcrest . Matchers Ċ import Ġorg . junit . runner . Description Ċ import Ġorg . junit . runners . model . Statement Ċ Ċ object ĠAndroid Test Snackbar Verification Test Rule Ġ: ĠSn ackbar Verification Test Rule Ġ{ ĊĊĠĠĠ Ġoverride Ġfun Ġapply ( base : ĠStatement , Ġdescription : ĠDescription ): ĠStatement Ġ= Ġbase ĊĊĠĠĠ Ġoverride Ġfun Ġassert Is Shown With Text (@ String Res Ġstring Res ID : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . sn ackbar _ text )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . with Text ( string Res ID ))) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . isAssignableFrom ( Snackbar . Snackbar Layout :: class . java )). perform ( View Actions . swipe Right ()) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . is Root ()). perform ( Loop Main Until Snackbar Dis missed ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġassert IsNot Shown () Ġ{ ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . sn ackbar _ text )). check ( View Assertions . does NotExist ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġclass ĠLoop Main Until Snackbar Dis missed () Ġ: ĠView Action Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun Ġget Constraints (): ĠMatcher < View > Ġ= ĠMatch ers . is A ( View :: class . java ) ĊĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠgetDescription (): ĠString Ġ= Ġ" loop ĠMain Thread Ġuntil ĠSn ackbar Ġis ĠDis missed " ĊĊĠĠĠĠĠĠĠ Ġoverride Ġfun Ġperform ( ui Controller : ĠUi Controller , Ġview : ĠView ?) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġwhile Ġ( view ?. findViewById < View >( com . google . android . material . R . id . sn ackbar _ text ) Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġui Controller . loop MainThread For At Least ( 1 0 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ