Skip to content

Commit cc6abf6

Browse files
committed
Add tests for --available-devices
1 parent c2ad1ed commit cc6abf6

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

core/device/simulator.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ def is_running(simulator_name=None):
7878
if ('Booted' in line) and (simulator_name in line):
7979
running = True
8080
simulator_id = line.split('(')[1].split(')')[0]
81-
return running, simulator_id
81+
return running, simulator_id
82+
else:
83+
return False, None
8284

8385
@staticmethod
8486
def wait_for_simulator(simulator_name=None, timeout=300):

tests/device/device_android_tests.py

+6
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ def test_001_device_list(self):
4545
for device_id in self.DEVICE_IDS:
4646
assert device_id in output
4747

48+
def test_002_device_list(self):
49+
output = Tns.run_tns_command("device android --available-devices", attributes={"--path": self.app_name})
50+
assert EMULATOR_ID in output
51+
for device_id in self.DEVICE_IDS:
52+
assert device_id in output
53+
4854
def test_100_device_list_applications_and_run_android(self):
4955

5056
# `tns deploy android` should deploy on all android devices

tests/device/device_ios_tests.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from core.device.device import Device
88
from core.device.simulator import Simulator
99
from core.osutils.folder import Folder
10-
from core.settings.settings import IOS_RUNTIME_PATH, SIMULATOR_NAME
10+
from core.settings.settings import IOS_RUNTIME_PATH, SIMULATOR_NAME, SIMULATOR_TYPE, SIMULATOR_SDK
1111
from core.tns.tns import Tns
1212
from core.tns.tns_platform_type import Platform
1313

@@ -21,6 +21,7 @@ def setUp(self):
2121
BaseClass.setUp(self)
2222
Folder.cleanup(self.app_name)
2323
Device.ensure_available(platform=Platform.IOS)
24+
Simulator.stop()
2425

2526
def test_001_device_list(self):
2627
# Ensure both simulator and real device are listed
@@ -38,6 +39,15 @@ def test_001_device_list(self):
3839
for device_id in self.DEVICE_IDS:
3940
assert device_id in output
4041

42+
def test_002_device_list(self):
43+
output = Tns.run_tns_command("device ios --available-devices", attributes={"--path": self.app_name})
44+
assert SIMULATOR_NAME in output
45+
assert SIMULATOR_TYPE in output
46+
assert SIMULATOR_SDK in output
47+
for device_id in self.DEVICE_IDS:
48+
assert device_id in output
49+
assert not Simulator.is_running()[0], 'Simulator is started after "tns device ios --available-devices"!'
50+
4151
def test_100_device_log_list_applications_and_run_ios(self):
4252
"""
4353
Verify following command work

0 commit comments

Comments
 (0)