Skip to content

Commit 3f5f8b8

Browse files
committed
1 parent ac54c11 commit 3f5f8b8

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

core/settings/strings.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
installed_on_device = "Successfully installed on device with identifier '{0}'"
5353
copy_template_files = "Copying template files..."
5454
"Installing tns-android"
55-
cannot_resolve_device = "Cannot resolve the specified connected device"
5655
deployed_on_device = "Successfully deployed on device"
5756
installed_plugin = "Successfully installed plugin {0}"
5857
tns_plugin = "tns-plugin"
@@ -76,8 +75,8 @@
7675
invalid_value = "The value '{0}' is not valid."
7776
no_platform = "No platform specified"
7877
"and neither was a --path specified."
79-
no_such_device = "Cannot find device with name: "
8078
cannot_resolve_device = "Could not find device by specified identifier"
79+
list_devices = "To list currently connected devices and verify that the specified identifier exists, run 'tns device'"
8180
invalid_version = "{0} is not a valid version."
8281
no_platform_installed = "No installed platforms found. Use $ tns platform add"
8382

tests/emulator/run_android_tests.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from core.osutils.process import Process
2929
from core.settings.settings import ANDROID_RUNTIME_PATH, ANDROID_KEYSTORE_PATH, ANDROID_KEYSTORE_PASS, \
3030
ANDROID_KEYSTORE_ALIAS, ANDROID_KEYSTORE_ALIAS_PASS, EMULATOR_ID, EMULATOR_NAME, CURRENT_OS
31+
from core.settings.strings import cannot_resolve_device, list_devices
3132
from core.tns.replace_helper import ReplaceHelper
3233
from core.tns.tns import Tns
3334
from core.tns.tns_platform_type import Platform
@@ -95,7 +96,8 @@ def test_001_tns_run_android_js_css_xml_manifest(self):
9596
Tns.wait_for_log(log_file=log, string_list=strings)
9697

9798
# Verify application looks correct
98-
Device.screen_match(device_name=EMULATOR_NAME, device_id=EMULATOR_ID, expected_image='livesync-hello-world_js_css_xml')
99+
Device.screen_match(device_name=EMULATOR_NAME, device_id=EMULATOR_ID,
100+
expected_image='livesync-hello-world_js_css_xml')
99101

100102
# Rollback all the changes
101103
ReplaceHelper.rollback(self.app_name, ReplaceHelper.CHANGE_JS, sleep=10)
@@ -483,3 +485,9 @@ def test_401_tns_run_android_should_not_continue_on_build_failure(self):
483485
assert "successfully built" not in output
484486
assert "installed" not in output
485487
assert "synced" not in output
488+
489+
def test_404_run_on_invalid_device_id(self):
490+
output = Tns.run_android(attributes={'--path': self.app_name, '--device': 'fakeId', '--justlaunch': ''},
491+
assert_success=False)
492+
assert cannot_resolve_device in output
493+
assert list_devices in output

tests/simulator/run_ios_tests.py

+7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from core.osutils.folder import Folder
2525
from core.osutils.process import Process
2626
from core.settings.settings import IOS_RUNTIME_PATH, SIMULATOR_NAME, TEST_RUN_HOME
27+
from core.settings.strings import cannot_resolve_device, list_devices
2728
from core.tns.replace_helper import ReplaceHelper
2829
from core.tns.tns import Tns
2930
from core.tns.tns_platform_type import Platform
@@ -321,3 +322,9 @@ def test_400_tns_run_on_folder_with_spaces(self):
321322
output = Tns.run_ios(attributes={'--path': "\"" + destination_path + "\"", '--justlaunch': ''})
322323
assert "Multiple errors were thrown" not in output
323324
assert "fail" not in output
325+
326+
def test_404_run_on_invalid_device_id(self):
327+
output = Tns.run_ios(attributes={'--path': self.app_name, '--device': 'fakeId', '--justlaunch': ''},
328+
assert_success=False)
329+
assert cannot_resolve_device in output
330+
assert list_devices in output

0 commit comments

Comments
 (0)