1+ describe ( 'address page' , function ( ) {
2+ before ( ( ) => {
3+ // Prepare an address for testing
4+ cy . task ( 'bitcoind:newaddr' ) . as ( 'test_addr' ) . then ( test_addr => {
5+ cy . task ( 'bitcoind:sendto' , { addr : test_addr , amount : 0.1 } ) . as ( 'test_txid1' )
6+ cy . task ( 'bitcoind:sendto' , { addr : test_addr , amount : 0.2 } ) . as ( 'test_txid2' )
7+ cy . task ( 'bitcoind:mine' )
8+ cy . task ( 'bitcoind:sendto' , { addr : test_addr , amount : 0.4 } ) . as ( 'test_txid3' )
9+ cy . wait ( 6000 )
10+ cy . visit ( `/address/${ test_addr } ` )
11+ } )
12+ } )
13+
14+ it ( 'displays the address stats' , function ( ) {
15+ cy . get ( '.stats-table' )
16+ . contains ( '> div' , 'Confirmed received' )
17+ . find ( 'div:eq(1)' )
18+ . should ( 'have.text' , '2 outputs (0.3 rBTC)' )
19+
20+ cy . get ( '.stats-table' )
21+ . contains ( '> div' , 'Unconfirmed received' )
22+ . find ( 'div:eq(1)' )
23+ . should ( 'have.text' , '1 output (0.4 rBTC)' )
24+
25+ cy . get ( '.stats-table' )
26+ . contains ( '> div' , 'Total unspent' )
27+ . find ( 'div:eq(1)' )
28+ . should ( 'have.text' , '3 outputs (0.7 rBTC)' )
29+ } )
30+
31+ it ( 'displays the address historical transactions' , function ( ) {
32+ cy . get ( '.transactions .transaction-box' )
33+ . should ( 'have.length' , 3 )
34+
35+ ; [ [ this . test_txid1 , 0.1 ] , [ this . test_txid2 , 0.2 ] , [ this . test_txid3 , 0.4 ] ] . forEach ( ( [ txid , amount ] ) => {
36+ cy . contains ( '.transaction-box' , txid )
37+ . should ( 'exist' )
38+
39+ . contains ( '.vout' , this . test_addr )
40+ . should ( 'have.class' , 'active' )
41+
42+ . find ( '.amount' )
43+ . should ( 'have.text' , `${ amount } rBTC` )
44+ } )
45+ } )
46+
47+ after ( ( ) => cy . task ( 'bitcoind:mine' ) )
48+ } )
0 commit comments