From 6ae2bb2b2ea4242f04ef9a75ad32524c787339a6 Mon Sep 17 00:00:00 2001 From: Maria Endarova Date: Thu, 12 Dec 2019 07:47:27 +0200 Subject: [PATCH 1/2] fix: vue tests with appium (#459) --- data/sync/master_detail_vue.py | 36 ++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/data/sync/master_detail_vue.py b/data/sync/master_detail_vue.py index 715066df..a7102c37 100644 --- a/data/sync/master_detail_vue.py +++ b/data/sync/master_detail_vue.py @@ -20,20 +20,28 @@ def sync_master_detail_vue(app_name, platform, device): - # Execute tns command - log_trace = False + # workaraund for appium restarting application when attaching if platform == Platform.IOS: - # Temporary add log trace on iOS to debug an issue - log_trace = True - result = Tns.run(app_name=app_name, platform=platform, emulator=True, log_trace=log_trace, wait=False) - strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.FULL, app_type=AppType.VUE, - transfer_all=True) - TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings, timeout=360) + result = Tns.run(app_name=app_name, emulator=True, platform=platform, just_launch=True) + strings = TnsLogs.run_messages(app_name=app_name, platform=platform, + run_type=RunType.JUST_LAUNCH, device=device, just_launch=True) + TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings, timeout=360) + device.wait_for_text(text="Ford KA") + # start appium driver (need it on iOS only) + appium = AppiumDriver(platform=platform, device=device, bundle_id=TnsPaths.get_bundle_id(app_name)) - # start appium driver (need it on iOS only) - appium = None + result = Tns.run(app_name=app_name, platform=platform, emulator=True, wait=False) if platform == Platform.IOS: - appium = AppiumDriver(platform=platform, device=device, bundle_id=TnsPaths.get_bundle_id(app_name)) + # because of workaround for appium this run is not first run on ios + strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.INCREMENTAL, + app_type=AppType.VUE, transfer_all=True) + strings.remove('Refreshing application on device') + strings.append('Restarting application on device') + else: + strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.FULL, + app_type=AppType.VUE, transfer_all=True) + + TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings, timeout=360) # Verify app home page looks properly device.wait_for_text(text="Ford KA") @@ -89,5 +97,7 @@ def sync_master_detail_vue(app_name, platform, device): device.wait_for_text(text=Changes.MasterDetailVUE.VUE_DETAIL_PAGE_TEMPLATE.new_text) # Kill Appium - if appium is not None: - appium.stop() + if platform == Platform.IOS: + # Kill Appium + if appium is not None: + appium.stop() From 6e19b91e3caab648ff50adbf49ce1a4ece407295 Mon Sep 17 00:00:00 2001 From: endarova Date: Fri, 27 Dec 2019 14:27:05 +0200 Subject: [PATCH 2/2] update core test value --- core_tests/unit/utils/wait_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core_tests/unit/utils/wait_tests.py b/core_tests/unit/utils/wait_tests.py index 46669f2b..4fe785c2 100644 --- a/core_tests/unit/utils/wait_tests.py +++ b/core_tests/unit/utils/wait_tests.py @@ -21,7 +21,7 @@ def test_10_wait(self): @timed(5) def test_20_get_average_time(self): ls_time = PerfUtils.get_average_time(lambda: run(cmd='ifconfig'), retry_count=5) - assert 0.005 <= ls_time <= 0.05, "Command not executed in acceptable time. Actual value: " + str(ls_time) + assert 0.004 <= ls_time <= 0.05, "Command not executed in acceptable time. Actual value: " + str(ls_time) @staticmethod def seconds_are_odd():