-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7151 from rabbitmq/mergify/bp/v3.11.x/pr-7144
- Loading branch information
Showing
8 changed files
with
195 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
# Name of the suite used to generate log and screen folders | ||
SUITE=$( basename "${BASH_SOURCE[0]}" .sh) | ||
|
||
# Path to the test cases this suite should run. It is relative to the selenium/test folder | ||
TEST_CASES_PATH=/limits | ||
# Path to the folder where all configuration file reside. It is relative to the selenim/test folder | ||
TEST_CONFIG_PATH=/basic-auth | ||
|
||
source $SCRIPT/suite_template | ||
|
||
_setup () { | ||
start_rabbitmq | ||
} | ||
_save_logs() { | ||
save_container_logs rabbitmq | ||
} | ||
_teardown() { | ||
kill_container_if_exist rabbitmq | ||
} | ||
run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.ONESHELL:# single shell invocation for all lines in the recipe | ||
SHELL = bash# we depend on bash expansion for e.g. queue patterns | ||
|
||
.DEFAULT_GOAL = help | ||
RABBITMQ_SERVER_ROOT = ../../../../../ | ||
|
||
|
||
### TARGETS ### | ||
|
||
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const { By, Key, until, Builder } = require('selenium-webdriver') | ||
require('chromedriver') | ||
const assert = require('assert') | ||
const { buildDriver, goToHome, captureScreensFor, teardown, delay } = require('../utils') | ||
|
||
const LoginPage = require('../pageobjects/LoginPage') | ||
const OverviewPage = require('../pageobjects/OverviewPage') | ||
const AdminTab = require('../pageobjects/AdminTab') | ||
const LimitsAdminTab = require('../pageobjects/LimitsAdminTab') | ||
|
||
describe('user_limits', function () { | ||
let login | ||
let overview | ||
let captureScreen | ||
|
||
before(async function () { | ||
driver = buildDriver() | ||
await goToHome(driver) | ||
login = new LoginPage(driver) | ||
overview = new OverviewPage(driver) | ||
adminTab = new AdminTab(driver) | ||
limitsSection = new LimitsAdminTab(driver) | ||
captureScreen = captureScreensFor(driver, __filename) | ||
|
||
await login.login('guest', 'guest') | ||
if (!await overview.isLoaded()) { | ||
throw new Error('Failed to login') | ||
} | ||
|
||
}) | ||
|
||
it('when there are no limits', async function () { | ||
await overview.clickOnAdminTab() | ||
await adminTab.clickOnLimits() | ||
assert.equal(0, (await limitsSection.list_user_limits()).length) | ||
}) | ||
|
||
|
||
after(async function () { | ||
await teardown(driver, this, captureScreen) | ||
}) | ||
}) |
43 changes: 43 additions & 0 deletions
43
deps/rabbitmq_management/selenium/test/limits/virtual-hosts.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const { By, Key, until, Builder } = require('selenium-webdriver') | ||
require('chromedriver') | ||
const assert = require('assert') | ||
const { buildDriver, goToHome, captureScreensFor, teardown, delay } = require('../utils') | ||
|
||
const LoginPage = require('../pageobjects/LoginPage') | ||
const OverviewPage = require('../pageobjects/OverviewPage') | ||
const AdminTab = require('../pageobjects/AdminTab') | ||
const LimitsAdminTab = require('../pageobjects/LimitsAdminTab') | ||
|
||
describe('virtual_host_limits', function () { | ||
let login | ||
let overview | ||
let captureScreen | ||
|
||
before(async function () { | ||
driver = buildDriver() | ||
await goToHome(driver) | ||
login = new LoginPage(driver) | ||
overview = new OverviewPage(driver) | ||
adminTab = new AdminTab(driver) | ||
limitsSection = new LimitsAdminTab(driver) | ||
captureScreen = captureScreensFor(driver, __filename) | ||
|
||
await login.login('guest', 'guest') | ||
if (!await overview.isLoaded()) { | ||
throw new Error('Failed to login') | ||
} | ||
|
||
}) | ||
|
||
it('when there are no limits', async function () { | ||
await overview.clickOnAdminTab() | ||
await adminTab.clickOnLimits() | ||
assert.equal(0, (await limitsSection.list_virtual_host_limits()).length) | ||
|
||
}) | ||
|
||
|
||
after(async function () { | ||
await teardown(driver, this, captureScreen) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
deps/rabbitmq_management/selenium/test/pageobjects/LimitsAdminTab.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const { By, Key, until, Builder } = require('selenium-webdriver') | ||
|
||
const AdminTab = require('./AdminTab') | ||
|
||
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([]) | ||
} | ||
} | ||
|
||
} |