Merge pull request #9835 from rabbitmq/fix-run-selenium-suites
Selenium: fix an issue in run-scripts
This commit is contained in:
commit
b39dfe837b
|
@ -13,7 +13,7 @@
|
|||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"chromedriver": "^115.0.0",
|
||||
"chromedriver": "^118.0.0",
|
||||
"ejs": "^3.1.8",
|
||||
"express": "^4.18.2",
|
||||
"geckodriver": "^3.0.2",
|
||||
|
|
|
@ -11,9 +11,11 @@ NC='\033[0m'
|
|||
SUCCESSFUL_SUITES=()
|
||||
FAILED_SUITES=()
|
||||
|
||||
cat $SCRIPT/$SUITE_FILE | sort | while read SUITE
|
||||
TOTAL_SUITES=`wc -l $SCRIPT/$SUITE_FILE | awk '{print $1}'`
|
||||
|
||||
while read SUITE
|
||||
do
|
||||
echo "=== Running suite $SUITE ============================================"
|
||||
echo -e "=== Running suite (${TOTAL_SUITES}/${GREEN}${#SUCCESSFUL_SUITES[@]}/${RED}${#FAILED_SUITES[@]}${NC}) $SUITE ============================================"
|
||||
echo " "
|
||||
ENV_MODES="docker" $SCRIPT/suites/$SUITE
|
||||
TEST_RESULT="$?"
|
||||
|
@ -28,9 +30,9 @@ do
|
|||
fi
|
||||
echo -e "=== $TEST_STATUS $SUITE ==========================================="
|
||||
echo " "
|
||||
done
|
||||
done <<< "$(cat $SCRIPT/$SUITE_FILE | sort)"
|
||||
|
||||
echo "=== Summary ============================================"
|
||||
echo -e "=== Summary (${TOTAL_SUITES}/${GREEN}${#SUCCESSFUL_SUITES[@]}/${RED}${#FAILED_SUITES[@]}${NC}) ============================================"
|
||||
if [ ${#SUCCESSFUL_SUITES[@]} -gt 0 ]; then echo -e " > ${GREEN}Successful suites ${NC}"; fi
|
||||
for f in ${SUCCESSFUL_SUITES[@]}
|
||||
do
|
||||
|
@ -43,4 +45,5 @@ do
|
|||
echo " - $f"
|
||||
done
|
||||
|
||||
echo "Terminating with $OVERALL_TEST_RESULT"
|
||||
exit $OVERALL_TEST_RESULT
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const { By, Key, until, Builder } = require('selenium-webdriver')
|
||||
require('chromedriver')
|
||||
const assert = require('assert')
|
||||
const { buildDriver, goToHome, captureScreensFor, teardown } = require('../../utils')
|
||||
const { buildDriver, goToHome, captureScreensFor, teardown, log } = require('../../utils')
|
||||
|
||||
const SSOHomePage = require('../../pageobjects/SSOHomePage')
|
||||
const UAALoginPage = require('../../pageobjects/UAALoginPage')
|
||||
|
@ -27,6 +27,7 @@ describe('When a logged in user', function () {
|
|||
await overview.isLoaded()
|
||||
await overview.logout()
|
||||
await homePage.isLoaded()
|
||||
|
||||
})
|
||||
|
||||
after(async function () {
|
||||
|
|
|
@ -22,7 +22,7 @@ module.exports = class BasePage {
|
|||
this.driver = webdriver
|
||||
// this is another timeout (--timeout 10000) which is the maximum test execution time
|
||||
this.timeout = parseInt(process.env.TIMEOUT) || 5000 // max time waiting to locate an element. Should be less that test timeout
|
||||
this.polling = parseInt(process.env.POLLING) || 1000 // how frequent selenium searches for an element
|
||||
this.polling = parseInt(process.env.POLLING) || 500 // how frequent selenium searches for an element
|
||||
}
|
||||
|
||||
async isLoaded () {
|
||||
|
@ -181,6 +181,9 @@ module.exports = class BasePage {
|
|||
await this.driver.sleep(250)
|
||||
return alert.accept();
|
||||
}
|
||||
log(message) {
|
||||
console.log(new Date() + " " + message)
|
||||
}
|
||||
|
||||
capture () {
|
||||
this.driver.takeScreenshot().then(
|
||||
|
|
|
@ -12,7 +12,7 @@ module.exports = class SSOHomePage extends BasePage {
|
|||
|
||||
async clickToLogin () {
|
||||
await this.isLoaded()
|
||||
if (!await this.isWarningVisible()) {
|
||||
if (await this.waitForDisplayed(LOGIN_BUTTON)) {
|
||||
return this.click(LOGIN_BUTTON)
|
||||
} else {
|
||||
this.capture()
|
||||
|
@ -27,7 +27,7 @@ module.exports = class SSOHomePage extends BasePage {
|
|||
|
||||
async isWarningVisible () {
|
||||
try {
|
||||
await this.getText(WARNING)
|
||||
await this.waitForDisplayed(WARNING)
|
||||
return Promise.resolve(true)
|
||||
} catch (e) {
|
||||
return Promise.resolve(false)
|
||||
|
|
|
@ -32,6 +32,10 @@ class CaptureScreenshot {
|
|||
}
|
||||
|
||||
module.exports = {
|
||||
log: (message) => {
|
||||
console.log(new Date() + " " + message)
|
||||
},
|
||||
|
||||
buildDriver: (caps) => {
|
||||
builder = new Builder()
|
||||
if (!runLocal) {
|
||||
|
|
Loading…
Reference in New Issue