Testing new vhost has the tag
This commit is contained in:
parent
7003fefa44
commit
ea66a25dfa
|
@ -13,11 +13,13 @@ const EXCHANGES_TAB = By.css('div#menu ul#tabs li#exchanges')
|
||||||
const ADMIN_TAB = By.css('div#menu ul#tabs li#admin')
|
const ADMIN_TAB = By.css('div#menu ul#tabs li#admin')
|
||||||
const STREAM_CONNECTIONS_TAB = By.css('div#menu ul#tabs li#stream-connections')
|
const STREAM_CONNECTIONS_TAB = By.css('div#menu ul#tabs li#stream-connections')
|
||||||
|
|
||||||
const FORM_POPUP = By.css('div.form-popup-warn')
|
const FORM_POPUP_WARNING = By.css('div.form-popup-warn')
|
||||||
const FORM_POPUP_CLOSE_BUTTON = By.css('div.form-popup-warn span#close')
|
const FORM_POPUP_WARNING_CLOSE_BUTTON = By.css('div.form-popup-warn span#close')
|
||||||
|
|
||||||
|
const FORM_POPUP_OPTIONS = By.css('div.form-popup-options')
|
||||||
const ADD_MINUS_BUTTON = By.css('div#main table.list thead tr th.plus-minus')
|
const ADD_MINUS_BUTTON = By.css('div#main table.list thead tr th.plus-minus')
|
||||||
const TABLE_COLUMNS_POPUP = By.css('div.form-popup-options table.form')
|
const TABLE_COLUMNS_POPUP = By.css('div.form-popup-options table.form')
|
||||||
|
const FORM_POPUP_OPTIONS_CLOSE_BUTTON = By.css('div.form-popup-options span#close')
|
||||||
|
|
||||||
module.exports = class BasePage {
|
module.exports = class BasePage {
|
||||||
driver
|
driver
|
||||||
|
@ -157,7 +159,7 @@ module.exports = class BasePage {
|
||||||
}
|
}
|
||||||
async isPopupWarningDisplayed() {
|
async isPopupWarningDisplayed() {
|
||||||
try {
|
try {
|
||||||
let element = await driver.findElement(FORM_POPUP)
|
let element = await driver.findElement(FORM_POPUP_WARNING)
|
||||||
return element.isDisplayed()
|
return element.isDisplayed()
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
return Promise.resolve(false)
|
return Promise.resolve(false)
|
||||||
|
@ -175,7 +177,7 @@ module.exports = class BasePage {
|
||||||
}
|
}
|
||||||
|
|
||||||
async isPopupWarningNotDisplayed() {
|
async isPopupWarningNotDisplayed() {
|
||||||
return this.isElementNotVisible(FORM_POPUP)
|
return this.isElementNotVisible(FORM_POPUP_WARNING)
|
||||||
}
|
}
|
||||||
|
|
||||||
async isElementNotVisible(locator) {
|
async isElementNotVisible(locator) {
|
||||||
|
@ -195,13 +197,13 @@ module.exports = class BasePage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async getPopupWarning() {
|
async getPopupWarning() {
|
||||||
let element = await driver.findElement(FORM_POPUP)
|
let element = await driver.findElement(FORM_POPUP_WARNING)
|
||||||
return this.driver.wait(until.elementIsVisible(element), this.timeout,
|
return this.driver.wait(until.elementIsVisible(element), this.timeout,
|
||||||
'Timed out after [timeout=' + this.timeout + ';polling=' + this.polling + '] awaiting till visible ' + element,
|
'Timed out after [timeout=' + this.timeout + ';polling=' + this.polling + '] awaiting till visible ' + element,
|
||||||
this.polling).getText().then((value) => value.substring(0, value.search('\n\nClose')))
|
this.polling).getText().then((value) => value.substring(0, value.search('\n\nClose')))
|
||||||
}
|
}
|
||||||
async closePopupWarning() {
|
async closePopupWarning() {
|
||||||
return this.click(FORM_POPUP_CLOSE_BUTTON)
|
return this.click(FORM_POPUP_WARNING_CLOSE_BUTTON)
|
||||||
}
|
}
|
||||||
async clickOnSelectTableColumns() {
|
async clickOnSelectTableColumns() {
|
||||||
return this.click(ADD_MINUS_BUTTON)
|
return this.click(ADD_MINUS_BUTTON)
|
||||||
|
@ -210,24 +212,28 @@ module.exports = class BasePage {
|
||||||
const table = await this.waitForDisplayed(TABLE_COLUMNS_POPUP)
|
const table = await this.waitForDisplayed(TABLE_COLUMNS_POPUP)
|
||||||
const rows = await table.findElements(By.css('tbody tr'))
|
const rows = await table.findElements(By.css('tbody tr'))
|
||||||
let table_model = []
|
let table_model = []
|
||||||
console.log("Found "+ rows.length + " rows")
|
|
||||||
for (let i = 1; i < rows.length; i++) { // skip first row
|
for (let i = 1; i < rows.length; i++) { // skip first row
|
||||||
let groupNameLabel = await rows[i].findElement(By.css('th label'))
|
let groupNameLabel = await rows[i].findElement(By.css('th label'))
|
||||||
let groupName = await groupNameLabel.getText()
|
let groupName = await groupNameLabel.getText()
|
||||||
console.log("Found group "+ groupName )
|
|
||||||
let columns = await rows[i].findElements(By.css('td label'))
|
let columns = await rows[i].findElements(By.css('td label'))
|
||||||
let table_row = []
|
let table_row = []
|
||||||
console.log("Found "+ columns.length + " columns")
|
|
||||||
for (let column of columns) {
|
for (let column of columns) {
|
||||||
let checkbox = await column.findElement(By.css('input'))
|
let checkbox = await column.findElement(By.css('input'))
|
||||||
table_row.push({"name:" : await column.getText(), "id" : await checkbox.getAttribute("id")})
|
table_row.push({"name:" : await column.getText(), "id" : await checkbox.getAttribute("id")})
|
||||||
}
|
}
|
||||||
let group = {"name": groupName, "columns": table_row}
|
let group = {"name": groupName, "columns": table_row}
|
||||||
console.log("Add group " + group)
|
|
||||||
table_model.push(group)
|
table_model.push(group)
|
||||||
}
|
}
|
||||||
return table_model
|
return table_model
|
||||||
}
|
}
|
||||||
|
async selectTableColumnsById(arrayOfColumnsIds) {
|
||||||
|
const table = await this.waitForDisplayed(TABLE_COLUMNS_POPUP)
|
||||||
|
for (let id of arrayOfColumnsIds) {
|
||||||
|
let checkbox = await table.findElement(By.css('tbody tr input#'+id))
|
||||||
|
await checkbox.click()
|
||||||
|
}
|
||||||
|
await this.click(FORM_POPUP_OPTIONS_CLOSE_BUTTON)
|
||||||
|
}
|
||||||
|
|
||||||
async isDisplayed(locator) {
|
async isDisplayed(locator) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -9,7 +9,7 @@ const FILTER_VHOST = By.css('div#main div.filter input#filter')
|
||||||
const CHECKBOX_REGEX = By.css('div#main div.filter input#filter-regex-mode')
|
const CHECKBOX_REGEX = By.css('div#main div.filter input#filter-regex-mode')
|
||||||
|
|
||||||
const VHOSTS_TABLE_ROWS = By.css('div#main table.list tbody tr')
|
const VHOSTS_TABLE_ROWS = By.css('div#main table.list tbody tr')
|
||||||
const TABLE_SECTION = By.css('div#main table.list')
|
const TABLE_SECTION = By.css('div#main div#vhosts.section table.list')
|
||||||
|
|
||||||
module.exports = class VhostsAdminTab extends AdminTab {
|
module.exports = class VhostsAdminTab extends AdminTab {
|
||||||
async isLoaded () {
|
async isLoaded () {
|
||||||
|
|
|
@ -62,7 +62,7 @@ module.exports = {
|
||||||
}
|
}
|
||||||
let chromeCapabilities = Capabilities.chrome();
|
let chromeCapabilities = Capabilities.chrome();
|
||||||
const options = new chrome.Options()
|
const options = new chrome.Options()
|
||||||
chromeCapabilities.setAcceptInsecureCerts(true);
|
chromeCapabilities.setAcceptInsecureCerts(true);
|
||||||
chromeCapabilities.set('goog:chromeOptions', {
|
chromeCapabilities.set('goog:chromeOptions', {
|
||||||
excludeSwitches: [ // disable info bar
|
excludeSwitches: [ // disable info bar
|
||||||
'enable-automation',
|
'enable-automation',
|
||||||
|
@ -71,7 +71,8 @@ module.exports = {
|
||||||
'profile.password_manager_enabled' : false
|
'profile.password_manager_enabled' : false
|
||||||
},
|
},
|
||||||
args: [
|
args: [
|
||||||
"--guest",
|
"--enable-automation",
|
||||||
|
"guest",
|
||||||
"disable-infobars",
|
"disable-infobars",
|
||||||
"--disable-notifications",
|
"--disable-notifications",
|
||||||
"--lang=en",
|
"--lang=en",
|
||||||
|
@ -87,7 +88,7 @@ module.exports = {
|
||||||
});
|
});
|
||||||
driver = builder
|
driver = builder
|
||||||
.forBrowser('chrome')
|
.forBrowser('chrome')
|
||||||
.setChromeOptions(options.excludeSwitches('enable-automation'))
|
//.setChromeOptions(options.excludeSwitches("disable-popup-blocking", "enable-automation"))
|
||||||
.withCapabilities(chromeCapabilities)
|
.withCapabilities(chromeCapabilities)
|
||||||
.build()
|
.build()
|
||||||
driver.manage().setTimeouts( { pageLoad: 35000 } )
|
driver.manage().setTimeouts( { pageLoad: 35000 } )
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const { By, Key, until, Builder } = require('selenium-webdriver')
|
const { By, Key, until, Builder } = require('selenium-webdriver')
|
||||||
require('chromedriver')
|
require('chromedriver')
|
||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const { buildDriver, goToHome, captureScreensFor, teardown, doWhile, log } = require('../utils')
|
const { buildDriver, goToHome, captureScreensFor, teardown, doWhile, log, delay } = require('../utils')
|
||||||
const { getManagementUrl, createVhost, deleteVhost } = require('../mgt-api')
|
const { getManagementUrl, createVhost, deleteVhost } = require('../mgt-api')
|
||||||
|
|
||||||
const LoginPage = require('../pageobjects/LoginPage')
|
const LoginPage = require('../pageobjects/LoginPage')
|
||||||
|
@ -51,15 +51,51 @@ describe('Virtual Hosts in Admin tab', function () {
|
||||||
await overview.clickOnOverviewTab()
|
await overview.clickOnOverviewTab()
|
||||||
await overview.clickOnAdminTab()
|
await overview.clickOnAdminTab()
|
||||||
await adminTab.clickOnVhosts()
|
await adminTab.clickOnVhosts()
|
||||||
|
await doWhile(async function() { return vhostsTab.getVhostsTable() },
|
||||||
|
function(table) { return table.length>1 })
|
||||||
|
|
||||||
await vhostsTab.clickOnSelectTableColumns()
|
await vhostsTab.clickOnSelectTableColumns()
|
||||||
let table = await vhostsTab.getSelectableTableColumns()
|
let table = await vhostsTab.getSelectableTableColumns()
|
||||||
log("Table: " + table)
|
|
||||||
await doWhile(async function() {
|
assert.equal(4, table.length)
|
||||||
return vhostsTab.getVhostsTable()
|
let overviewGroup = {
|
||||||
}, function(table) {
|
"name" : "Overview:",
|
||||||
return table.length > 0 && vhost.localeCompare(table[0][0])
|
"columns": [
|
||||||
})
|
{"name:":"Default queue type","id":"checkbox-vhosts-default-queue-type"},
|
||||||
|
{"name:":"Cluster state","id":"checkbox-vhosts-cluster-state"},
|
||||||
|
{"name:":"Description","id":"checkbox-vhosts-description"},
|
||||||
|
{"name:":"Tags","id":"checkbox-vhosts-tags"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
assert.equal(JSON.stringify(table[0]), JSON.stringify(overviewGroup))
|
||||||
|
let messagesGroup = {
|
||||||
|
"name" : "Messages:",
|
||||||
|
"columns": [
|
||||||
|
{"name:":"Ready","id":"checkbox-vhosts-msgs-ready"},
|
||||||
|
{"name:":"Unacknowledged","id":"checkbox-vhosts-msgs-unacked"},
|
||||||
|
{"name:":"Total","id":"checkbox-vhosts-msgs-total"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
assert.equal(JSON.stringify(table[1]), JSON.stringify(messagesGroup))
|
||||||
|
let networkGroup = {
|
||||||
|
"name" : "Network:",
|
||||||
|
"columns": [
|
||||||
|
{"name:":"From client","id":"checkbox-vhosts-from_client"},
|
||||||
|
{"name:":"To client","id":"checkbox-vhosts-to_client"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
assert.equal(JSON.stringify(table[2]), JSON.stringify(networkGroup))
|
||||||
|
let messageRatesGroup = {
|
||||||
|
"name" : "Message rates:",
|
||||||
|
"columns": [
|
||||||
|
{"name:":"publish","id":"checkbox-vhosts-rate-publish"},
|
||||||
|
{"name:":"deliver / get","id":"checkbox-vhosts-rate-deliver"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
assert.equal(JSON.stringify(table[3]), JSON.stringify(messageRatesGroup))
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('given there is a new virtualhost with a tag', async function() {
|
describe('given there is a new virtualhost with a tag', async function() {
|
||||||
let vhost = "test_" + Math.floor(Math.random() * 1000)
|
let vhost = "test_" + Math.floor(Math.random() * 1000)
|
||||||
before(async function() {
|
before(async function() {
|
||||||
|
@ -70,16 +106,19 @@ describe('Virtual Hosts in Admin tab', function () {
|
||||||
await adminTab.clickOnVhosts()
|
await adminTab.clickOnVhosts()
|
||||||
})
|
})
|
||||||
it('vhost is listed with tag', async function () {
|
it('vhost is listed with tag', async function () {
|
||||||
log("Searching for vhost")
|
log("Searching for vhost " + vhost)
|
||||||
await vhostsTab.searchForVhosts(vhost)
|
await doWhile(async function() { return vhostsTab.searchForVhosts(vhost) },
|
||||||
await vhostsTab.clickOnSelectTableColumns()
|
function(table) {
|
||||||
let table = vhostsTab.getSelectableTableColumns()
|
return table.length==1 && table[1][0].localeCompare(vhost)
|
||||||
log("Table: " + table)
|
|
||||||
await doWhile(async function() {
|
|
||||||
return vhostsTab.getVhostsTable()
|
|
||||||
}, function(table) {
|
|
||||||
return table.length > 0 && vhost.localeCompare(table[0][0])
|
|
||||||
})
|
})
|
||||||
|
log("Found vhost " + vhost)
|
||||||
|
await vhostsTab.selectTableColumnsById(["checkbox-vhosts-tags"])
|
||||||
|
|
||||||
|
await doWhile(async function() { return vhostsTab.getVhostsTable() },
|
||||||
|
function(table) {
|
||||||
|
return table.length==1 && table[1][3].localeCompare("selenium-tag")
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
after(async function () {
|
after(async function () {
|
||||||
log("Deleting vhost")
|
log("Deleting vhost")
|
||||||
|
@ -87,6 +126,7 @@ describe('Virtual Hosts in Admin tab', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
after(async function () {
|
after(async function () {
|
||||||
await teardown(driver, this, captureScreen)
|
await teardown(driver, this, captureScreen)
|
||||||
|
|
Loading…
Reference in New Issue