Skip to content

Commit b39dfe8

Browse files
Merge pull request #9835 from rabbitmq/fix-run-selenium-suites
Selenium: fix an issue in run-scripts
2 parents 9b6cb03 + 7c58649 commit b39dfe8

File tree

6 files changed

+21
-10
lines changed

6 files changed

+21
-10
lines changed

deps/rabbitmq_management/selenium/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
"author": "",
1414
"license": "ISC",
1515
"dependencies": {
16-
"chromedriver": "^115.0.0",
16+
"chromedriver": "^118.0.0",
1717
"ejs": "^3.1.8",
18-
"express": "^4.18.2",
18+
"express": "^4.18.2",
1919
"geckodriver": "^3.0.2",
2020
"http-proxy": "^1.18.1",
2121
"path": "^0.12.7",

deps/rabbitmq_management/selenium/run-suites.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ NC='\033[0m'
1111
SUCCESSFUL_SUITES=()
1212
FAILED_SUITES=()
1313

14-
cat $SCRIPT/$SUITE_FILE | sort | while read SUITE
14+
TOTAL_SUITES=`wc -l $SCRIPT/$SUITE_FILE | awk '{print $1}'`
15+
16+
while read SUITE
1517
do
16-
echo "=== Running suite $SUITE ============================================"
18+
echo -e "=== Running suite (${TOTAL_SUITES}/${GREEN}${#SUCCESSFUL_SUITES[@]}/${RED}${#FAILED_SUITES[@]}${NC}) $SUITE ============================================"
1719
echo " "
1820
ENV_MODES="docker" $SCRIPT/suites/$SUITE
1921
TEST_RESULT="$?"
@@ -28,9 +30,9 @@ do
2830
fi
2931
echo -e "=== $TEST_STATUS $SUITE ==========================================="
3032
echo " "
31-
done
33+
done <<< "$(cat $SCRIPT/$SUITE_FILE | sort)"
3234

33-
echo "=== Summary ============================================"
35+
echo -e "=== Summary (${TOTAL_SUITES}/${GREEN}${#SUCCESSFUL_SUITES[@]}/${RED}${#FAILED_SUITES[@]}${NC}) ============================================"
3436
if [ ${#SUCCESSFUL_SUITES[@]} -gt 0 ]; then echo -e " > ${GREEN}Successful suites ${NC}"; fi
3537
for f in ${SUCCESSFUL_SUITES[@]}
3638
do
@@ -43,4 +45,5 @@ do
4345
echo " - $f"
4446
done
4547

48+
echo "Terminating with $OVERALL_TEST_RESULT"
4649
exit $OVERALL_TEST_RESULT

deps/rabbitmq_management/selenium/test/oauth/with-sp-initiated/logout.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { By, Key, until, Builder } = require('selenium-webdriver')
22
require('chromedriver')
33
const assert = require('assert')
4-
const { buildDriver, goToHome, captureScreensFor, teardown } = require('../../utils')
4+
const { buildDriver, goToHome, captureScreensFor, teardown, log } = require('../../utils')
55

66
const SSOHomePage = require('../../pageobjects/SSOHomePage')
77
const UAALoginPage = require('../../pageobjects/UAALoginPage')
@@ -27,6 +27,7 @@ describe('When a logged in user', function () {
2727
await overview.isLoaded()
2828
await overview.logout()
2929
await homePage.isLoaded()
30+
3031
})
3132

3233
after(async function () {

deps/rabbitmq_management/selenium/test/pageobjects/BasePage.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = class BasePage {
2222
this.driver = webdriver
2323
// this is another timeout (--timeout 10000) which is the maximum test execution time
2424
this.timeout = parseInt(process.env.TIMEOUT) || 5000 // max time waiting to locate an element. Should be less that test timeout
25-
this.polling = parseInt(process.env.POLLING) || 1000 // how frequent selenium searches for an element
25+
this.polling = parseInt(process.env.POLLING) || 500 // how frequent selenium searches for an element
2626
}
2727

2828
async isLoaded () {
@@ -181,6 +181,9 @@ module.exports = class BasePage {
181181
await this.driver.sleep(250)
182182
return alert.accept();
183183
}
184+
log(message) {
185+
console.log(new Date() + " " + message)
186+
}
184187

185188
capture () {
186189
this.driver.takeScreenshot().then(

deps/rabbitmq_management/selenium/test/pageobjects/SSOHomePage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = class SSOHomePage extends BasePage {
1212

1313
async clickToLogin () {
1414
await this.isLoaded()
15-
if (!await this.isWarningVisible()) {
15+
if (await this.waitForDisplayed(LOGIN_BUTTON)) {
1616
return this.click(LOGIN_BUTTON)
1717
} else {
1818
this.capture()
@@ -27,7 +27,7 @@ module.exports = class SSOHomePage extends BasePage {
2727

2828
async isWarningVisible () {
2929
try {
30-
await this.getText(WARNING)
30+
await this.waitForDisplayed(WARNING)
3131
return Promise.resolve(true)
3232
} catch (e) {
3333
return Promise.resolve(false)

deps/rabbitmq_management/selenium/test/utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ class CaptureScreenshot {
3232
}
3333

3434
module.exports = {
35+
log: (message) => {
36+
console.log(new Date() + " " + message)
37+
},
38+
3539
buildDriver: (caps) => {
3640
builder = new Builder()
3741
if (!runLocal) {

0 commit comments

Comments
 (0)