package Ġcom . very good security . vg sc heck out . payments . ui Ċ Ċ import Ġandroid . app . Activity Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġandroidx . test . core . app . Activity Scenario Ċ import Ġandroidx . test . core . app . Application Provider Ċ import Ġandroidx . test . espress o . Esp ress o Ċ import Ġandroidx . test . espress o . action . View Actions Ċ 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 Ċ import Ġandroidx . test . ext . junit . runners . Android JUnit 4 Ċ import Ġandroidx . test . platform . app . Instrumentation Registry Ċ import Ġandroidx . test . uia utom ator . Ui Device Ċ import Ġcom . very good security . vg sc heck out . Build Config Ċ import Ġcom . very good security . vg sc heck out . Constants Ċ import Ġcom . very good security . vg sc heck out . R Ċ import Ġcom . very good security . vg sc heck out . collect . view . internal .* Ċ import Ġcom . very good security . vg sc heck out . config . VG SC heck out Add Card Config Ċ import Ġcom . very good security . vg sc heck out . config . ui . VG SC heck out Add Card Form Config Ċ import Ġcom . very good security . vg sc heck out . config . ui . core . VG SC heck out Form Validation Behaviour Ċ import Ġcom . very good security . vg sc heck out . config . ui . view . address . VG SC heck out Billing Address Visibility Ċ import Ġcom . very good security . vg sc heck out . config . ui . view . address . VG SC heck out Payment Billing Address Options Ċ import Ġcom . very good security . vg sc heck out . model . Checkout Result Contract Ċ import Ġcom . very good security . vg sc heck out . model . EXTRA _ KEY _ ARGS Ċ import Ġcom . very good security . vg sc heck out . ui . Custom Save Card Activity Ċ import Ġcom . very good security . vg sc heck out . ui . Save Card Activity Ċ import Ġcom . very good security . vg sc heck out . util . Action Helper Ċ import Ġcom . very good security . vg sc heck out . util . V GS View Matchers . with Error Ċ import Ġcom . very good security . vg sc heck out . util . V GS View Matchers . with Parent Ċ import Ġcom . very good security . vg sc heck out . util . View Interaction . on View With Scroll To Ċ import Ġcom . very good security . vg sc heck out . util . extension . waitFor Ċ import Ġorg . junit . Assert Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ Ċ @ Suppress (" Same Parameter Value ") Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠOn Focus Fields Validation Test Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġcontext : ĠContext Ġ= ĠApplication Provider . getApplicationContext () ĊĊĠĠĠ Ġprivate Ġval Ġintent Ġ= ĠIntent ( context , ĠSave Card Activity :: class . java ). apply Ġ{ ĊĠĠĠĠĠĠĠ Ġput Extra ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠEX TRA _ KEY _ ARGS , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠCheckout Result Contract . Args ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠV G SC heck out Add Card Config ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠBuild Config . JWT _ TOKEN _ WITHOUT _ TRANSFER S , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠBuild Config . VA ULT _ ID , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġform Config Ġ= ĠV G SC heck out Add Card Form Config ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠV G SC heck out Payment Billing Address Options ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġvisibility Ġ= ĠV G SC heck out Billing Address Visibility . VISIBLE ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠV G SC heck out Form Validation Behaviour . ON _ FOCUS ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġis Screenshots Allowed Ġ= Ġtrue ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġdevice : ĠUi Device ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġprepare Device () Ġ{ ĊĠĠĠĠĠĠĠ Ġdevice Ġ= ĠUi Device . getInstance ( Instrumentation Registry . get Instrumentation ()) ĊĠĠĠĠĠĠĠ Ġdevice . set Orientation Natural () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġfocus Change _ no Input _ errors Not Displayed () Ġ{ ĊĠĠĠĠĠĠĠ ĠActivity Scenario . launch < Custom Save Card Activity >( intent ). use Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠAct ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Card Holder , ĠPerson Name Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Card Number , ĠCard Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Expiration Date , ĠDate Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Security Code , ĠC VC Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Address , ĠInfo Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til City , ĠInfo Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Postal Code , ĠInfo Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Card Holder , ĠPerson Name Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . click ()) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠAssert ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Card Holder ). check ( matches ( with Error ( null ))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Card Number ). check ( matches ( with Error ( null ))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Expiration Date ). check ( matches ( with Error ( null ))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Security Code ). check ( matches ( with Error ( null ))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Address ). check ( matches ( with Error ( null ))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til City ). check ( matches ( with Error ( null ))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Postal Code ). check ( matches ( with Error ( null ))) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠAct ĊĠĠĠĠĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . is Root ()). perform ( View Actions . close Soft Keyboard ()) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠwaitFor ( 5 0 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdevice . press Back () ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// Assert ĊĠĠĠĠĠĠĠĠĠĠĠ ĠAssert . assertEquals ( Activity . RESULT _ C ANCE LED , Ġit . result . result Code ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġfocus Change _ empty Input _ errors Displayed () Ġ{ ĊĠĠĠĠĠĠĠ ĠActivity Scenario . launch < Custom Save Card Activity >( intent ). use Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠAct ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Card Holder , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPerson Name Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( type Text ( Constants . VALID _ CARD _ HOLDER )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( Action Helper . setText < Person Name Input Field >( null )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Card Number , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠCard Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( type Text ( Constants . VALID _ CARD _ NUMBER )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( Action Helper . setText < Card Input Field >( null )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Expiration Date , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠDate Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( type Text ( Constants . VALID _ EXP _ DATE )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( Action Helper . setText < Date Input Field >( null )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Security Code , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠC VC Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( type Text ( Constants . VALID _ SECURITY _ CODE )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( Action Helper . setText < CV C Input Field >( null )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Address , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠInfo Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( type Text ( Constants . VALID _ ADDRESS )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( Action Helper . setText < Info Input Field >( null )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til City , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠInfo Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( type Text ( Constants . VALID _ C ITY )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( Action Helper . setText < Info Input Field >( null )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Postal Code , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠInfo Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( type Text ( Constants . USA _ VALID _ ZIP _ CODE )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( Action Helper . setText < Info Input Field >( null )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Card Holder , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPerson Name Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠAssert ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Card Holder ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( with Error (" Name Ġis Ġempty "))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Card Number ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( with Error (" Card Ġnumber Ġis Ġempty "))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Expiration Date ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( with Error (" Expiry Ġdate Ġis Ġempty "))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Security Code ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( with Error (" CV C / CV V Ġis Ġempty "))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Address ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( with Error (" Address Ġline Ġ 1 Ġis Ġempty "))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til City ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( with Error (" City Ġis Ġempty "))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Postal Code ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( with Error (" ZIP Ġis Ġempty "))) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġfocus Change _ invalid Input _ errors Displayed () Ġ{ ĊĠĠĠĠĠĠĠ ĠActivity Scenario . launch < Custom Save Card Activity >( intent ). use Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠAct ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Card Number , ĠCard Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( type Text ( Constants . INVALID _ CARD _ NUMBER )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Expiration Date , ĠDate Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( type Text ( Constants . INVALID _ EXP _ DATE )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Security Code , ĠC VC Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( type Text ( Constants . INVALID _ SECURITY _ CODE )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Postal Code , ĠInfo Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( type Text ( Constants . USA _ INVALID _ ZIP _ CODE )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( with Parent ( R . id . vgs Til Card Holder , ĠPerson Name Input Field :: class )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠAssert ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Card Number ). check ( matches ( with Error (" Invalid Ġcard Ġnumber "))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Expiration Date ). check ( matches ( with Error (" Invalid Ġexpiry Ġdate "))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Security Code ). check ( matches ( with Error (" Invalid ĠC VC / CV V Ġformat "))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Postal Code ). check ( matches ( with Error (" ZIP Ġis Ġinvalid "))) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġsubmit Clicked _ no Input _ errors Displayed () Ġ{ ĊĠĠĠĠĠĠĠ ĠActivity Scenario . launch < Custom Save Card Activity >( intent ). use Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠAct ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . mb Save Card ). perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠAssert ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Card Holder ). check ( matches ( with Error (" Name Ġis Ġempty "))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Card Number ). check ( matches ( with Error (" Card Ġnumber Ġis Ġempty "))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Expiration Date ). check ( matches ( with Error (" Expiry Ġdate Ġis Ġempty "))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Security Code ). check ( matches ( with Error (" CV C / CV V Ġis Ġempty "))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Address ). check ( matches ( with Error (" Address Ġline Ġ 1 Ġis Ġempty "))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til City ). check ( matches ( with Error (" City Ġis Ġempty "))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon View With Scroll To ( R . id . vgs Til Postal Code ). check ( matches ( with Error (" ZIP Ġis Ġempty "))) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }