2022-11-08 16:41:47 +08:00
|
|
|
const { By, Key, until, Builder } = require('selenium-webdriver')
|
2022-07-06 22:28:53 +08:00
|
|
|
|
2022-11-08 16:41:47 +08:00
|
|
|
const BasePage = require('./BasePage')
|
2022-07-06 22:28:53 +08:00
|
|
|
|
2022-11-08 16:41:47 +08:00
|
|
|
const MENU_TABS = By.css('div#menu ul#tabs')
|
2022-07-06 22:28:53 +08:00
|
|
|
const USER = By.css('li#logout')
|
|
|
|
const LOGOUT_FORM = By.css('li#logout form')
|
|
|
|
|
2022-11-08 16:41:47 +08:00
|
|
|
const CONNECTION_TAB = By.css('div#menu ul#tabs li a[href="#/connections"]')
|
|
|
|
const CHANNELS_TAB = By.css('div#menu ul#tabs li a[href="#/channels"]')
|
|
|
|
const QUEUES_TAB = By.css('div#menu ul#tabs li a[href="#/queues"]')
|
|
|
|
const ADMIN_TAB = By.css('div#menu ul#tabs li a[href="#/users"]')
|
2022-07-07 00:23:33 +08:00
|
|
|
|
2022-12-16 03:09:17 +08:00
|
|
|
const UPLOAD_DEFINITIONS_SECTION = By.css('div#upload-definitions')
|
|
|
|
const CHOOSE_BROKER_UPLOAD_FILE = By.css('input[name="file"]')
|
|
|
|
const UPLOAD_BROKER_FILE = By.css('input[type=submit][name="upload-definitions"]')
|
|
|
|
const POP_UP = By.css('div.form-popup-info')
|
|
|
|
|
|
|
|
const DOWNLOAD_DEFINITIONS_SECTION = By.css('div#download-definitions')
|
|
|
|
const CHOOSE_BROKER_DOWNLOAD_FILE = By.css('input#download-filename')
|
|
|
|
const DOWNLOAD_BROKER_FILE = By.css('button#upload-definitions')
|
|
|
|
|
2022-07-06 22:28:53 +08:00
|
|
|
module.exports = class OverviewPage extends BasePage {
|
|
|
|
async isLoaded () {
|
2022-07-06 23:38:45 +08:00
|
|
|
return await this.waitForDisplayed(MENU_TABS)
|
2022-07-06 22:28:53 +08:00
|
|
|
}
|
2022-11-08 16:41:47 +08:00
|
|
|
|
|
|
|
async logout () {
|
|
|
|
await this.submit(LOGOUT_FORM)
|
2022-07-06 22:28:53 +08:00
|
|
|
}
|
2022-11-08 16:41:47 +08:00
|
|
|
|
|
|
|
async getUser () {
|
2022-07-06 22:28:53 +08:00
|
|
|
return this.getText(USER)
|
|
|
|
}
|
2022-11-08 16:41:47 +08:00
|
|
|
|
|
|
|
async clickOnConnectionsTab () {
|
2022-07-07 00:23:33 +08:00
|
|
|
return this.click(CONNECTION_TAB)
|
|
|
|
}
|
2022-11-08 16:41:47 +08:00
|
|
|
|
|
|
|
async clickOnAdminTab () {
|
2022-07-07 00:23:33 +08:00
|
|
|
return this.click(ADMIN_TAB)
|
|
|
|
}
|
2022-11-08 16:41:47 +08:00
|
|
|
|
|
|
|
async clickOnChannelsTab () {
|
2022-07-07 00:23:33 +08:00
|
|
|
return this.click(CHANNELS_TAB)
|
|
|
|
}
|
2022-11-08 16:41:47 +08:00
|
|
|
|
|
|
|
async clickOnQueuesTab () {
|
2022-07-07 00:23:33 +08:00
|
|
|
return this.click(QUEUES_TAB)
|
|
|
|
}
|
2022-12-16 03:09:17 +08:00
|
|
|
|
|
|
|
async uploadBrokerDefinitions(file) {
|
|
|
|
await this.click(UPLOAD_DEFINITIONS_SECTION)
|
|
|
|
await this.chooseFile(CHOOSE_BROKER_UPLOAD_FILE, file)
|
|
|
|
await this.driver.sleep(1000)
|
|
|
|
await this.click(UPLOAD_BROKER_FILE)
|
|
|
|
await this.acceptAlert()
|
|
|
|
let popup = await this.waitForDisplayed(POP_UP)
|
|
|
|
await this.click(POP_UP)
|
|
|
|
return popup.getText()
|
|
|
|
}
|
|
|
|
async downloadBrokerDefinitions(filename) {
|
|
|
|
await 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);
|
|
|
|
}
|
2022-07-06 22:28:53 +08:00
|
|
|
}
|