summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/testcases/common.py5
-rw-r--r--tests/testcases/test.py62
-rw-r--r--tests/testcases/wizard.py16
3 files changed, 52 insertions, 31 deletions
diff --git a/tests/testcases/common.py b/tests/testcases/common.py
index 6b3b2571..7895c205 100644
--- a/tests/testcases/common.py
+++ b/tests/testcases/common.py
@@ -56,14 +56,14 @@ def _goto_element(e):
# waits for an element to load
# allows you to also specify if you want a screenshot after it comes in
-def _wait_for_id(id=id,dur=30, save_screenshot=False, save_screenshot_file=None):
+def _wait_for_id(id=id,dur=15, save_screenshot=False, save_screenshot_file=None):
log ('Waiting for '+id+'...')
WebDriverWait(driver, dur).until(EC.presence_of_element_located((By.ID, id)))
if save_screenshot:
take_screenshot(id,save_screenshot_file)
-def get_element_attributes(id=id, wait_dur=30, save_screenshot=False, save_screenshot_file=None):
+def get_element_attributes(id=id, save_screenshot=False, save_screenshot_file=None):
_wait_for_id(id=id, save_screenshot=save_screenshot, save_screenshot_file = save_screenshot_file)
element = driver.find_element_by_id(id)
return element
@@ -108,6 +108,7 @@ def input_item(id=id,txt="you forgot to specify text", save_screenshot=False, sa
_wait_for_id(id=id, save_screenshot=save_screenshot, save_screenshot_file = save_screenshot_file)
element = driver.find_element_by_id(id)
_goto_element(element)
+ element.clear()
element.send_keys(txt)
driver.hide_keyboard()
#sleep(wait)
diff --git a/tests/testcases/test.py b/tests/testcases/test.py
index 0cc7e826..e2d095d9 100644
--- a/tests/testcases/test.py
+++ b/tests/testcases/test.py
@@ -9,6 +9,7 @@ from appium import webdriver
import os
import glob
+
import common as c
import wizard
import app
@@ -46,39 +47,50 @@ class ZmninjaAndroidTests(unittest.TestCase):
def wait_for_app_start(self):
c.log ('Waiting for app to start')
- #sleep (5)
+
def test_app(self):
- c.testConfig['portal'] = 'https://demo.zoneminder.com/zm'
- c.testConfig['user'] = 'zmuser'
- c.testConfig['password'] = 'zmpass'
- c.testConfig['portal'] = 'https://192.168.1.134/zm'
- c.testConfig['user'] = 'admin'
- c.testConfig['password'] = 'admin'
+ configs = [];
- c.testConfig['use_auth'] = True
- c.testConfig['use_zm_auth'] = True
- c.testConfig['use_basic_auth'] = False
+ # Add as many as you need
+ configs.append ({
+ 'portal': 'https://demo.zoneminder.com/zm',
+ 'user': 'zmuser',
+ 'password': 'zmpass',
+ 'use_auth': True,
+ 'use_zm_auth': True,
+ 'use_basic_auth': False,
+ 'basic_user': None,
+ 'basic_password': None,
+ 'screenshot_dir': './screenshots'
+ })
- run_dir = strftime('%b-%d-%I_%M_%S%p', localtime())
- c.testConfig['screenshot_dir'] = './screenshots/'+run_dir
- try:
- os.makedirs(c.testConfig['screenshot_dir'])
- except OSError as exc:
- if exc.errno == errno.EEXIST and os.path.isdir(path):
- pass
- else:
- raise
+
+ self.wait_for_app_start()
+ isFirstRun = True
+ for config in configs:
+ c.log ('\n\n***** Test Run for: {} *****\n\n'.format(config['portal']))
+ c.testConfig = config
+ run_dir = strftime('%b-%d-%I_%M_%S%p', localtime())
+ c.testConfig['screenshot_dir'] = './screenshots/'+run_dir
+ try:
+ os.makedirs(c.testConfig['screenshot_dir'])
+ except OSError as exc:
+ if exc.errno == errno.EEXIST and os.path.isdir(path):
+ pass
+ else:
+ raise
- #files = glob.glob(c.testConfig['screenshot_dir']+'/*')
- #for f in files:
- # os.remove(f)
- self.wait_for_app_start()
- wizard.run_tests(self)
- montage.run_tests(self)
+ #files = glob.glob(c.testConfig['screenshot_dir']+'/*')
+ #for f in files:
+ # os.remove(f)
+
+ wizard.run_tests(self, isFirstRun)
+ isFirstRun = False
+ montage.run_tests(self)
diff --git a/tests/testcases/wizard.py b/tests/testcases/wizard.py
index cf73deab..0bcbe4a0 100644
--- a/tests/testcases/wizard.py
+++ b/tests/testcases/wizard.py
@@ -6,13 +6,20 @@ import common as c
import app
from time import sleep
-def run_tests(self):
+def run_tests(self, isFirstRun = False):
success_color = 'rgba(22, 160, 133, 1)'
fail_color = 'rgba(231, 76, 60, 1)'
c.log ('Validating wizard test case')
- c.click_item('testaut_wizard_button')
+
+ if isFirstRun:
+ c.log ('First run, assuming first use screen')
+ c.click_item('testaut_wizard_button')
+ else:
+ c.log ('Launching wizard via menu')
+ app.tap_menu_js()
+ c.click_item('testaut_menu_wizard')
c.log ('Entering portal text')
c.input_item('testaut_portal_input', c.testConfig['portal'])
@@ -29,8 +36,9 @@ def run_tests(self):
c.input_item('testaut_zmauthpassword_input', c.testConfig['password'])
if c.testConfig['use_basic_auth']:
c.tap_toggle('testaut_usebasicauth_toggle')
- c.input_item('testaut_basicauthusername_input', c.testConfig['user'])
- c.input_item('testaut_basicauthpassword_input', c.testConfig['password'])
+ c.input_item('testaut_basicauthusername_input', c.testConfig['basic_user'])
+ c.input_item('testaut_basicauthpassword_input', c.testConfig['basic_password'])
+ #sleep(10)
c.click_item('testaut_wiz2_next_button')
# Now check wizard results