package Ġcom . example . plant app Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroidx . test . espress o . Esp ress o . on View Ċ import Ġandroidx . test . espress o . action . View Actions . click Ċ import Ġandroidx . test . espress o . action . View Actions . type Text Ċ import Ġandroidx . test . espress o . assertion . View Assertions . matches Ċ import Ġandroidx . test . espress o . matcher . View Matchers . with Id Ċ import Ġandroidx . test . espress o . matcher . View Matchers . with Text Ċ import Ġandroidx . test . platform . app . Instrumentation Registry Ċ import Ġandroidx . test . rule . Activity Test Rule Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . junit . runners . JUnit 4 Ċ Ċ // ĠRuns Ġall Ġunit Ġtests . Ċ @ RunWith ( JUnit 4 :: class ) Ċ class ĠLogin Activity Test Ċ { ĊĠĠĠ Ġ@ Rule ĊĠĠĠ Ġ@ Jvm Field ĊĠĠĠ Ġval Ġrule : ĠActivity Test Rule < Login Activity > Ġ= ĠActivity Test Rule ( ĊĠĠĠĠĠĠĠ ĠLogin Activity :: class . java ) ĊĊĠĠĠ Ġlateinit Ġvar Ġinstrument ation Context : ĠContext ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ Ġinstrument ation Context Ġ= ĠInstrument ation Registry . get Instrumentation (). context ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġenter _ email () Ġ{ ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . email _ textView )). perform ( type Text (" Email ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġenter _ password () Ġ{ ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . password _ edit Text )). perform ( type Text (" Password ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġbasic _ login _ true (){ ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . email _ textView )). perform ( type Text (" dan j @ trl . com ")) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . password _ edit Text )). perform ( type Text (" abcdef g ")) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . email _ login _ button )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . message )). check ( matches ( with Text (" Logged Ġin Ġsuccessfully "))) ĊĠĠĠ Ġ} ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġbasic _ login _ false (){ ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . email _ textView )). perform ( type Text (" aaa ")) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . password _ edit Text )). perform ( type Text (" 1 2 3 1 2 3 ")) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . email _ login _ button )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . message 2 )). check ( matches ( with Text (" Authentication Ġfailed ! "))) ĊĠĠĠ Ġ} ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcheck _ id _ edit _ text () Ġ{ ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . password _ edit Text )). perform ( type Text (" p ")) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . email _ login _ button )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . message _ edit _ text _ email )). check ( matches ( with Text (" Please Ġenter Ġemail Ġid ! "))) ĊĠĠĠ Ġ} ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcheck _ pw _ edit _ text () Ġ{ ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . email _ textView )). perform ( type Text (" E ")) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . email _ login _ button )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . message _ edit _ text _ password )). check ( matches ( with Text (" Please Ġenter Ġyour Ġpassword "))) ĊĠĠĠ Ġ} ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcheck _ google _ login () Ġ{ ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . sign _ in _ button )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . message _ google )). check ( matches ( with Text (" Signed Ġin Ġwith ĠGoogle ĠSuccessfully "))) ĊĠĠĠ Ġ} ĊĊĊ Ċ }