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, doWhile, log } = require ( '../utils' )
4
+ const { buildDriver, goToHome, captureScreensFor, teardown, doWhile, log, delay } = require ( '../utils' )
5
5
const { getManagementUrl, createVhost, deleteVhost } = require ( '../mgt-api' )
6
6
7
7
const LoginPage = require ( '../pageobjects/LoginPage' )
@@ -51,15 +51,51 @@ describe('Virtual Hosts in Admin tab', function () {
51
51
await overview . clickOnOverviewTab ( )
52
52
await overview . clickOnAdminTab ( )
53
53
await adminTab . clickOnVhosts ( )
54
+ await doWhile ( async function ( ) { return vhostsTab . getVhostsTable ( ) } ,
55
+ function ( table ) { return table . length > 1 } )
56
+
54
57
await vhostsTab . clickOnSelectTableColumns ( )
55
58
let table = await vhostsTab . getSelectableTableColumns ( )
56
- log ( "Table: " + table )
57
- await doWhile ( async function ( ) {
58
- return vhostsTab . getVhostsTable ( )
59
- } , function ( table ) {
60
- return table . length > 0 && vhost . localeCompare ( table [ 0 ] [ 0 ] )
61
- } )
59
+
60
+ assert . equal ( 4 , table . length )
61
+ let overviewGroup = {
62
+ "name" : "Overview:" ,
63
+ "columns" : [
64
+ { "name:" :"Default queue type" , "id" :"checkbox-vhosts-default-queue-type" } ,
65
+ { "name:" :"Cluster state" , "id" :"checkbox-vhosts-cluster-state" } ,
66
+ { "name:" :"Description" , "id" :"checkbox-vhosts-description" } ,
67
+ { "name:" :"Tags" , "id" :"checkbox-vhosts-tags" }
68
+ ]
69
+ }
70
+ assert . equal ( JSON . stringify ( table [ 0 ] ) , JSON . stringify ( overviewGroup ) )
71
+ let messagesGroup = {
72
+ "name" : "Messages:" ,
73
+ "columns" : [
74
+ { "name:" :"Ready" , "id" :"checkbox-vhosts-msgs-ready" } ,
75
+ { "name:" :"Unacknowledged" , "id" :"checkbox-vhosts-msgs-unacked" } ,
76
+ { "name:" :"Total" , "id" :"checkbox-vhosts-msgs-total" }
77
+ ]
78
+ }
79
+ assert . equal ( JSON . stringify ( table [ 1 ] ) , JSON . stringify ( messagesGroup ) )
80
+ let networkGroup = {
81
+ "name" : "Network:" ,
82
+ "columns" : [
83
+ { "name:" :"From client" , "id" :"checkbox-vhosts-from_client" } ,
84
+ { "name:" :"To client" , "id" :"checkbox-vhosts-to_client" }
85
+ ]
86
+ }
87
+ assert . equal ( JSON . stringify ( table [ 2 ] ) , JSON . stringify ( networkGroup ) )
88
+ let messageRatesGroup = {
89
+ "name" : "Message rates:" ,
90
+ "columns" : [
91
+ { "name:" :"publish" , "id" :"checkbox-vhosts-rate-publish" } ,
92
+ { "name:" :"deliver / get" , "id" :"checkbox-vhosts-rate-deliver" }
93
+ ]
94
+ }
95
+ assert . equal ( JSON . stringify ( table [ 3 ] ) , JSON . stringify ( messageRatesGroup ) )
96
+
62
97
} )
98
+
63
99
describe ( 'given there is a new virtualhost with a tag' , async function ( ) {
64
100
let vhost = "test_" + Math . floor ( Math . random ( ) * 1000 )
65
101
before ( async function ( ) {
@@ -70,23 +106,27 @@ describe('Virtual Hosts in Admin tab', function () {
70
106
await adminTab . clickOnVhosts ( )
71
107
} )
72
108
it ( 'vhost is listed with tag' , async function ( ) {
73
- log ( "Searching for vhost" )
74
- await vhostsTab . searchForVhosts ( vhost )
75
- await vhostsTab . clickOnSelectTableColumns ( )
76
- let table = vhostsTab . getSelectableTableColumns ( )
77
- log ( "Table: " + table )
78
- await doWhile ( async function ( ) {
79
- return vhostsTab . getVhostsTable ( )
80
- } , function ( table ) {
81
- return table . length > 0 && vhost . localeCompare ( table [ 0 ] [ 0 ] )
109
+ log ( "Searching for vhost " + vhost )
110
+ await doWhile ( async function ( ) { return vhostsTab . searchForVhosts ( vhost ) } ,
111
+ function ( table ) {
112
+ return table . length == 1 && table [ 1 ] [ 0 ] . localeCompare ( vhost )
113
+ } )
114
+ log ( "Found vhost " + vhost )
115
+ await vhostsTab . selectTableColumnsById ( [ "checkbox-vhosts-tags" ] )
116
+
117
+ await doWhile ( async function ( ) { return vhostsTab . getVhostsTable ( ) } ,
118
+ function ( table ) {
119
+ return table . length == 1 && table [ 1 ] [ 3 ] . localeCompare ( "selenium-tag" )
82
120
} )
121
+
83
122
} )
84
123
after ( async function ( ) {
85
124
log ( "Deleting vhost" )
86
125
deleteVhost ( getManagementUrl ( ) , vhost )
87
126
} )
88
127
89
128
} )
129
+
90
130
91
131
after ( async function ( ) {
92
132
await teardown ( driver , this , captureScreen )
0 commit comments