package Ġcom . n if cloud . mb a as Ċ Ċ import Ġandroidx . test . espress o . Esp ress o Ċ import Ġandroidx . test . espress o . View Interaction Ċ 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 Ġandroidx . test . espress o . matcher . View Matchers . with Id Ċ 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 . n if cloud . user . MainActivity Ċ import Ġcom . n if cloud . user . R Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Fix Method Order Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . junit . runners . Method Sort ers Ċ Ċ @ Fix Method Order ( Method Sort ers . NAME _ ASC ENDING ) Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ @ Large Test Ċ class ĠLogin UIT est Ġ{ ĊĠĠĠ Ġvar Ġiv Logo : ĠView Interaction ? Ġ= Ġnull ĊĠĠĠ Ġvar Ġed t Name : ĠView Interaction ? Ġ= Ġnull ĊĠĠĠ Ġvar Ġed t Pass : ĠView Interaction ? Ġ= Ġnull ĊĠĠĠ Ġvar Ġbtn Login : ĠView Interaction ? Ġ= Ġnull ĊĠĠĠ Ġvar Ġtv Link Signup : ĠView Interaction ? Ġ= Ġnull ĊĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġval Ġactivity Rule Ġ= ĠActivity Scenario Rule ( ĊĠĠĠĠĠĠĠ ĠMainActivity :: class . java ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ Ġiv Logo Ġ= ĠE sp ress o . on View ( with Id ( R . id . iv _ logo )) ĊĠĠĠĠĠĠĠ Ġed t Name Ġ= ĠE sp ress o . on View ( with Id ( R . id . input _ name )) ĊĠĠĠĠĠĠĠ Ġed t Pass Ġ= ĠE sp ress o . on View ( with Id ( R . id . input _ password )) ĊĠĠĠĠĠĠĠ Ġbtn Login Ġ= ĠE sp ress o . on View ( with Id ( R . id . btn _ login )) ĊĠĠĠĠĠĠĠ Ġtv Link Signup Ġ= ĠE sp ress o . on View ( with Id ( R . id . link _ signup )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest 0 1 _ initial Screen () Ġ{ ĊĠĠĠĠĠĠĠ Ġiv Logo !!. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠĠĠĠĠ Ġed t Name !!. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠĠĠĠĠ Ġed t Pass !!. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠĠĠĠĠ Ġbtn Login !!. check ( View Assertions . matches ( View Matchers . with Text (" Login "))) ĊĠĠĠĠĠĠĠ Ġtv Link Signup !!. check ( View Assertions . matches ( View Matchers . with Text (" No Ġaccount Ġyet ? ĠCreate Ġone "))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest 0 2 _ validate _ user _ name () Ġ{ ĊĠĠĠĠĠĠĠ Ġed t Name !!. perform ( View Actions . type Text ("")) ĊĠĠĠĠĠĠĠ Ġed t Pass !!. perform ( View Actions . type Text (" 1 2 3 4 5 6 "), ĠView Actions . close Soft Keyboard ()) ĊĠĠĠĠĠĠĠ Ġbtn Login !!. perform ( View Actions . scrollTo ()). perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠ Ġed t Name !!. check ( View Assertions . matches ( View Matchers . has Error Text (" enter Ġusername "))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest 0 3 _ validate _ empty _ pass () Ġ{ ĊĠĠĠĠĠĠĠ Ġed t Name !!. perform ( View Actions . type Text (" Ho ge ")) ĊĠĠĠĠĠĠĠ Ġed t Pass !!. perform ( View Actions . type Text (""), ĠView Actions . close Soft Keyboard ()) ĊĠĠĠĠĠĠĠ Ġbtn Login !!. perform ( View Actions . scrollTo ()). perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠ Ġed t Pass !!. check ( View Assertions . matches ( View Matchers . has Error Text (" between Ġ 4 Ġand Ġ 1 0 Ġal phanumeric Ġcharacters "))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest 0 4 _ validate _ less _ pass _ length () Ġ{ ĊĠĠĠĠĠĠĠ Ġed t Name !!. perform ( View Actions . type Text (" Ho ge ")) ĊĠĠĠĠĠĠĠ Ġed t Pass !!. perform ( View Actions . type Text (" 1 2 3 "), ĠView Actions . close Soft Keyboard ()) ĊĠĠĠĠĠĠĠ Ġbtn Login !!. perform ( View Actions . scrollTo ()). perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠ Ġed t Pass !!. check ( View Assertions . matches ( View Matchers . has Error Text (" between Ġ 4 Ġand Ġ 1 0 Ġal phanumeric Ġcharacters "))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest 0 5 _ validate _ over _ pass _ length () Ġ{ ĊĠĠĠĠĠĠĠ Ġed t Name !!. perform ( View Actions . type Text (" Ho ge ")) ĊĠĠĠĠĠĠĠ Ġed t Pass !!. perform ( View Actions . type Text (" 1 2 3 4 5 6 7 8 9 0 1 "), ĠView Actions . close Soft Keyboard ()) ĊĠĠĠĠĠĠĠ Ġbtn Login !!. perform ( View Actions . scrollTo ()). perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠ Ġed t Pass !!. check ( View Assertions . matches ( View Matchers . has Error Text (" between Ġ 4 Ġand Ġ 1 0 Ġal phanumeric Ġcharacters "))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest 0 6 _ open Signup () Ġ{ ĊĠĠĠĠĠĠĠ Ġtv Link Signup !!. perform ( View Actions . scrollTo ()). perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( with Id ( R . id . btn _ signup )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . with Text (" Create ĠAccount "))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( InterruptedException :: class ) ĊĠĠĠ Ġfun Ġtest 0 7 _ do Login () Ġ{ ĊĠĠĠĠĠĠĠ Ġed t Name !!. perform ( View Actions . type Text (" Ho ge ")) ĊĠĠĠĠĠĠĠ Ġed t Pass !!. perform ( View Actions . type Text (" 1 2 3 4 5 6 "), ĠView Actions . close Soft Keyboard ()) ĊĠĠĠĠĠĠĠ Ġbtn Login !!. perform ( View Actions . scrollTo ()). perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠ Ġvar Ġtimeout Ġ= Ġ 0 ĊĠĠĠĠĠĠĠ Ġwhile Ġ( timeout Ġ< Ġ 1 0 0 0 0 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtimeout Ġ+= Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Text (" You Ġare Ġlogged Ġin ! ")) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġbreak ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠThread . sleep ( 1 0 0 0 L ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ 1 0 0 0 ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }