Skip to content

Add test for cli issue 3707 #154

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 1 commit into from
Jul 19, 2018
Merged
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
25 changes: 25 additions & 0 deletions tests/webpack/hello_world_ng_tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import unittest

from core.base_class.BaseClass import BaseClass
Expand All @@ -6,6 +7,7 @@
from core.device.simulator import Simulator
from core.npm.npm import Npm
from core.osutils.file import File
from core.osutils.folder import Folder
from core.osutils.os_type import OSType
from core.settings.settings import ANDROID_KEYSTORE_PATH, \
ANDROID_KEYSTORE_PASS, ANDROID_KEYSTORE_ALIAS, ANDROID_KEYSTORE_ALIAS_PASS, EMULATOR_ID, CURRENT_OS, \
Expand Down Expand Up @@ -65,6 +67,11 @@ def apply_changes(app_name, log, platform, aot=False):
text_changed = Device.wait_for_text(device_id=EMULATOR_ID, text='Stegen Ter', timeout=20)
assert text_changed, 'Changes in JS file not applied (UI is not refreshed).'

plugin_path = os.path.join(app_name, 'node_modules', 'nativescript-camera')
if Folder.exists(plugin_path):
assert "Building project" not in log, "Unexpected build was triggered."
assert "Gradle build" not in log, "Unexpected gradle build was triggered."

ReplaceHelper.replace(app_name, WebPackHelloWorldNG.html_change, sleep=10)
if aot:
Tns.wait_for_log(log_file=log, string_list=['main.aot.ts'], clean_log=False)
Expand Down Expand Up @@ -270,3 +277,21 @@ def test_220_run_ios_with_bundle_uglify_aot_sync_changes(self):

self.apply_changes(app_name=self.app_name, log=log, platform=Platform.IOS, aot=True)
self.revert_changes(app_name=self.app_name, log=log, platform=Platform.IOS, aot=True)

def test_230_run_android_with_bundle_add_plugin_sync_changes(self):
"""
https://github.com/NativeScript/nativescript-cli/issues/3707
"""

Tns.plugin_add("nativescript-camera", attributes={"--path": self.app_name})

log = Tns.run_android(attributes={'--path': self.app_name,
"--bundle": "",
'--device': EMULATOR_ID}, wait=False, assert_success=False)
Tns.wait_for_log(log_file=log, string_list=Helpers.wp_run, not_existing_string_list=Helpers.wp_errors,
timeout=240, check_interval=10)
Helpers.android_screen_match(image=self.image_original, timeout=120)
Helpers.wait_webpack_watcher()

self.apply_changes(app_name=self.app_name, log=log, platform=Platform.ANDROID)
self.revert_changes(app_name=self.app_name, log=log, platform=Platform.ANDROID)