Skip to content

Commit 9fef700

Browse files
committed
1 parent da4055b commit 9fef700

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

tests/emulator/run_android_tests.py

+14
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,20 @@ def test_350_tns_run_android_should_start_emulator(self):
461461
else:
462462
raise nose.SkipTest('This test is not valid when devices are connected.')
463463

464+
def test_390_tns_run_android_should_warn_if_package_ids_do_not_match(self):
465+
"""
466+
If bundle identifiers in package.json and app.gradle do not match CLI should warn the user.
467+
"""
468+
app_gradle = os.path.join(self.app_name, 'app', 'App_Resources','Android','app.gradle')
469+
File.replace(file_path=app_gradle, str1='org.nativescript.' + self.app_name, str2='org.nativescript.MyApp')
470+
File.replace(file_path=app_gradle, str1='__PACKAGE__', str2='org.nativescript.MyApp')
471+
assert "org.nativescript.MyApp" in File.read(app_gradle), "Failed to replace bundle identifier."
472+
473+
output = Tns.run_android(attributes={'--path': self.app_name, '--justlaunch': ''})
474+
assert "The Application identifier is different from the one inside 'package.json' file." in output
475+
assert "NativeScript CLI might not work properly." in output
476+
assert "BUILD SUCCESSFUL" in output
477+
464478
@unittest.skipIf(CURRENT_OS == OSType.LINUX, "`shell cp -r` fails for some reason on emulators on Linux.")
465479
def test_400_tns_run_android_respect_adb_errors(self):
466480
"""

tests/simulator/run_ios_tests.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def setUpClass(cls):
4242
BaseClass.setUpClass(logfile)
4343
Emulator.stop()
4444
Simulator.stop()
45-
cls.SIMULATOR_ID = Simulator.start(name=SIMULATOR_NAME)
45+
cls.SIMULATOR_ID = Simulator.ensure_available(simulator_name=SIMULATOR_NAME)
4646
Folder.cleanup(cls.app_name)
4747

4848
def setUp(self):
@@ -359,6 +359,20 @@ def test_370_tns_run_plugin_add(self):
359359
assert 'BUILD SUCCEEDED' not in File.read(log), "Change of CSS files after plugin add is not incremental!"
360360
File.write(file_path=log, text="") # Clean log file
361361

362+
def test_390_tns_run_ios_should_warn_if_package_ids_do_not_match(self):
363+
"""
364+
If bundle identifiers in package.json and Info.plist do not match CLI should warn the user.
365+
"""
366+
str1 = "<string>${EXECUTABLE_NAME}</string>"
367+
str2 = "<string>${EXECUTABLE_NAME}</string>" \
368+
"<key>CFBundleIdentifier</key>" \
369+
"<string>org.nativescript.myapp</string>"
370+
info = os.path.join(self.app_name, 'app', 'App_Resources','iOS','Info.plist')
371+
File.replace(file_path=info, str1=str1, str2=str2)
372+
output = Tns.run_ios(attributes={'--path': self.app_name, '--justlaunch': ''})
373+
assert "[WARNING]: The CFBundleIdentifier key inside the 'Info.plist' will be overriden" in output
374+
assert "Successfully synced application org.nativescript.TestApp" in output
375+
362376
def test_400_tns_run_on_folder_with_spaces(self):
363377
"""
364378
`tns run ios` for apps with spaces

0 commit comments

Comments
 (0)