Skip to content

Commit 67ac7f8

Browse files
Vasil ChimevVasil Chimev
Vasil Chimev
authored and
Vasil Chimev
committed
Add tests for the run command.
NativeScript/nativescript-cli#1167
1 parent 161c826 commit 67ac7f8

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

tests/run_linux.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def setUp(self):
3737
given_running_emulator()
3838
given_real_device(platform="android")
3939
cleanup_folder('./TNS_App/platforms/android/build/outputs')
40-
cleanup_folder('./appTest')
4140

4241
def tearDown(self):
4342
pass
@@ -48,7 +47,7 @@ def tearDownClass(cls):
4847
cleanup_folder('./TNS_App')
4948
cleanup_folder('./TNS_App_NoPlatform')
5049

51-
def test_001_run_android(self):
50+
def test_001_run_android_justlaunch(self):
5251
output = run_aut(TNS_PATH + " run android --path TNS_App --justlaunch")
5352
assert "Project successfully prepared" in output
5453
assert "Project successfully built" in output
@@ -97,13 +96,19 @@ def test_201_run_android_device_id_renamed_proj_dir(self):
9796
# TODO: Get device id and verify files are deployed and process is
9897
# running on this device
9998

100-
def test_300_run_android_patform_not_added(self):
99+
def test_301_run_android_patform_not_added(self):
101100
create_project(proj_name="TNS_App_NoPlatform")
102101
output = run_aut(
103-
TNS_PATH +
104-
" run android --path TNS_App_NoPlatform --justlaunch")
102+
TNS_PATH + " run android --path TNS_App_NoPlatform --justlaunch")
105103

106104
assert "Project successfully created." in output
107105
assert "Project successfully prepared" in output
108106
assert "Project successfully built" in output
109107
assert "Successfully deployed on device with identifier" in output
108+
109+
def test_302_run_android_device_not_connected(self):
110+
output = run_aut(TNS_PATH + " run android --device xxxxx --path TNS_App_NoPlatform")
111+
assert "Cannot resolve the specified connected device" in output
112+
assert "Project successfully prepared" not in output
113+
assert "Project successfully built" not in output
114+
assert "Successfully deployed on device" not in output

tests/run_osx.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def tearDownClass(cls):
5454
cleanup_folder('./TNSAppNoPlatform')
5555
stop_simulators()
5656

57-
def test_001_run_ios(self):
57+
def test_001_run_ios_justlaunch(self):
5858
output = run_aut(TNS_PATH + " run ios --path TNS_App --justlaunch")
5959
assert "Project successfully prepared" in output
6060
assert "CONFIGURATION Debug" in output
@@ -125,13 +125,19 @@ def test_200_run_ios_inside_project(self):
125125
assert "Project successfully built" in output
126126
assert "Successfully deployed on device" in output
127127

128-
def test_300_run_ios_platform_not_added(self):
128+
def test_301_run_ios_platform_not_added(self):
129129
create_project(proj_name="TNSAppNoPlatform")
130130
output = run_aut(
131-
TNS_PATH +
132-
" run ios --path TNSAppNoPlatform --justlaunch")
131+
TNS_PATH + " run ios --path TNSAppNoPlatform --justlaunch")
133132

134133
assert "Project successfully created." in output
135134
assert "Project successfully prepared" in output
136135
assert "Project successfully built" in output
137136
assert "Successfully deployed on device" in output
137+
138+
def test_302_run_ios_device_not_connected(self):
139+
output = run_aut(TNS_PATH + " run android --device xxxxx --path TNSAppNoPlatform")
140+
assert "Cannot resolve the specified connected device" in output
141+
assert "Project successfully prepared" not in output
142+
assert "Project successfully built" not in output
143+
assert "Successfully deployed on device" not in output

0 commit comments

Comments
 (0)