Test live data
This commit is contained in:
parent
310b7e91e6
commit
0bc9a49b24
|
@ -1,7 +1,7 @@
|
|||
const { By, Key, until, Builder } = require('selenium-webdriver')
|
||||
require('chromedriver')
|
||||
const assert = require('assert')
|
||||
const { buildDriver, goToHome, captureScreensFor, teardown } = require('../../utils')
|
||||
const { buildDriver, goToHome, captureScreensFor, teardown, delay } = require('../../utils')
|
||||
|
||||
const LoginPage = require('../../pageobjects/LoginPage')
|
||||
const OverviewPage = require('../../pageobjects/OverviewPage')
|
||||
|
@ -10,7 +10,7 @@ const ConnectionPage = require('../../pageobjects/ConnectionPage')
|
|||
|
||||
var container = require('rhea') // https://github.com/amqp/rhea
|
||||
var receivedAmqpMessageCount = 0
|
||||
var connectionEstablishedPromise = new Promise((resolve, reject) => {
|
||||
var untilConnectionEstablished = new Promise((resolve, reject) => {
|
||||
container.on('connection_open', function(context) {
|
||||
resolve()
|
||||
})
|
||||
|
@ -20,7 +20,7 @@ container.on('message', function (context) {
|
|||
receivedAmqpMessageCount++
|
||||
})
|
||||
container.once('sendable', function (context) {
|
||||
context.sender.send({body:'Hello World!'})
|
||||
context.sender.send({body:'first message'})
|
||||
})
|
||||
|
||||
|
||||
|
@ -54,12 +54,12 @@ describe('Given an amqp10 connection opened, listed and clicked on it', function
|
|||
target: 'receiver-target',
|
||||
name: 'receiver-link'
|
||||
})
|
||||
connection.open_sender({
|
||||
sender = connection.open_sender({
|
||||
target: 'examples',
|
||||
source: 'sender-source',
|
||||
name: 'sender-link'
|
||||
})
|
||||
await connectionEstablishedPromise
|
||||
await untilConnectionEstablished
|
||||
await overview.clickOnConnectionsTab()
|
||||
await connectionsPage.isLoaded()
|
||||
|
||||
|
@ -74,7 +74,7 @@ describe('Given an amqp10 connection opened, listed and clicked on it', function
|
|||
let sessions = await connectionPage.getSessions()
|
||||
assert.equal(1, sessions.sessions.length)
|
||||
let session = connectionPage.getSessionInfo(sessions.sessions, 0)
|
||||
//console.log("session: " + JSON.stringify(session))
|
||||
console.log("session: " + JSON.stringify(session))
|
||||
assert.equal(0, session.channelNumber)
|
||||
assert.equal(1, session.nextIncomingId)
|
||||
assert.equal(0, session.outgoingUnsettledDeliveries)
|
||||
|
@ -84,17 +84,18 @@ describe('Given an amqp10 connection opened, listed and clicked on it', function
|
|||
let sessions = await connectionPage.getSessions()
|
||||
assert.equal(1, sessions.incoming_links.length)
|
||||
assert.equal(1, sessions.outgoing_links.length)
|
||||
|
||||
|
||||
let incomingLink = connectionPage.getIncomingLinkInfo(sessions.incoming_links, 0)
|
||||
//console.log("incomingLink: " + JSON.stringify(incomingLink))
|
||||
console.log("incomingLink: " + JSON.stringify(incomingLink))
|
||||
assert.equal(1, incomingLink.handle)
|
||||
assert.equal("sender-link", incomingLink.name)
|
||||
assert.equal("examples", incomingLink.targetAddress)
|
||||
assert.equal("mixed", incomingLink.sndSettleMode)
|
||||
assert.equal("0", incomingLink.unconfirmedMessages)
|
||||
|
||||
assert.equal(1, incomingLink.deliveryCount)
|
||||
|
||||
let outgoingLink = connectionPage.getOutgoingLinkInfo(sessions.outgoing_links, 0)
|
||||
//console.log("outgoingLink: " + JSON.stringify(outgoingLink))
|
||||
console.log("outgoingLink: " + JSON.stringify(outgoingLink))
|
||||
assert.equal(0, outgoingLink.handle)
|
||||
assert.equal("receiver-link", outgoingLink.name)
|
||||
assert.equal("examples", outgoingLink.sourceAddress)
|
||||
|
@ -105,6 +106,28 @@ describe('Given an amqp10 connection opened, listed and clicked on it', function
|
|||
|
||||
})
|
||||
|
||||
it('display live link information', async function () {
|
||||
var untilMessageReceived = new Promise((resolve, reject) => {
|
||||
container.on('message', function(context) {
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
sender.send({body:'second message'})
|
||||
await untilMessageReceived
|
||||
assert.equal(2, receivedAmqpMessageCount)
|
||||
|
||||
await delay(5*1000) // wait until page refreshes
|
||||
let sessions = await connectionPage.getSessions()
|
||||
let session = connectionPage.getSessionInfo(sessions.sessions, 0)
|
||||
let incomingLink = connectionPage.getIncomingLinkInfo(sessions.incoming_links, 0)
|
||||
let outgoingLink = connectionPage.getOutgoingLinkInfo(sessions.outgoing_links, 0)
|
||||
assert.equal(2, incomingLink.deliveryCount)
|
||||
|
||||
//console.log("incomingLink: " + JSON.stringify(incomingLink))
|
||||
//console.log("outgoingLink: " + JSON.stringify(outgoingLink))
|
||||
})
|
||||
|
||||
|
||||
after(async function () {
|
||||
await teardown(driver, this, captureScreen)
|
||||
try {
|
||||
|
|
|
@ -44,10 +44,10 @@ module.exports = class ConnectionPage extends BasePage {
|
|||
name: links[index][1],
|
||||
targetAddress: links[index][2],
|
||||
sndSettleMode: links[index][3],
|
||||
maxMessageSize: links[index][4],
|
||||
deliveryCount: links[index][5],
|
||||
linkCredit: links[index][6],
|
||||
unconfirmedMessages: links[index][7]
|
||||
maxMessageSize: Number(links[index][4]),
|
||||
deliveryCount: Number(links[index][5]),
|
||||
linkCredit: Number(links[index][6]),
|
||||
unconfirmedMessages: Number(links[index][7])
|
||||
}
|
||||
}
|
||||
getOutgoingLinkInfo(links, index) {
|
||||
|
@ -58,8 +58,8 @@ module.exports = class ConnectionPage extends BasePage {
|
|||
queueName: links[index][3],
|
||||
sendSettled: links[index][4] == "●" ? true : false,
|
||||
maxMessageSize: links[index][5],
|
||||
deliveryCount: links[index][6],
|
||||
linkCredit: links[index][7]
|
||||
deliveryCount: Number(links[index][6]),
|
||||
linkCredit: Number(links[index][7])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue