1
1
const { By, Key, until, Builder } = require ( 'selenium-webdriver' )
2
2
require ( 'chromedriver' )
3
3
const assert = require ( 'assert' )
4
- const { buildDriver, goToHome, captureScreensFor, teardown } = require ( '../../utils' )
4
+ const { buildDriver, goToHome, captureScreensFor, teardown, delay } = require ( '../../utils' )
5
5
6
6
const LoginPage = require ( '../../pageobjects/LoginPage' )
7
7
const OverviewPage = require ( '../../pageobjects/OverviewPage' )
@@ -10,7 +10,7 @@ const ConnectionPage = require('../../pageobjects/ConnectionPage')
10
10
11
11
var container = require ( 'rhea' ) // https://github.com/amqp/rhea
12
12
var receivedAmqpMessageCount = 0
13
- var connectionEstablishedPromise = new Promise ( ( resolve , reject ) => {
13
+ var untilConnectionEstablished = new Promise ( ( resolve , reject ) => {
14
14
container . on ( 'connection_open' , function ( context ) {
15
15
resolve ( )
16
16
} )
@@ -20,7 +20,7 @@ container.on('message', function (context) {
20
20
receivedAmqpMessageCount ++
21
21
} )
22
22
container . once ( 'sendable' , function ( context ) {
23
- context . sender . send ( { body :'Hello World! ' } )
23
+ context . sender . send ( { body :'first message ' } )
24
24
} )
25
25
26
26
@@ -54,12 +54,12 @@ describe('Given an amqp10 connection opened, listed and clicked on it', function
54
54
target : 'receiver-target' ,
55
55
name : 'receiver-link'
56
56
} )
57
- connection . open_sender ( {
57
+ sender = connection . open_sender ( {
58
58
target : 'examples' ,
59
59
source : 'sender-source' ,
60
60
name : 'sender-link'
61
61
} )
62
- await connectionEstablishedPromise
62
+ await untilConnectionEstablished
63
63
await overview . clickOnConnectionsTab ( )
64
64
await connectionsPage . isLoaded ( )
65
65
@@ -74,7 +74,7 @@ describe('Given an amqp10 connection opened, listed and clicked on it', function
74
74
let sessions = await connectionPage . getSessions ( )
75
75
assert . equal ( 1 , sessions . sessions . length )
76
76
let session = connectionPage . getSessionInfo ( sessions . sessions , 0 )
77
- // console.log("session: " + JSON.stringify(session))
77
+ console . log ( "session: " + JSON . stringify ( session ) )
78
78
assert . equal ( 0 , session . channelNumber )
79
79
assert . equal ( 1 , session . nextIncomingId )
80
80
assert . equal ( 0 , session . outgoingUnsettledDeliveries )
@@ -84,17 +84,18 @@ describe('Given an amqp10 connection opened, listed and clicked on it', function
84
84
let sessions = await connectionPage . getSessions ( )
85
85
assert . equal ( 1 , sessions . incoming_links . length )
86
86
assert . equal ( 1 , sessions . outgoing_links . length )
87
-
87
+
88
88
let incomingLink = connectionPage . getIncomingLinkInfo ( sessions . incoming_links , 0 )
89
- // console.log("incomingLink: " + JSON.stringify(incomingLink))
89
+ console . log ( "incomingLink: " + JSON . stringify ( incomingLink ) )
90
90
assert . equal ( 1 , incomingLink . handle )
91
91
assert . equal ( "sender-link" , incomingLink . name )
92
92
assert . equal ( "examples" , incomingLink . targetAddress )
93
93
assert . equal ( "mixed" , incomingLink . sndSettleMode )
94
94
assert . equal ( "0" , incomingLink . unconfirmedMessages )
95
-
95
+ assert . equal ( 1 , incomingLink . deliveryCount )
96
+
96
97
let outgoingLink = connectionPage . getOutgoingLinkInfo ( sessions . outgoing_links , 0 )
97
- // console.log("outgoingLink: " + JSON.stringify(outgoingLink))
98
+ console . log ( "outgoingLink: " + JSON . stringify ( outgoingLink ) )
98
99
assert . equal ( 0 , outgoingLink . handle )
99
100
assert . equal ( "receiver-link" , outgoingLink . name )
100
101
assert . equal ( "examples" , outgoingLink . sourceAddress )
@@ -105,6 +106,28 @@ describe('Given an amqp10 connection opened, listed and clicked on it', function
105
106
106
107
} )
107
108
109
+ it ( 'display live link information' , async function ( ) {
110
+ var untilMessageReceived = new Promise ( ( resolve , reject ) => {
111
+ container . on ( 'message' , function ( context ) {
112
+ resolve ( )
113
+ } )
114
+ } )
115
+ sender . send ( { body :'second message' } )
116
+ await untilMessageReceived
117
+ assert . equal ( 2 , receivedAmqpMessageCount )
118
+
119
+ await delay ( 5 * 1000 ) // wait until page refreshes
120
+ let sessions = await connectionPage . getSessions ( )
121
+ let session = connectionPage . getSessionInfo ( sessions . sessions , 0 )
122
+ let incomingLink = connectionPage . getIncomingLinkInfo ( sessions . incoming_links , 0 )
123
+ let outgoingLink = connectionPage . getOutgoingLinkInfo ( sessions . outgoing_links , 0 )
124
+ assert . equal ( 2 , incomingLink . deliveryCount )
125
+
126
+ //console.log("incomingLink: " + JSON.stringify(incomingLink))
127
+ //console.log("outgoingLink: " + JSON.stringify(outgoingLink))
128
+ } )
129
+
130
+
108
131
after ( async function ( ) {
109
132
await teardown ( driver , this , captureScreen )
110
133
try {
0 commit comments