package Ġit . cas at ta Ċ Ċ import Ġandroid . content . Intent Ċ 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 . press Back Ċ 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 . rule . Activity Test Rule Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠKey Test Ġ: ĠCommon () Ġ{ ĊĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġvar Ġactivity Rule : ĠActivity Test Rule < MainActivity > Ġ= ĠActivity Test Rule ( ĊĠĠĠĠĠĠĠ ĠMainActivity :: class . java , ĊĠĠĠĠĠĠĠ Ġtrue , ĊĠĠĠĠĠĠĠ Ġfalse ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġrandom Key () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġactivity Ġ= Ġactivity Rule . launch Activity ( Intent ()) ĊĠĠĠĠĠĠĠ Ġval Ġkey Name Ġ= Ġ" key ${ System . currentTimeMillis () }" ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . key _ button )). perform ( click ()) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . item _ new )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġclick Element In List (" Random ") ĊĠĠĠĠĠĠĠ Ġset Text In Dialog And Confirm ( activity , Ġkey Name ) ĊĠĠĠĠĠĠĠ Ġon View ( with Text ( key Name )). check ( matches ( is Displayed ())) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . item _ new )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġclick Element In List (" Random ") ĊĠĠĠĠĠĠĠ Ġset Text In Dialog And Confirm ( activity , Ġkey Name ) ĊĠĠĠĠĠĠĠ Ġcheck And Dismiss Dialog ( R . string . key _ exists ) ĊĊĠĠĠĠĠĠĠ Ġon View ( is Root ()). perform ( press Back ()) ĊĠĠĠĠĠĠĠ Ġclick Element In List ( key Name ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . delete )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġset Text In Dialog And Confirm ( activity , Ġkey Name , Ġ" DELETE ") ĊĠĠĠĠĠĠĠ Ġcheck And Dismiss Dialog ( R . string . deleted ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . key _ button )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġcheck Element NotIn List ( key Name ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġx prv () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġactivity Ġ= Ġactivity Rule . launch Activity ( Intent ()) ĊĠĠĠĠĠĠĠ Ġval Ġkey Name Ġ= Ġ" key ${ System . currentTimeMillis () }" ĊĠĠĠĠĠĠĠ Ġval Ġx pr vs Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" main net " Ġto Ġ" x prv 9 s 2 1 Zr QH 1 4 3 K 2 qw M AS o V WN t Tp 2 3 wa Kv SF EQ EL Ub KK k pi H 8 c 7 YL 5 6 Uc 4 z D Wr T gy e Ur Ms D xE t 7 Cu Gg 3 P ZB wd y gr Ma 3 b 4 K TS ow CQ 7 LE v 4 8 Aa RQ ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" test net " Ġto Ġ" tp rv 8 Z gx MB ic QK s Pd 9 Te Ad PAD Nn Sy H 9 SS UU b T Ve F sz DE 2 3 Ki 6 T BB 5 n C ef Ad Hk K 8 Fm 3 q MQ R 6 s Hw A 5 6 zq Rm K mx n Hk 3 7 J ki F zv nc D qo Km PW ub u 7 h DF ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" reg test " Ġto Ġ" tp rv 8 Z gx MB ic QK s Pd 9 Te Ad PAD Nn Sy H 9 SS UU b T Ve F sz DE 2 3 Ki 6 T BB 5 n C ef Ad Hk K 8 Fm 3 q MQ R 6 s Hw A 5 6 zq Rm K mx n Hk 3 7 J ki F zv nc D qo Km PW ub u 7 h DF ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" sign et " Ġto Ġ" tp rv 8 Z gx MB ic QK s Pd 9 Te Ad PAD Nn Sy H 9 SS UU b T Ve F sz DE 2 3 Ki 6 T BB 5 n C ef Ad Hk K 8 Fm 3 q MQ R 6 s Hw A 5 6 zq Rm K mx n Hk 3 7 J ki F zv nc D qo Km PW ub u 7 h DF " ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġx pub s Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" main net " Ġto Ġ"[ dd 0 8 4 7 bb / 4 8 '/ 0 '/ 0 '/ 2 '] x pub 6 En 6 P 3 a Eh pm H 9 D q U 9 Q pi ME L 9 4 Q WD s NT Vn VW 8 g qi 6 W 2 T BU 7 z 4 k PD en HL r N kz ih c Yh E vk Re h Z f C 6 7 uF 1 Sn 8 o qq 9 Q 7 nx n HP PE L 9 6 v aw m CQ Zg Vp / 0 /* ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" test net " Ġto Ġ"[ d 9 0 c 6 a 4 f / 4 8 '/ 1 '/ 0 '/ 2 '] tp ub DF k 5 MP bk Q 9 z K fg mm Lk S 9 bu F 1 2 En r 2 Ji Wy D fw uc m 7 ox w M 5 Y 3 uD Wr z EJ 4 Q 8 VQ b Qw Xo FT z 9 A 7 QT TH Dr 8 so Gz Yo Jo WK tf xn 8 vf Ht qu Fv 8 p og h nf / 0 /* ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" reg test " Ġto Ġ"[ d 9 0 c 6 a 4 f / 4 8 '/ 2 '/ 0 '/ 2 '] tp ub DF e FL K 8 v Qy SA ay 9 Y Bt J YX ez Ad 1 gv 9 SQ Kz 4 La iv d H ym ku om r Z 7 er MV WH k 6 a ig z 1 u 9 N wd K 5 q KW mn 8 UK ra 7 B 4 MY 1 HF 7 8 XR VY c U 7 T Nv Rx Le Xn Ec / 0 /* ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" sign et " Ġto Ġ"[ d 9 0 c 6 a 4 f / 4 8 '/ 3 '/ 0 '/ 2 '] tp ub D FF Wn N 9 4 Aa 2 j NH k FF NF o DR vz R 5 x H wv 7 ko L xo Wt E MA xC cs y ce i My W 2 v VE Z od ut VM d 8 cn K Z Mk 5 ai B zy g Ex QQ Sw Pe 7 mo eu 2 qx 6 3 j Fr h 1 7 7 ZY BD / 0 /* " ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġimports Text Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" main net " Ġto Ġ" Import Ġx prv ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" test net " Ġto Ġ" Import Ġt prv ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" reg test " Ġto Ġ" Import Ġt prv ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" sign et " Ġto Ġ" Import Ġt prv " ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġnetwork Ġ= Ġget Network () ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . key _ button )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . item _ new )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġclick Element In List ( imports Text [ network ] !! ) ĊĠĠĠĠĠĠĠ Ġset Text In Dialog And Confirm ( activity , Ġkey Name ) ĊĠĠĠĠĠĠĠ Ġset Text In Dialog And Confirm ( activity , Ġx pr vs [ network ] !! ) ĊĠĠĠĠĠĠĠ Ġon View ( with Text ( key Name )). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġclick Element In List ( key Name ) ĊĠĠĠĠĠĠĠ Ġon View ( with Text ( x pub s [ network ])). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . delete )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġset Text In Dialog And Confirm ( activity , Ġkey Name , Ġ" DELETE ") ĊĠĠĠĠĠĠĠ Ġcheck And Dismiss Dialog ( R . string . deleted ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . key _ button )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġcheck Element NotIn List ( key Name ) ĊĊĠĠĠĠĠĠĠ Ġval Ġinvalid Network Ġ= Ġinvalid Network ( network ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . item _ new )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġclick Element In List ( imports Text [ network ] !! ) ĊĠĠĠĠĠĠĠ Ġset Text In Dialog And Confirm ( activity , Ġkey Name ) ĊĠĠĠĠĠĠĠ Ġset Text In Dialog And Confirm ( activity , Ġx pr vs [ invalid Network ] !! ) ĊĠĠĠĠĠĠĠ Ġcheck And Dismiss Dialog ( R . string . invalid _ x prv _ or _ mn emonic ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġmnemonic () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġactivity Ġ= Ġactivity Rule . launch Activity ( Intent ()) ĊĠĠĠĠĠĠĠ Ġval Ġkey Name Ġ= Ġ" key ${ System . currentTimeMillis () }" ĊĊĠĠĠĠĠĠĠ Ġval Ġexpected Desc Pub Main net Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"[ c abe 3 2 d 7 / 4 8 '/ 0 '/ 0 '/ 2 '] x pub 6 Dh V vf 4 Gf Rx VQ Z xc G TY Fx w W Po L 7 Gb X Me 7 nf P 5 U hi 5 ZW bq v Wd J sd J nw K kk c Wi Wb se 2 f B Zn 3 RP i S j zp J wq Ne 8 Z wq vv 9 DS j Pq kk d U ie g P 9 7 SVC / 0 /* " ĊĠĠĠĠĠĠĠ Ġval Ġexpected Desc Pub Test net Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"[ c abe 3 2 d 7 / 4 8 '/ 1 '/ 0 '/ 2 '] tp ub DER UR uy F UB H 1 qf B 3 8 h VJ FX Rr G 4 f J 6 SQ S 3 jw ix L At v RA ier c 8 pb m LF 3 w BW pi qe V 4 k Xk CN 2 Q vnd Geo 5 wc Wt NX CN ym v Sm Bn WT 9 Ng N cb 2 nb EW Qv / 0 /* " ĊĠĠĠĠĠĠĠ Ġval Ġexpected Desc Pub Sign et Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"[ c abe 3 2 d 7 / 4 8 '/ 3 '/ 0 '/ 2 '] tp ub DE mp C ZS fan 5 n 7 u G 2 H De 9 CA h 2 5 Jx gk Gy v XG g Xf Px Q ha Z 8 wz q J 9 bp J 6 AS Qk kw Py f Hb Ty 7 Ew 4 M WC zy dic wf H SY C 5 h ES 6 e Nz 1 n C 9 ET Lc 9 2 o By 2 o / 0 /* " ĊĠĠĠĠĠĠĠ Ġval Ġexpected Desc Pub Reg test Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"[ c abe 3 2 d 7 / 4 8 '/ 2 '/ 0 '/ 2 '] tp ub DE AN Pi 9 uc M 4 k 8 g 5 4 9 b 4 f 1 NU jt is S Jz 9 Sa KP xf mv rj 3 n G JC d 9 HL n 3 bpm Ju 5 PLE w LV 4 r DQ q az jw N 2 r H ac j H 2 W 2 w V 9 3 S 9 W AB HX HJ Vg Hu AA y VH r / 0 /* " ĊĊĠĠĠĠĠĠĠ Ġval Ġexpected X pub Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" main net " Ġto Ġexpected Desc Pub Main net , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" test net " Ġto Ġexpected Desc Pub Test net , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" sign et " Ġto Ġexpected Desc Pub Sign et , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" reg test " Ġto Ġexpected Desc Pub Reg test ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġmnemonic Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" b unk er Ġs hed Ġuseless Ġabout Ġbuild Ġt aste Ġcomfort Ġacquire Ġfood Ġdef ense Ġn ation Ġc ement Ġob li ge Ġrace Ġmanual Ġnarrow Ġmer it Ġl umber Ġslight Ġpattern Ġplate Ġbudget Ġar med Ġundo " ĊĠĠĠĠĠĠĠ Ġval Ġnetwork Ġ= Ġget Network () ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . key _ button )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . item _ new )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġclick Element In List ( activity . getString ( R . string . import _ mn emonic )) ĊĠĠĠĠĠĠĠ Ġset Text In Dialog And Confirm ( activity , Ġkey Name ) ĊĠĠĠĠĠĠĠ Ġset Text In Dialog And Confirm ( activity , Ġ" invalid ") ĊĠĠĠĠĠĠĠ Ġcheck And Dismiss Dialog ( R . string . invalid _ x prv _ or _ mn emonic ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . item _ new )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġclick Element In List ( activity . getString ( R . string . import _ mn emonic )) ĊĠĠĠĠĠĠĠ Ġset Text In Dialog And Confirm ( activity , Ġkey Name ) ĊĠĠĠĠĠĠĠ Ġset Text In Dialog And Confirm ( activity , Ġmnemonic ) ĊĠĠĠĠĠĠĠ Ġon View ( with Text ( key Name )). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġclick Element In List ( key Name ) ĊĠĠĠĠĠĠĠ Ġon View ( with Text ( expected X pub [ network ])). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . delete )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġset Text In Dialog And Confirm ( activity , Ġkey Name , Ġ" DELETE ") ĊĠĠĠĠĠĠĠ Ġcheck And Dismiss Dialog ( R . string . deleted ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . key _ button )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġcheck Element NotIn List ( key Name ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġdice () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġactivity Ġ= Ġactivity Rule . launch Activity ( Intent ()) ĊĠĠĠĠĠĠĠ Ġval Ġkey Name Ġ= Ġ" key ${ System . currentTimeMillis () }" ĊĠĠĠĠĠĠĠ Ġval Ġexpected Desc Pub Main net Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"[ 9 cf 7 9 4 b 6 / 4 8 '/ 0 '/ 0 '/ 2 '] x pub 6 Ec B bn jo W Qy B 2 sm 1 n D pi q ymb 6 2 9 p CQ mpr Dp 2 2 Q WU 8 NX p 8 1 Y Hz cm 9 8 du ac rav 2 s 1 bw 3 k C ry M 6 UT kn RD J cx HC xk HX 3 fc Xr ms Ky 6 Q RW p DD pT q S / 0 /* " ĊĠĠĠĠĠĠĠ Ġval Ġexpected Desc Pub Test net Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"[ 9 cf 7 9 4 b 6 / 4 8 '/ 1 '/ 0 '/ 2 '] tp ub DF 2 XE j MT g 9 4 e FN As X 5 j EK 5 nx A 4 Vs 6 VV j J QX gz t Km Sp Gy 5 ji BN B gr mp q xc j TE z dn vf VG 5 U 7 S ML nd PH J ph 9 EH VM Z ie 6 HF Y Ct 6 Xn Xf F pw AS qy q / 0 /* " ĊĠĠĠĠĠĠĠ Ġval Ġexpected Desc Pub Sign et Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"[ 9 cf 7 9 4 b 6 / 4 8 '/ 3 '/ 0 '/ 2 '] tp ub DE hd 7 R me zf BK Fp BS x Mx h XY K qs W 4 E 2 dB VT 7 J mm 9 N 5 YW k E Hi NJ 6 iz uz b My Zd Y wh Dk 2 x 6 Ge C kc ZE V 7 x 8 6 k Gf 9 Y aw r K Z GZ 6 v 2 c 9 tx MJ 1 vj dz 4 J 1 / 0 /* " ĊĠĠĠĠĠĠĠ Ġval Ġexpected Desc Pub Reg test Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"[ 9 cf 7 9 4 b 6 / 4 8 '/ 2 '/ 0 '/ 2 '] tp ub DF K Hx ok A 8 JT G ed RP mk Fv CJ 8 CB 2 z qc Ht 3 zu P 7 Bw N ar w ZE kr h Rn Gp Pz C 9 Kk dt Gj 9 Kv Y df 3 h BU 8 N 3 CM a 4 3 y WM i Lu B 5 W 3 f 9 5 T nc Hg SZ t Ta H 5 TT N / 0 /* " ĊĠĠĠĠĠĠĠ Ġval Ġexpected X pub Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" main net " Ġto Ġexpected Desc Pub Main net , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" test net " Ġto Ġexpected Desc Pub Test net , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" sign et " Ġto Ġexpected Desc Pub Sign et , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" reg test " Ġto Ġexpected Desc Pub Reg test ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġnetwork Ġ= Ġget Network () ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . key _ button )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . item _ new )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġclick Element In List ( activity . getString ( R . string . dice )) ĊĠĠĠĠĠĠĠ Ġset Text In Dialog And Confirm ( activity , Ġkey Name ) ĊĠĠĠĠĠĠĠ Ġclick Element In List (" 2 0 ") ĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 1 .. 5 9 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġclick Element In List (" 2 ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġon View ( with Text ( key Name )). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġclick Element In List ( key Name ) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Text ( expected X pub [ network ] !! )). check ( matches ( is Displayed ())) ĊĠĠĠ Ġ} Ċ } Ċ