Navigate from connections to connection page

This commit is contained in:
Marcial Rosales 2024-11-15 17:55:42 +01:00
parent 88f1028333
commit 86bf3e108f
5 changed files with 40 additions and 18 deletions

View File

@ -1,7 +1,7 @@
<h2>Connection <%= fmt_string(connection.name) %> <%= fmt_maybe_vhost(connection.vhost) %></h1> <h2>Connection <%= fmt_string(connection.name) %> <%= fmt_maybe_vhost(connection.vhost) %></h1>
<% if (!disable_stats) { %> <% if (!disable_stats) { %>
<div class="section"> <div class="section" id="connection-overview-section">
<h2>Overview</h2> <h2>Overview</h2>
<div class="hider updatable"> <div class="hider updatable">
<%= data_rates('data-rates-conn', connection, 'Data rates') %> <%= data_rates('data-rates-conn', connection, 'Data rates') %>
@ -86,7 +86,7 @@
<% if (connection.protocol === 'AMQP 1-0') { %> <% if (connection.protocol === 'AMQP 1-0') { %>
<div class="section"> <div class="section" id="connection-sessions-section">
<h2 class="updatable" >Sessions (<%=(sessions.length)%>)</h2> <h2 class="updatable" >Sessions (<%=(sessions.length)%>)</h2>
<div class="hider updatable"> <div class="hider updatable">
<%= format('sessions-list', {'sessions': sessions}) %> <%= format('sessions-list', {'sessions': sessions}) %>
@ -95,7 +95,7 @@
<% } else { %> <% } else { %>
<div class="section"> <div class="section" id="connection-channels-section">
<h2 class="updatable" >Channels (<%=(channels.length)%>) </h2> <h2 class="updatable" >Channels (<%=(channels.length)%>) </h2>
<div class="hider updatable"> <div class="hider updatable">
<%= format('channels-list', {'channels': channels, 'mode': 'connection'}) %> <%= format('channels-list', {'channels': channels, 'mode': 'connection'}) %>
@ -149,7 +149,7 @@
<% } %> <% } %>
<% if (properties_size(connection.client_properties) > 0) { %> <% if (properties_size(connection.client_properties) > 0) { %>
<div class="section-hidden"> <div class="section-hidden" id="connection-client-properies-section">
<h2>Client properties</h2> <h2>Client properties</h2>
<div class="hider"> <div class="hider">
<%= fmt_table_long(connection.client_properties) %> <%= fmt_table_long(connection.client_properties) %>
@ -158,7 +158,7 @@
<% } %> <% } %>
<% if(connection.reductions || connection.garbage_collection) { %> <% if(connection.reductions || connection.garbage_collection) { %>
<div class="section-hidden"> <div class="section-hidden" id="connection-runtime-metrics-section">
<h2>Runtime Metrics (Advanced)</h2> <h2>Runtime Metrics (Advanced)</h2>
<div class="hider updatable"> <div class="hider updatable">
<%= data_reductions('reductions-rates-conn', connection) %> <%= data_reductions('reductions-rates-conn', connection) %>
@ -197,7 +197,7 @@
<% } %> <% } %>
<% } %> <% } %>
<div class="section-hidden"> <div class="section-hidden" id="connection-close-section">
<h2>Close this connection</h2> <h2>Close this connection</h2>
<div class="hider"> <div class="hider">
<form action="#/connections" method="delete" class="confirm"> <form action="#/connections" method="delete" class="confirm">

View File

