Skip to content

Commit 41f4281

Browse files
committed
1 parent 0f6d89f commit 41f4281

File tree

7 files changed

+24
-4
lines changed

7 files changed

+24
-4
lines changed

core/tns/tns.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ def plugin_add(name, attributes={}, log_trace=False, assert_success=True, tns_pa
302302
output = Tns.run_tns_command("plugin add " + name, attributes=attributes, log_trace=log_trace,
303303
tns_path=tns_path)
304304
if assert_success:
305-
assert "Successfully installed plugin {0}".format(name.replace("@" + Tns.NEXT_TAG, "")) in output
305+
short_name = name.replace("@" + Tns.NEXT_TAG, "").replace(".tgz", "").split(os.sep)[-1]
306+
assert "Successfully installed plugin {0}".format(short_name) in output
306307
return output
307308

308309
@staticmethod
897 Bytes
Binary file not shown.

tests/build/ios/plugin_ios_tests.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from core.osutils.command import run
1010
from core.osutils.file import File
1111
from core.osutils.folder import Folder
12-
from core.settings.settings import TNS_PATH, IOS_RUNTIME_PATH, ANDROID_RUNTIME_PATH
12+
from core.settings.settings import TNS_PATH, IOS_RUNTIME_PATH, ANDROID_RUNTIME_PATH, TEST_RUN_HOME
1313
from core.settings.strings import *
1414
from core.tns.tns import Tns
1515
from core.tns.tns_platform_type import Platform
@@ -190,6 +190,20 @@ def test_302_plugin_and_npm_modules_in_same_project(self):
190190
assert not File.exists(self.app_name + "/platforms/android/src/main/assets/app/tns_modules/" +
191191
"nativescript-appversion/appversion.ios.js")
192192

193+
def test_320_CFBundleURLTypes_overridden_from_plugin(self):
194+
"""
195+
Test for issue https://github.com/NativeScript/nativescript-cli/issues/2936
196+
"""
197+
Tns.create_app(self.app_name)
198+
plugin_path = os.path.join(TEST_RUN_HOME, 'data', 'plugins', 'CFBundleURLName-Plugin.tgz')
199+
Tns.plugin_add(plugin_path, attributes={"--path": self.app_name})
200+
Tns.prepare_ios(attributes={"--path": self.app_name})
201+
plist = File.read(os.path.join(TEST_RUN_HOME, self.app_name, 'platforms', 'ios', self.app_name,
202+
self.app_name + "-Info.plist"))
203+
assert "<key>NSAllowsArbitraryLoads</key>" in plist, \
204+
"NSAppTransportSecurity from plugin is not found in final Info.plist"
205+
assert "<string>bar</string>" in plist, "CFBundleURLTypes from plugin is not found in final Info.plist"
206+
193207
def test_401_plugin_add_invalid_plugin(self):
194208
Tns.create_app(self.app_name)
195209
output = Tns.plugin_add("wd", attributes={"--path": self.app_name}, assert_success=False)
@@ -220,4 +234,4 @@ def test_403_plugin_add_plugin_not_supported_on_specific_platform(self):
220234
output = Tns.prepare_android(attributes={"--path": self.app_name})
221235
TnsAsserts.prepared(self.app_name, platform=Platform.ANDROID, output=output, prepare=Prepare.FULL)
222236
assert File.pattern_exists(self.app_name + "/platforms/android", pattern="*.aar")
223-
assert File.pattern_exists(self.app_name + "/platforms/android", pattern="*ACRA*")
237+
assert File.pattern_exists(self.app_name + "/platforms/android", pattern="*ACRA*")

tests/emulator/debug_android_tests.py

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from core.osutils.folder import Folder
1111
from core.settings.settings import EMULATOR_NAME, EMULATOR_ID, ANDROID_RUNTIME_PATH
1212
from core.tns.tns import Tns
13+
from core.tns.tns_platform_type import Platform
1314

1415

1516
class DebugAndroidEmulatorTests(BaseClass):
@@ -18,6 +19,7 @@ def setUpClass(cls):
1819
logfile = os.path.join('out', cls.__name__ + '.txt')
1920
BaseClass.setUpClass(logfile)
2021
Emulator.stop()
22+
Device.uninstall_app(app_prefix="org.nativescript.", platform=Platform.ANDROID)
2123
Emulator.ensure_available()
2224
Folder.cleanup(cls.app_name)
2325

tests/emulator/run_android_ng_tests.py

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from core.settings.settings import ANDROID_RUNTIME_PATH, EMULATOR_ID, EMULATOR_NAME
1717
from core.tns.replace_helper import ReplaceHelper
1818
from core.tns.tns import Tns
19+
from core.tns.tns_platform_type import Platform
1920

2021

2122
@flaky(max_runs=2)
@@ -25,6 +26,7 @@ def setUpClass(cls):
2526
logfile = os.path.join('out', cls.__name__ + '.txt')
2627
BaseClass.setUpClass(logfile)
2728
Emulator.stop()
29+
Device.uninstall_app(app_prefix="org.nativescript.", platform=Platform.ANDROID)
2830
Emulator.ensure_available()
2931
Folder.cleanup(cls.app_name)
3032

tests/emulator/run_android_tests.py

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def setUpClass(cls):
4141
logfile = os.path.join('out', cls.__name__ + '.txt')
4242
BaseClass.setUpClass(logfile)
4343
Emulator.stop()
44+
Device.uninstall_app(app_prefix="org.nativescript.", platform=Platform.ANDROID)
4445
Emulator.ensure_available()
4546
Folder.cleanup(cls.app_name)
4647

tests/simulator/run_ios_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def test_300_tns_run_ios_just_launch_and_incremental_builds(self):
215215
"""
216216

217217
# Execute `tns run android --path TNS_App --justlaunch` and verify app looks correct on emulator
218-
Tns.run_ios(attributes={'--path': self.app_name, '--emulator': '', '--justlaunch': ''}, timeout=120)
218+
Tns.run_ios(attributes={'--path': self.app_name, '--emulator': '', '--justlaunch': ''}, timeout=180)
219219
Device.screen_match(device_name=SIMULATOR_NAME,
220220
device_id=self.SIMULATOR_ID, expected_image='livesync-hello-world_home')
221221

0 commit comments

Comments
 (0)