diff options
Diffstat (limited to 'squishtests/suite_neptune3/shared/steps/essential.py')
-rw-r--r-- | squishtests/suite_neptune3/shared/steps/essential.py | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/squishtests/suite_neptune3/shared/steps/essential.py b/squishtests/suite_neptune3/shared/steps/essential.py index cf6ec024..0aa4201e 100644 --- a/squishtests/suite_neptune3/shared/steps/essential.py +++ b/squishtests/suite_neptune3/shared/steps/essential.py @@ -35,6 +35,7 @@ import names import common.settings as settings # some test setting vars import common.app as app +import common.qml_names as qml # coordinate from math import sin, cos, floor @@ -164,4 +165,74 @@ def is_squish_object_there(object, seconds): is_there = False return is_there + +@Given("'|word|' app from launcher tapped") +def step(context, app_name): + if not context.userData: + context.userData = {} + + found, app_idname = app.get_app_id(app_name) + + if found: + object_name = qml.grid_delegate + app_idname + grid_view = waitForObject( + names.neptune_UI_Center_Console_grid_GridView) + + app_pointer = find_object_name_recursively(grid_view, object_name, 3) + + if app_pointer: + if app_pointer.visible: + tapObject(app_pointer) + else: + test.fail("'" + app_name + "' is there but not visible.") + else: + test.fail("'" + app_name + "' could not be found!") + + +@Then("wait '|integer|' seconds and '|word|' app is active") +def step(context, wait_sec, app_name): + if not context.userData: + context.userData = {} + + # MUST switch to main app + app.switch_to_main_app() + + # wait a small while to let it open + snooze(wait_sec) + + found, app_idname = app.get_app_id(app_name) + + if found: + object_name = qml.current_inFrame_Application + app_idname + active_app_slot = waitForObject( + names.neptune_3_UI_Center_Console_activeApplicationSlot_Item) + + # 1st: look for "inFrameApplication" + app_pointer = find_object_name_recursively(active_app_slot, + object_name, 3) + if app_pointer is not None: + my_numnber = app_pointer.children.count + test.log("-_" + str(my_numnber)) + test.compare(True, app_pointer.visible, "should be visible!") + else: + # 2nd try: look for "application_widget" + test.log("'" + app_idname + "' as inFrameApp not found," + + " trying as applicationWidget") + object_name = qml.application_widget + app_idname + app_pointer = find_object_name_recursively(active_app_slot, + object_name, 3) + if app_pointer is not None: + test.compare(True, app_pointer.visible, " should be visible!") + else: + test.fail("'" + app_name + "' app is not known!!") + else: + test.fail("'" + app_name + "' app is not known!!") + + +@Then("switch app to '|word|'") +def step(context, app_name): + """ Is just a thin wrapper to access directly from test """ + app.switch_to_app(app_name) + + # ------------------------------------------------------- |