@ -30,8 +30,7 @@ public class RoundTripTest {
String username = args.length > 0 ? args[0] : getEnv("RABBITMQ_AMQP_USERNAME", "guest"); String username = args.length > 0 ? args[0] : getEnv("RABBITMQ_AMQP_USERNAME", "guest");
String password = args.length > 1 ? args[1] : getEnv("RABBITMQ_AMQP_PASSWORD", "guest"); String password = args.length > 1 ? args[1] : getEnv("RABBITMQ_AMQP_PASSWORD", "guest");
boolean usemtls = Boolean.parseBoolean(getEnv("AMQP_USE_MTLS", "false")); boolean usemtls = Boolean.parseBoolean(getEnv("AMQP_USE_MTLS", "false"));
if ("amqps".equals(scheme)) { if ("amqps".equals(scheme)) {
List<String> connectionParams = new ArrayList<String>(); List<String> connectionParams = new ArrayList<String>();
@ -86,7 +85,7 @@ public class RoundTripTest {
assertEquals(message.getText(), receivedMessage.getText()); assertEquals(message.getText(), receivedMessage.getText());
Thread.sleep(30000); Thread.sleep(60000);
} }
} }
private static Connection createConnection(ConnectionFactory factory, private static Connection createConnection(ConnectionFactory factory,

View File

@ -6,6 +6,7 @@ const { buildDriver, goToHome, captureScreensFor, teardown } = require('../../ut
const LoginPage = require('../../pageobjects/LoginPage') const LoginPage = require('../../pageobjects/LoginPage')
const OverviewPage = require('../../pageobjects/OverviewPage') const OverviewPage = require('../../pageobjects/OverviewPage')
const ConnectionsPage = require('../../pageobjects/ConnectionsPage') const ConnectionsPage = require('../../pageobjects/ConnectionsPage')
const ConnectionPage = require('../../pageobjects/ConnectionPage')
var container = require('rhea') // https://github.com/amqp/rhea var container = require('rhea') // https://github.com/amqp/rhea
var receivedAmqpMessageCount = 0 var receivedAmqpMessageCount = 0
@ -26,6 +27,7 @@ container.once('sendable', function (context) {
describe('Given an amqp10 connection opened, listed and clicked on it', function () { describe('Given an amqp10 connection opened, listed and clicked on it', function () {
let captureScreen let captureScreen
let connectionsPage let connectionsPage
let connectionPage
let connection let connection
before(async function () { before(async function () {
@ -34,6 +36,7 @@ describe('Given an amqp10 connection opened, listed and clicked on it', function
login = new LoginPage(driver) login = new LoginPage(driver)
overview = new OverviewPage(driver) overview = new OverviewPage(driver)
connectionsPage = new ConnectionsPage(driver) connectionsPage = new ConnectionsPage(driver)
connectionPage = new ConnectionPage(driver)
captureScreen = captureScreensFor(driver, __filename) captureScreen = captureScreensFor(driver, __filename)
await login.login('monitoring-only', 'guest') await login.login('monitoring-only', 'guest')
await overview.isLoaded() await overview.isLoaded()
@ -55,12 +58,15 @@ describe('Given an amqp10 connection opened, listed and clicked on it', function
connections_table = await connectionsPage.getConnectionsTable(20) connections_table = await connectionsPage.getConnectionsTable(20)
assert.equal(1, connections_table.length) assert.equal(1, connections_table.length)
await connectionsPage.clickOnConnection(1) await connectionsPage.clickOnConnection(2)
console.log("clicked on connection")
await connectionPage.isLoaded()
}) })
it('can list session information', async function () { it('can list session information', async function () {
// flow control state let session_table = await connectionPage.list_sessions()
console.log("sessions " + session_table)
}) })
it('can list link information', async function () { it('can list link information', async function () {

View File

@ -0,0 +1,24 @@
const { By, Key, until, Builder } = require('selenium-webdriver')
const BasePage = require('./BasePage')
const OVERVIEW_SECTION = By.css('div#main div.section#connection-overview-section')
const SESSIONS_SECTION = By.css('div#main div.section#connection-sessions-section')
const SESSIONS_TABLE = By.css('div.section#connection-sessions-section table.list')
const CONNECTION_NAME = By.css('div#main h2')
module.exports = class ConnectionPage extends BasePage {
async isLoaded() {
return this.waitForDisplayed(CONNECTION_NAME)
}
async getName() {
return this.getText(CONNECTION_NAME)
}
async list_sessions() {
// maybe ensure the section is expanded
await this.waitForDisplayed(SESSIONS_SECTION)
return this.getTable(SESSIONS_TABLE)
}
}

View File

@ -26,12 +26,5 @@ module.exports = class OverviewPage extends BasePage {
} }
async downloadBrokerDefinitions(filename) { async downloadBrokerDefinitions(filename) {
return this.click(DOWNLOAD_DEFINITIONS_SECTION) return this.click(DOWNLOAD_DEFINITIONS_SECTION)
/*
await this.driver.sleep(1000)
await this.sendKeys(CHOOSE_BROKER_DOWNLOAD_FILE, filename)
await this.click(DOWNLOAD_BROKER_FILE)
return driver.sleep(5000);
*/
} }
} }