From a4a6ad8d10e6058d3eba2801d2ada89c24e10b7c Mon Sep 17 00:00:00 2001 From: endarova Date: Wed, 20 Feb 2019 15:54:03 +0200 Subject: [PATCH 1/5] Try to install preview on ios only on mac --- tests/cli/preview/templates/hello_word_js_tests.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/cli/preview/templates/hello_word_js_tests.py b/tests/cli/preview/templates/hello_word_js_tests.py index 6130834d..15cc9930 100644 --- a/tests/cli/preview/templates/hello_word_js_tests.py +++ b/tests/cli/preview/templates/hello_word_js_tests.py @@ -27,8 +27,9 @@ def setUpClass(cls): # Install Preview and Playground Preview.install_preview_app(cls.emu, Platform.ANDROID) - Preview.install_preview_app(cls.sim, Platform.IOS) - Preview.install_playground_app(cls.sim, Platform.IOS) + if Settings.HOST_OS is OSType.OSX: + Preview.install_preview_app(cls.sim, Platform.IOS) + Preview.install_playground_app(cls.sim, Platform.IOS) # Create app Tns.create(app_name=cls.app_name, template=Template.HELLO_WORLD_JS.local_package, update=True) From fa5c0750ac222da5587d3d134d6cf0147fe2b180 Mon Sep 17 00:00:00 2001 From: endarova Date: Wed, 20 Feb 2019 16:10:36 +0200 Subject: [PATCH 2/5] update timeout to fix slow install of app on windows --- core/utils/device/adb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/utils/device/adb.py b/core/utils/device/adb.py index ebaf9d59..bbadb7ec 100644 --- a/core/utils/device/adb.py +++ b/core/utils/device/adb.py @@ -178,6 +178,6 @@ def install(apk_path, device_id): :param apk_path: File path to .apk. :param device_id: Device id. """ - result = Adb.__run_adb_command(command='install -r {0} {1}'.format(apk_path, device_id)) + result = Adb.__run_adb_command(command='install -r {0} {1}'.format(apk_path, device_id), timeout=120) assert 'Success' in result.output, 'Failed to install {0}. Output: {1}'.format(apk_path, result.output) Log.info('{0} installed successfully on {1}.'.format(apk_path, device_id)) From df8471f255b9ee1147dacfda1a3dd7284e352a7b Mon Sep 17 00:00:00 2001 From: endarova Date: Thu, 21 Feb 2019 10:30:16 +0200 Subject: [PATCH 3/5] Update logs according to latest runtime. Add dismiss alert method for ios runs --- data/sync/hello_world_js.py | 6 ++++++ products/nativescript/tns_logs.py | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/data/sync/hello_world_js.py b/data/sync/hello_world_js.py index f2b85a57..6695ad9b 100644 --- a/data/sync/hello_world_js.py +++ b/data/sync/hello_world_js.py @@ -3,6 +3,7 @@ """ import os +import time from core.enums.app_type import AppType from core.settings import Settings @@ -14,6 +15,7 @@ from products.nativescript.tns import Tns from products.nativescript.tns_logs import TnsLogs from products.nativescript.preview_helpers import Preview +from core.enums.platform_type import Platform def sync_hello_world_js(app_name, platform, device, bundle=False, hmr=False, uglify=False, aot=False, @@ -137,6 +139,10 @@ def preview_hello_world_js_ts(app_name, platform, device, bundle=False, hmr=Fals log = File.read(result.log_file) url = Preview.get_url(log) Preview.run_app(url, device.id, platform) + # When you run preview on ios simulator on first run confirmation dialog is showh. This script will dismiss it + if platform == Platform.IOS: + time.sleep(2) + Preview.dismiss_simulator_alert() # Verify logs strings = TnsLogs.preview_initial_messages(platform=platform, hmr=hmr, bundle=bundle, instrumented=instrumented) diff --git a/products/nativescript/tns_logs.py b/products/nativescript/tns_logs.py index b8a717de..f5a1d570 100644 --- a/products/nativescript/tns_logs.py +++ b/products/nativescript/tns_logs.py @@ -239,7 +239,6 @@ def preview_file_changed_messages(platform, file_name, run_type=RunType.INCREMEN else: logs.append('Successfully synced {0} for platform {1}'.format(file_name, str(platform))) if hmr: - logs.append('Successfully synced bundle.') logs.append('hot-update.json') logs.append('HMR: Checking for updates to the bundle with hmr hash') logs.append('HMR: The following modules were updated:') From 56f1790f126c5e58191917a6548ea27e5c06ea6c Mon Sep 17 00:00:00 2001 From: endarova Date: Thu, 21 Feb 2019 10:30:56 +0200 Subject: [PATCH 4/5] revert timeout --- core/utils/device/adb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/utils/device/adb.py b/core/utils/device/adb.py index bbadb7ec..9510af73 100644 --- a/core/utils/device/adb.py +++ b/core/utils/device/adb.py @@ -178,6 +178,6 @@ def install(apk_path, device_id): :param apk_path: File path to .apk. :param device_id: Device id. """ - result = Adb.__run_adb_command(command='install -r {0} {1}'.format(apk_path, device_id), timeout=120) + result = Adb.__run_adb_command(command='install -r {0} {1}'.format(apk_path, device_id), timeout=60) assert 'Success' in result.output, 'Failed to install {0}. Output: {1}'.format(apk_path, result.output) Log.info('{0} installed successfully on {1}.'.format(apk_path, device_id)) From fc826e831d1edf2e425d3e84a5bd9d20ab61801d Mon Sep 17 00:00:00 2001 From: endarova Date: Thu, 21 Feb 2019 10:31:34 +0200 Subject: [PATCH 5/5] fix linter errors --- data/sync/hello_world_js.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/sync/hello_world_js.py b/data/sync/hello_world_js.py index 6695ad9b..50913ec3 100644 --- a/data/sync/hello_world_js.py +++ b/data/sync/hello_world_js.py @@ -6,6 +6,7 @@ import time from core.enums.app_type import AppType +from core.enums.platform_type import Platform from core.settings import Settings from core.utils.file_utils import File from core.utils.wait import Wait @@ -15,7 +16,6 @@ from products.nativescript.tns import Tns from products.nativescript.tns_logs import TnsLogs from products.nativescript.preview_helpers import Preview -from core.enums.platform_type import Platform def sync_hello_world_js(app_name, platform, device, bundle=False, hmr=False, uglify=False, aot=False,