Skip to content

fix: preview tests #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/utils/device/adb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=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))
6 changes: 6 additions & 0 deletions data/sync/hello_world_js.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
"""

import os
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
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion products/nativescript/tns_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:')
Expand Down
5 changes: 3 additions & 2 deletions tests/cli/preview/templates/hello_word_js_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down