package Ġcom . bon aden ys . registration tc Ċ Ċ import Ġandroidx . test . core . app . Activity Scenario Ċ import Ġandroidx . test . espress o . Esp ress o . on View Ċ import Ġandroidx . test . espress o . action . View Actions .* Ċ import Ġandroidx . test . espress o . assertion . View Assertions Ċ import Ġandroidx . test . espress o . matcher . Root Matchers Ċ import Ġandroidx . test . espress o . matcher . View Matchers .* Ċ import Ġandroidx . test . platform . app . Instrumentation Registry Ċ import Ġandroidx . test . ext . junit . runners . Android JUnit 4 Ċ import Ġcom . bon aden ys . registration tc . dropdown list . Education Ċ import Ġcom . bon aden ys . registration tc . dropdown list . Ho using Type Ċ import Ġcom . bon aden ys . registration tc . ui . Registration Activity Ċ import Ġorg . hamcrest . Core Matchers Ċ Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ Ċ import Ġorg . junit . Assert .* Ċ Ċ /** Ċ Ġ* ĠInstrument ed Ġtest , Ġwhich Ġwill Ġexecute Ġon Ġan ĠAndroid Ġdevice . Ċ Ġ* Ċ Ġ* ĠSee Ġ[ testing Ġdocumentation ]( http :// d . android . com / tools / testing ). Ċ Ġ*/ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠRegistration TC Instrument ed Test Ġ{ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġuse AppContext () Ġ{ ĊĠĠĠĠĠĠĠ Ġ// ĠContext Ġof Ġthe Ġapp Ġunder Ġtest . ĊĠĠĠĠĠĠĠ Ġval Ġapp Context Ġ= ĠInstrument ation Registry . get Instrumentation (). target Context ĊĠĠĠĠĠĠĠ ĠassertEquals (" com . bon aden ys . registration tc ", Ġapp Context . packageName ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġfilling Form Test () Ġ{ ĊĠĠĠĠĠĠĠ ĠActivity Scenario . launch ( Registration Activity :: class . java ) ĊĊĠĠĠĠĠĠĠ Ġ// ĠData ĠDi ri ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . national _ id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( is Comp let ely Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . national _ id )). perform ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype Text Into Focused View (" 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġclose Soft Keyboard () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . submit )). perform ( click ()) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĊĠĠĠĠĠĠĠ Ġ// ĠIt 'll Ġshow Ġthe Ġerror Ġbecause Ġnational _ id Ġless Ġthan Ġ 1 6 ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . national _ id )). perform ( replace Text ("")) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . national _ id )). perform ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype Text Into Focused View (" 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġclose Soft Keyboard () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . submit )). perform ( click ()) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĠĠĠĠĠĠĠ Ġ// ĠIt 'll Ġshow Ġthe Ġerror Ġbecause Ġnational _ id Ġmore Ġthan Ġ 1 6 ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . national _ id )). perform ( replace Text ("")) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . national _ id )). perform ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype Text Into Focused View (" 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġclose Soft Keyboard () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . submit )). perform ( click ()) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . fullname )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( is Comp let ely Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . fullname )). perform ( click ()) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĠĠĠĠĠĠĠ Ġ// ĠIt 'll Ġshow Ġthe Ġerror Ġbecause Ġfullname Ġis Ġempty ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . fullname )). perform ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype Text Into Focused View (" John ĠDoe "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġclose Soft Keyboard () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . submit )). perform ( click ()) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . bank _ account )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( is Comp let ely Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . bank _ account )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . bank _ account )). perform ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype Text Into Focused View (" 8 9 7 4 2 6 8 "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġclose Soft Keyboard () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . submit )). perform ( click ()) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĠĠĠĠĠĠĠ Ġ// ĠIt 'll Ġshow Ġthe Ġerror Ġbecause Ġbank Account Ġless Ġthan Ġ 8 ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . bank _ account )). perform ( replace Text ("")) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . bank _ account )). perform ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype Text Into Focused View (" 8 9 7 4 2 6 8 9 5 "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġclose Soft Keyboard () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . education )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( is Comp let ely Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . education )). perform ( click ()) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 1 0 0 0 ) ĊĠĠĠĠĠĠĠ Ġon View ( with Text ( Core Matchers . contains String ( Education . S 1 . name ))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. in Root ( Root Matchers . is Platform Popup ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( click ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . education )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( with Text (" S 1 "))) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . date _ of _ birth )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( replace Text (" 2 0 - 0 7 - 1 9 9 9 "), Ġclose Soft Keyboard ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . submit )). perform ( click ()) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĊĠĠĠĠĠĠĠ Ġ// ĠAl amat ĠK TP ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . dom ic ile )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( is Comp let ely Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . dom ic ile )). perform ( click ()) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĠĠĠĠĠĠĠ Ġ// ĠIt 'll Ġshow Ġthe Ġerror Ġbecause Ġdom ic ile Ġis Ġempty ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . dom ic ile )). perform ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype Text Into Focused View (" Tap ak ĠT uan "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġclose Soft Keyboard () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . housing _ type )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( is Comp let ely Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . housing _ type )). perform ( click ()) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 1 0 0 0 ) ĊĠĠĠĠĠĠĠ Ġon View ( with Text ( Core Matchers . contains String ( Ho using Type . R um ah . name ))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. in Root ( Root Matchers . is Platform Popup ()). perform ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġclick () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . housing _ type )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( with Text (" R um ah "))) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . no )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . no )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( is Comp let ely Displayed ())) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĠĠĠĠĠĠĠ Ġ// ĠIt 'll Ġshow Ġthe Ġerror Ġbecause Ġdom ic ile Ġis Ġempty ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . no )). perform ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype Text Into Focused View (" 5 Ġ/ ĠV II "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġclose Soft Keyboard () ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . province )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( is Comp let ely Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . province )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Text ( Core Matchers . equalTo (" Ace h "))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. in Root ( Root Matchers . is Platform Popup ()). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . province )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( with Text (" Ace h "))) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . submit )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Text (" Province ")) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( scrollTo ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 3 0 0 0 ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . submit )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Text (" Province ")) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( scrollTo ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 4 0 0 0 ) ĊĠĠĠ Ġ} Ċ }