Skip to content

Commit

Permalink
webui: travis selenium
Browse files Browse the repository at this point in the history
  • Loading branch information
joergsteffens committed Nov 28, 2018
1 parent 3d7fe49 commit 31f6b01
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
34 changes: 18 additions & 16 deletions .travis/all
Expand Up @@ -25,14 +25,14 @@ set -v

BACKUP_TEST_FILE=/usr/sbin/bareos.test

echo -e "status dir" | bconsole
echo
echo "---- label a volume ----"
echo -e "label volume=testvol pool=Full" | bconsole
echo
echo "----- create some file to test backup / restore ----"
echo "bareos restore test" > ${BACKUP_TEST_FILE}
echo
echo -e "status dir" | bconsole
echo
#echo "---- label a volume ----"
#echo -e "label volume=testvol pool=Full" | bconsole
#echo
echo "------ trigger backup job -----"
echo -e "run job=backup-bareos-fd yes\rwait" | bconsole | grep "Job queued. JobId="
echo "status dir" | bconsole
Expand All @@ -42,15 +42,17 @@ echo -e "restore select current\r2\rls\rmark usr\rdone\ryes\rwait" | bconsole
echo "status dir" | bconsole
grep "bareos restore test" /tmp/bareos-restores/${BACKUP_TEST_FILE}

if [ "${BUILD_WEBUI}" ]
then
service apache2 restart
service apache2 status
export BAREOS_BROWSER="none"
export BAREOS_USERNAME="citest"
export BAREOS_PASSWORD="citestpass"
export BAREOS_CLIENT_NAME=$HOSTNAME-fd
echo "--------- testing webui over selenium -----------"
echo "configure add console name=citest password=citestpass profile=webui-admin" | bconsole
python ${TRAVIS_BUILD_DIR}/webui/tests/selenium/webui-selenium-test.py -v
if [ "${BUILD_WEBUI}" ]; then
# show environment
export | grep " TRAVIS"

service apache2 restart
#service apache2 status
export BAREOS_BROWSER="none"
export BAREOS_USERNAME="citest"
export BAREOS_PASSWORD="citestpass"
export BAREOS_CLIENT_NAME="$HOSTNAME-fd"
echo "--------- testing webui over selenium -----------"
echo "configure add console name=citest password=citestpass profile=webui-admin" | bconsole
python ${TRAVIS_BUILD_DIR}/webui/tests/selenium/webui-selenium-test.py -v
fi
13 changes: 5 additions & 8 deletions webui/tests/selenium/webui-selenium-test.py
Expand Up @@ -108,16 +108,17 @@ class SeleniumTest(unittest.TestCase):

def __setUpTravis(self):
self.desired_capabilities = {}
self.desired_capabilities['name'] = (self.id().split('.'))[2]+": Travis Build Nr. %s" % os.environ['TRAVIS_BUILD_NUMBER']
jobnumber = os.environ['TRAVIS_JOB_NUMBER']
if jobnumber:
self.desired_capabilities['tunnel-identifier'] = jobnumber
buildnumber = os.environ['TRAVIS_BUILD_NUMBER']
if buildnumber:
self.desired_capabilities['build'] = buildnumber
self.desired_capabilities['name'] = "Travis Build Nr. {}: {}".format(buildnumber, self.id())
self.desired_capabilities['platform'] = "macOS 10.13"
self.desired_capabilities['browserName'] = "chrome"
self.desired_capabilities['version'] = "latest"
self.desired_capabilities['extendedDebugging'] = True
sauce_url = "http://%s:%s@localhost:4445/wd/hub"
self.driver = webdriver.Remote(
desired_capabilities=self.desired_capabilities,
Expand Down Expand Up @@ -437,19 +438,15 @@ def close_alert_and_get_its_text(self, accept=True):

def tearDown(self):
if self.travis:
print("Link to job : https://saucelabs.com/jobs/%s" % self.driver.session_id)
print("Link to test {}: https://app.saucelabs.com/jobs/%s".format(self.id(), self.driver.session_id))
sauce_client = SauceClient(self.sauce_username, self.access_key)
try:
if sys.exc_info() == (None, None, None):
sauce_client.jobs.update_job(self.driver.session_id, passed=True)
else:
sauce_client.jobs.update_job(self.driver.session_id, passed=False)
finally:
self.driver.quit()
self.assertEqual([], self.verificationErrors)
else:
self.driver.quit()
self.assertEqual([], self.verificationErrors)
self.driver.quit()
self.assertEqual([], self.verificationErrors)



Expand Down

0 comments on commit 31f6b01

Please sign in to comment.