diff options
| author | = <=> | 2019-03-11 11:05:06 -0400 |
|---|---|---|
| committer | = <=> | 2019-03-11 11:05:06 -0400 |
| commit | 5973dc639ce9d1dfda927562683d6a3d09760653 (patch) | |
| tree | 745ebe992c45a8e6ac01c9b041f732805dbb92a9 | |
| parent | a952d593a5ef5041b774dcfd4f36a2b3fdcf7005 (diff) | |
#791 multiple profile/runs
| -rw-r--r-- | config.xml | 6 | ||||
| -rw-r--r-- | package.json | 4 | ||||
| -rw-r--r-- | tests/testcases/common.py | 5 | ||||
| -rw-r--r-- | tests/testcases/test.py | 62 | ||||
| -rw-r--r-- | tests/testcases/wizard.py | 16 | ||||
| -rw-r--r-- | www/templates/menu.html | 2 | ||||
| -rw-r--r-- | www/templates/wizard.html | 2 |
7 files changed, 59 insertions, 38 deletions
@@ -173,10 +173,10 @@ </plugin> <plugin name="cordova-custom-config" spec="5.0.2" /> <plugin name="cordova-plugin-advanced-http" spec="https://github.com/silkimen/cordova-plugin-advanced-http.git" /> - <plugin name="cordova-plugin-ionic-webview" spec="https://github.com/pliablepixels/cordova-plugin-ionic-webview.git"> - <variable name="ANDROID_SUPPORT_ANNOTATIONS_VERSION" value="27.+" /> - </plugin> <plugin name="cordova-plugin-media-pp-fork" spec="^1.0.2-dev" /> <engine name="android" spec="7.1.4" /> <engine name="ios" spec="5.0.0" /> + <plugin name="cordova-plugin-ionic-webview" spec="https://github.com/pliablepixels/cordova-plugin-ionic-webview.git"> + <variable name="ANDROID_SUPPORT_ANNOTATIONS_VERSION" value="27.+" /> + </plugin> </widget> diff --git a/package.json b/package.json index d98e6314..f0ac4afe 100644 --- a/package.json +++ b/package.json @@ -57,10 +57,10 @@ "FCM_VERSION": "11.6.2" }, "cordova-custom-config": {}, + "cordova-plugin-media-pp-fork": {}, "cordova-plugin-ionic-webview": { "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+" - }, - "cordova-plugin-media-pp-fork": {} + } } }, "dependencies": { 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 diff --git a/www/templates/menu.html b/www/templates/menu.html index 26201765..0d91205f 100644 --- a/www/templates/menu.html +++ b/www/templates/menu.html @@ -118,7 +118,7 @@ <!--<ion-item nav-clear menu-close ng-click="navigateView('app.wizard')" >--> <ion-item id="menu-move-11" nav-clear href="#/app/wizard" ng-click="go('/app/wizard')"> - <span class=" item-icon-left"> + <span id="testaut_menu_wizard" class=" item-icon-left"> <i class="icon ion-wand"></i> </span> {{'kMenuWizard'|translate}} </ion-item> diff --git a/www/templates/wizard.html b/www/templates/wizard.html index de1e6e67..c929f877 100644 --- a/www/templates/wizard.html +++ b/www/templates/wizard.html @@ -60,7 +60,7 @@ <label class="item item-input item-text-wrap item-floating-label" ng-show="wizard.usebasicauth"> <span class="input-label">{{'kPassword' | translate}}</span> - <input id="testaut_basicauth_password_input" type="password" ng-model="wizard.basicpassword" placeholder="{{'kPlaceHolderBasicAuthPass'|translate}}"> + <input id="testaut_basicauthpassword_input" type="password" ng-model="wizard.basicpassword" placeholder="{{'kPlaceHolderBasicAuthPass'|translate}}"> <p>{{'kWizPasswdNote' | translate}}</p> </label> <a class="button icon-left ion-information-circled button-clear button-dark" ng-click="toggleTip()">{{wizard.tiptext}}</a> |
