Skip to content

Commit 2256f9e

Browse files
authoredFeb 21, 2019
fix: preview tests (#54)
* Try to install preview on ios only on mac * update timeout to fix slow install of app on windows * Update logs according to latest runtime. Add dismiss alert method for ios runs * revert timeout * fix linter errors
1 parent 755bee7 commit 2256f9e

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed
 

‎core/utils/device/adb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,6 @@ def install(apk_path, device_id):
178178
:param apk_path: File path to .apk.
179179
:param device_id: Device id.
180180
"""
181-
result = Adb.__run_adb_command(command='install -r {0} {1}'.format(apk_path, device_id))
181+
result = Adb.__run_adb_command(command='install -r {0} {1}'.format(apk_path, device_id), timeout=60)
182182
assert 'Success' in result.output, 'Failed to install {0}. Output: {1}'.format(apk_path, result.output)
183183
Log.info('{0} installed successfully on {1}.'.format(apk_path, device_id))

‎data/sync/hello_world_js.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
"""
44

55
import os
6+
import time
67

78
from core.enums.app_type import AppType
9+
from core.enums.platform_type import Platform
810
from core.settings import Settings
911
from core.utils.file_utils import File
1012
from core.utils.wait import Wait
@@ -137,6 +139,10 @@ def preview_hello_world_js_ts(app_name, platform, device, bundle=False, hmr=Fals
137139
log = File.read(result.log_file)
138140
url = Preview.get_url(log)
139141
Preview.run_app(url, device.id, platform)
142+
# When you run preview on ios simulator on first run confirmation dialog is showh. This script will dismiss it
143+
if platform == Platform.IOS:
144+
time.sleep(2)
145+
Preview.dismiss_simulator_alert()
140146

141147
# Verify logs
142148
strings = TnsLogs.preview_initial_messages(platform=platform, hmr=hmr, bundle=bundle, instrumented=instrumented)

‎products/nativescript/tns_logs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ def preview_file_changed_messages(platform, file_name, run_type=RunType.INCREMEN
239239
else:
240240
logs.append('Successfully synced {0} for platform {1}'.format(file_name, str(platform)))
241241
if hmr:
242-
logs.append('Successfully synced bundle.')
243242
logs.append('hot-update.json')
244243
logs.append('HMR: Checking for updates to the bundle with hmr hash')
245244
logs.append('HMR: The following modules were updated:')

‎tests/cli/preview/templates/hello_word_js_tests.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ def setUpClass(cls):
2727

2828
# Install Preview and Playground
2929
Preview.install_preview_app(cls.emu, Platform.ANDROID)
30-
Preview.install_preview_app(cls.sim, Platform.IOS)
31-
Preview.install_playground_app(cls.sim, Platform.IOS)
30+
if Settings.HOST_OS is OSType.OSX:
31+
Preview.install_preview_app(cls.sim, Platform.IOS)
32+
Preview.install_playground_app(cls.sim, Platform.IOS)
3233

3334
# Create app
3435
Tns.create(app_name=cls.app_name, template=Template.HELLO_WORLD_JS.local_package, update=True)

0 commit comments

Comments
 (0)
Please sign in to comment.