/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 1 7 Ġ- Ġpresent ĠIn structure , ĠInc . Ċ Ġ* Ċ Ġ* ĠĠĠĠ ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* ĠĠĠĠ Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠĠĠĠ ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠĠĠĠ ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* ĠĠĠĠ Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠĠĠĠ ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠĠĠĠ ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* ĠĠĠĠ Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ* Ċ Ġ*/ Ċ @ file : Suppress (" unused ") Ċ Ċ package Ġcom . in structure . espress o Ċ Ċ import Ġandroid . view . View Ċ import Ġandroidx . test . espress o . View Action Ċ import Ġandroidx . test . espress o . View Assertion Ċ import Ġandroidx . test . espress o . View Interaction Ċ import Ġandroidx . test . espress o . action .* Ċ import Ġandroidx . test . espress o . assertion . View Assertions Ċ import Ġandroidx . test . espress o . matcher . View Matchers Ċ import Ġcom . in structure . canvas . espress o . Set ViewPager Current Item Action Ċ import Ġorg . hamcrest . Matcher Ċ import Ġorg . hamcrest . Matchers Ċ import Ġjava . util . concurrent . TimeUnit ĊĊ Ċ fun ĠView Interaction . assert Visible (): ĠView Interaction ĊĠĠĠĠĠĠĠ Ġ= Ġcheck ( View Assertions . matches ( View Matchers . with Effective Visibility ( View Matchers . Visibility . VISIBLE ))) Ċ Ċ fun ĠView Interaction . assertIn visible (): ĠView Interaction ĊĠĠĠĠĠĠĠ Ġ= Ġcheck ( View Assertions . matches ( View Matchers . with Effective Visibility ( View Matchers . Visibility . IN VISIBLE ))) Ċ Ċ fun ĠView Interaction . assert G one (): ĠView Interaction ĊĠĠĠĠĠĠĠ Ġ= Ġcheck ( View Assertions . matches ( View Matchers . with Effective Visibility ( View Matchers . Visibility . GONE ))) Ċ Ċ fun ĠView Interaction . assert Displayed (): ĠView Interaction ĊĠĠĠĠĠĠĠ Ġ= Ġcheck ( View Assertions . matches ( View Matchers . is Displayed ())) Ċ Ċ fun ĠView Interaction . assert Comp let ely Displayed (): ĠView Interaction ĊĠĠĠĠĠĠĠ Ġ= Ġcheck ( View Assertions . matches ( View Matchers . is Comp let ely Displayed ())) Ċ Ċ fun ĠView Interaction . assertNot Displayed (): ĠView Interaction ĊĠĠĠĠĠĠĠ Ġ= Ġcheck ( View Assertions . matches ( Matchers . not ( View Matchers . is Displayed ()))) Ċ Ċ fun ĠView Interaction . assert Has Text ( text : ĠString ): ĠView Interaction ĊĠĠĠĠĠĠĠ Ġ= Ġcheck ( View Assertions . matches ( View Matchers . with Text ( text ))) Ċ Ċ fun ĠView Interaction . assert Has Text ( string Id : ĠInt ): ĠView Interaction ĊĠĠĠĠĠĠĠ Ġ= Ġcheck ( View Assertions . matches ( View Matchers . with Text ( string Id ))) Ċ Ċ fun ĠView Interaction . assertNot Has Text ( string Id : ĠInt ): ĠView Interaction ĊĠĠĠĠĠĠĠ Ġ= Ġcheck ( View Assertions . matches ( Matchers . not ( View Matchers . with Text ( string Id )))) Ċ Ċ fun ĠView Interaction . assertContains Text ( text : ĠString ): ĠView Interaction ĊĠĠĠĠĠĠĠ Ġ= Ġcheck ( View Assertions . matches ( View Matchers . with Text ( Matchers . contains String ( text )))) Ċ Ċ fun ĠView Interaction . assert Has Content Description ( text : ĠString ): ĠView Interaction ĊĠĠĠĠĠĠĠ Ġ= Ġcheck ( View Assertions . matches ( View Matchers . with Content Description ( text ))) Ċ Ċ fun ĠView Interaction . assert Has Content Description ( string Id : ĠInt ): ĠView Interaction ĊĠĠĠĠĠĠĠ Ġ= Ġcheck ( View Assertions . matches ( View Matchers . with Content Description ( string Id ))) Ċ Ċ fun ĠView Interaction . assert Has Child ( matcher : ĠMatcher < View >): ĠView Interaction ĊĠĠĠĠĠĠĠ Ġ= Ġcheck ( View Assertions . matches ( View Matchers . with Child ( matcher ))) Ċ Ċ fun ĠView Interaction . assert Selected (): ĠView Interaction ĊĠĠĠ Ġ= Ġcheck ( View Assertions . matches ( View Matchers . isSelected ())) Ċ Ċ // ĠExtensions Ġfor ĠView Actions Ċ Ċ fun ĠView Interaction . type Text ( arg 0 : ĠString ): ĠView Interaction Ġ= Ġperform ( View Actions . type Text ( arg 0 )) Ċ Ċ fun ĠView Interaction . press Key ( arg 0 : ĠE sp ress o Key ): ĠView Interaction Ġ= Ġperform ( View Actions . press Key ( arg 0 )) Ċ Ċ fun ĠView Interaction . press Key ( arg 0 : ĠInt ): ĠView Interaction Ġ= Ġperform ( View Actions . press Key ( arg 0 )) Ċ Ċ fun ĠView Interaction . swipe Up (): ĠView Interaction Ġ= Ġperform ( View Actions . swipe Up ()) Ċ Ċ fun ĠView Interaction . click (): ĠView Interaction Ġ= Ġperform ( View Actions . click ()) Ċ Ċ fun ĠView Interaction . click ( arg 0 : ĠView Action ): ĠView Interaction Ġ= Ġperform ( View Actions . click ( arg 0 )) Ċ Ċ fun ĠView Interaction . action With Assertions ( arg 0 : ĠView Action ): ĠView Interaction Ġ= Ġperform ( View Actions . action With Assertions ( arg 0 )) Ċ Ċ fun ĠView Interaction . clear Text (): ĠView Interaction Ġ= Ġperform ( View Actions . clear Text ()) Ċ Ċ fun ĠView Interaction . swipe Left (): ĠView Interaction Ġ= Ġperform ( View Actions . swipe Left ()) Ċ Ċ fun ĠView Interaction . swipe Right (): ĠView Interaction Ġ= Ġperform ( View Actions . swipe Right ()) Ċ Ċ fun ĠView Interaction . swipe Down (): ĠView Interaction Ġ= Ġperform ( View Actions . swipe Down ()) Ċ Ċ fun ĠView Interaction . close Soft Keyboard (): ĠView Interaction Ġ= Ġperform ( View Actions . close Soft Keyboard ()) Ċ Ċ fun ĠView Interaction . press I me ActionButton (): ĠView Interaction Ġ= Ġperform ( View Actions . press I me ActionButton ()) Ċ Ċ fun ĠView Interaction . press Back (): ĠView Interaction Ġ= Ġperform ( View Actions . press Back ()) Ċ Ċ fun ĠView Interaction . press Menu Key (): ĠView Interaction Ġ= Ġperform ( View Actions . press Menu Key ()) Ċ Ċ fun ĠView Interaction . double Click (): ĠView Interaction Ġ= Ġperform ( View Actions . double Click ()) Ċ Ċ fun ĠView Interaction . long Click (): ĠView Interaction Ġ= Ġperform ( View Actions . long Click ()) Ċ Ċ fun ĠView Interaction . scrollTo (): ĠView Interaction Ġ= Ġperform ( Nested ScrollView Extension ()) Ċ Ċ fun ĠView Interaction . type Text Into Focused View ( arg 0 : ĠString ): ĠView Interaction Ġ= Ġperform ( View Actions . type Text Into Focused View ( arg 0 )) Ċ Ċ fun ĠView Interaction . replace Text ( arg 0 : ĠString ): ĠView Interaction Ġ= Ġperform ( View Actions . replace Text ( arg 0 )) Ċ Ċ fun ĠView Interaction . open Link With Text ( arg 0 : Ġorg . hamcrest . Matcher < String >): ĠView Interaction Ġ= Ġperform ( View Actions . open Link With Text ( arg 0 )) Ċ Ċ fun ĠView Interaction . open Link With Text ( arg 0 : ĠString ): ĠView Interaction Ġ= Ġperform ( View Actions . open Link With Text ( arg 0 )) Ċ Ċ fun ĠView Interaction . open Link ( arg 0 : Ġorg . hamcrest . Matcher < String >, Ġarg 1 : Ġorg . hamcrest . Matcher < android . net . Uri >): ĠView Interaction Ġ= Ġperform ( View Actions . open Link ( arg 0 , Ġarg 1 )) Ċ Ċ fun ĠView Interaction . open Link With Uri ( arg 0 : Ġorg . hamcrest . Matcher < android . net . Uri >): ĠView Interaction Ġ= Ġperform ( View Actions . open Link With Uri ( arg 0 )) Ċ Ċ fun ĠView Interaction . open Link With Uri ( arg 0 : ĠString ): ĠView Interaction Ġ= Ġperform ( View Actions . open Link With Uri ( arg 0 )) Ċ Ċ fun ĠView Interaction . page To Item ( pageNumber : ĠInt ): ĠView Interaction Ġ= Ġperform ( ĊĠĠĠ ĠSet ViewPager Current Item Action ( ĊĠĠĠĠĠĠĠ Ġpage Number ĊĠĠĠ Ġ) Ċ ) Ċ Ċ fun ĠView Interaction . swipe To Top (): ĠView Interaction Ġ= Ġperform ( General Swipe Action ( Swipe . FAST , ĠCoordinates Provider Ġ{ ĊĠĠĠĠĠĠĠ ĠGeneral Location . CENTER . calculate Coordinates ( it ) ĊĠĠĠ Ġ}, ĠCoordinates Provider Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcoordinates Ġ= ĠGeneral Location . CENTER . calculate Coordinates ( it ) ĊĠĠĠĠĠĠĠ Ġcoordinates [ 1 ] Ġ= Ġ 0 F ĊĠĠĠĠĠĠĠ Ġcoordinates ĊĠĠĠ Ġ}, ĠPress . F ING ER )) Ċ Ċ fun ĠView Interaction . waitFor Check ( assertion : ĠView Assertion ) Ġ{ ĊĠĠĠ Ġval Ġwait Time Ġ= ĠTimeUnit . SECONDS . to Millis ( 1 0 ) ĊĠĠĠ Ġval ĠendTime Ġ= ĠSystem . currentTimeMillis () Ġ+ Ġwait Time ĊĠĠĠ Ġdo Ġ{ ĊĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcheck ( assertion ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠThrowable ) Ġ{ ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ġwhile Ġ( System . currentTimeMillis () Ġ< ĠendTime ) ĊĠĠĠ Ġcheck ( assertion ) Ċ } Ċ