Skip to content

Commit

Permalink
Test when there are zero limits
Browse files Browse the repository at this point in the history
(cherry picked from commit 166faa3)
  • Loading branch information
MarcialRosales authored and mergify[bot] committed Feb 2, 2023
1 parent 961dd40 commit de3e8cc
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
6 changes: 6 additions & 0 deletions deps/rabbitmq_management/selenium/test/definitions/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@ RABBITMQ_SERVER_ROOT = ../../../../../
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

start-rabbitmq: ## Start RabbitMQ
@(docker kill rabbitmq >/dev/null 2>&1 && docker rm rabbitmq)
@(gmake --directory=${RABBITMQ_SERVER_ROOT} run-broker \
RABBITMQ_ENABLED_PLUGINS="rabbitmq_management" \
RABBITMQ_CONFIG_FILE=deps/rabbitmq_management/selenium/test/basic-auth/rabbitmq.config)

test: ## Run tests interactively e.g. make test [TEST=landing.js]
@(RABBITMQ_URL=http://localhost:15672 RUN_LOCAL=true SCREENSHOTS_DIR=${PWD}/../../screens npm test $(PWD)/$(TEST))
6 changes: 6 additions & 0 deletions deps/rabbitmq_management/selenium/test/limits/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@ RABBITMQ_SERVER_ROOT = ../../../../../
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

start-rabbitmq: ## Start RabbitMQ
@(docker kill rabbitmq >/dev/null 2>&1 && docker rm rabbitmq)
@(gmake --directory=${RABBITMQ_SERVER_ROOT} run-broker \
RABBITMQ_ENABLED_PLUGINS="rabbitmq_management" \
RABBITMQ_CONFIG_FILE=deps/rabbitmq_management/selenium/test/basic-auth/rabbitmq.config)

test: ## Run tests interactively e.g. make test [TEST=landing.js]
@(RABBITMQ_URL=http://localhost:15672 RUN_LOCAL=true SCREENSHOTS_DIR=${PWD}/../../screens npm test $(PWD)/$(TEST))
6 changes: 2 additions & 4 deletions deps/rabbitmq_management/selenium/test/limits/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const OverviewPage = require('../pageobjects/OverviewPage')
const AdminTab = require('../pageobjects/AdminTab')
const LimitsAdminTab = require('../pageobjects/LimitsAdminTab')

describe('List all user_limits', function () {
describe('user_limits', function () {
let login
let overview
let captureScreen
Expand All @@ -32,9 +32,7 @@ describe('List all user_limits', function () {
it('when there are no limits', async function () {
await overview.clickOnAdminTab()
await adminTab.clickOnLimits()

await limitsSection.list_user_limits()

assert.equal(0, (await limitsSection.list_user_limits()).length)
})


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const OverviewPage = require('../pageobjects/OverviewPage')
const AdminTab = require('../pageobjects/AdminTab')
const LimitsAdminTab = require('../pageobjects/LimitsAdminTab')

describe('List all virtual_host_limits', function () {
describe('virtual_host_limits', function () {
let login
let overview
let captureScreen
Expand All @@ -32,9 +32,8 @@ describe('List all virtual_host_limits', function () {
it('when there are no limits', async function () {
await overview.clickOnAdminTab()
await adminTab.clickOnLimits()
assert.equal(0, (await limitsSection.list_virtual_host_limits()).length)

await limitsSection.list_virtual_host_limits()

})


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,33 @@ const SELECTED_LIMITS_ON_RHM = By.css('div#rhs ul li a[href="#/limits"]')
const VIRTUAL_HOST_LIMITS_SECTION = By.css('div#main div#virtual-host-limits')
const USER_LIMITS_SECTION = By.css('div#main div#user-limits')

const VIRTUAL_HOST_LIMITS_TABLE_ROWS = By.css('div#main div#virtual-host-limits table.list tbody tr')
const USER_LIMITS_TABLE_ROWS = By.css('div#main div#user-limits table.list tbody tr')

module.exports = class LimitsAdminTab extends AdminTab {
async isLoaded () {
await this.waitForDisplayed(SELECTED_LIMITS_ON_RHM)
}

async list_virtual_host_limits() {
await this.click(VIRTUAL_HOST_LIMITS_SECTION)
try
{
rows = driver.findElements(VIRTUAL_HOST_LIMITS_TABLE_ROWS)
return rows
} catch (NoSuchElement) {
return Promise.resolve([])
}
}
async list_user_limits() {
await this.click(USER_LIMITS_SECTION)
try
{
rows = driver.findElements(VIRTUAL_HOST_LIMITS_TABLE_ROWS)
return rows
} catch (NoSuchElement) {
return Promise.resolve([])
}
}

}

0 comments on commit de3e8cc

Please sign in to comment.