2
2
Tests for `tns debug ios` executed on iOS Simulator.
3
3
"""
4
4
import os
5
+ import time
5
6
6
7
from core .base_class .BaseClass import BaseClass
7
8
from core .device .device import Device
@@ -42,13 +43,13 @@ def setUp(self):
42
43
BaseClass .setUp (self )
43
44
Process .kill ('Safari' )
44
45
Process .kill ('NativeScript Inspector' )
45
- Process .kill ('node' ) # Stop 'node' to kill the livesync after each test method.
46
+ Process .kill ('node' )
46
47
47
48
def tearDown (self ):
48
49
BaseClass .tearDown (self )
49
- Process .kill ('node' ) # Stop 'node' to kill the livesync after each test method.
50
50
Process .kill ('Safari' )
51
51
Process .kill ('NativeScript Inspector' )
52
+ Process .kill ('node' )
52
53
53
54
@classmethod
54
55
def tearDownClass (cls ):
@@ -91,23 +92,20 @@ def tearDownClass(cls):
91
92
def __verify_debugger_start (self , log ):
92
93
strings = [self .SIMULATOR_ID , "Frontend client connected" , "Backend socket created" ,
93
94
"NativeScript debugger attached" ]
94
- if Device .get_count (platform = Platform .IOS ) > 0 :
95
- strings .append ("Multiple devices found! Starting debugger on emulator" )
96
95
Tns .wait_for_log (log_file = log , string_list = strings , timeout = 120 , check_interval = 10 , clean_log = False )
96
+ time .sleep (10 )
97
97
output = File .read (log )
98
98
assert "Frontend socket closed" not in output
99
99
assert "Backend socket closed" not in output
100
100
assert "NativeScript debugger detached" not in output
101
101
assert Process .is_running ('NativeScript Inspector' )
102
102
103
103
def __verify_debugger_attach (self , log ):
104
- log = Tns .debug_ios (attributes = {'--path' : self .app_name , '--start' : '' })
105
104
strings = ["Frontend client connected" , "Backend socket created" ]
106
- if Device .get_count (platform = Platform .IOS ) > 0 :
107
- strings .append ("Multiple devices found! Starting debugger on emulator" )
108
105
Tns .wait_for_log (log_file = log , string_list = strings , timeout = 120 , check_interval = 10 , clean_log = False )
106
+ time .sleep (10 )
109
107
output = File .read (log )
110
- assert "NativeScript debugger attached" not in output # This is not in output when you attach to running app
108
+ assert "NativeScript debugger attached" not in output # This is not in output when you attach to running app
111
109
assert "Frontend socket closed" not in output
112
110
assert "Backend socket closed" not in output
113
111
assert "NativeScript debugger detached" not in output
@@ -117,7 +115,7 @@ def test_001_debug_ios_simulator(self):
117
115
"""
118
116
Default `tns debug ios` starts debugger (do not stop at the first code statement)
119
117
"""
120
- log = Tns .debug_ios (attributes = {'--path' : self .app_name })
118
+ log = Tns .debug_ios (attributes = {'--path' : self .app_name , '--emulator' : '' })
121
119
self .__verify_debugger_start (log )
122
120
123
121
# Verify app starts and do not stop on first line of code
@@ -129,7 +127,7 @@ def test_002_debug_ios_simulator_debug_brk(self):
129
127
Starts debugger and stop at the first code statement.
130
128
"""
131
129
132
- log = Tns .debug_ios (attributes = {'--path' : self .app_name , '--debug-brk' : '' })
130
+ log = Tns .debug_ios (attributes = {'--path' : self .app_name , '--emulator' : '' , '-- debug-brk' : '' })
133
131
self .__verify_debugger_start (log )
134
132
135
133
# Verify app starts and do not stop on first line of code
@@ -143,11 +141,11 @@ def test_003_debug_ios_simulator_start(self):
143
141
144
142
# Run the app and ensure it works
145
143
log = Tns .run_ios (attributes = {'--path' : self .app_name , '--emulator' : '' , '--justlaunch' : '' },
146
- assert_success = False , timeout = 30 )
144
+ assert_success = False , timeout = 30 )
147
145
TnsAsserts .prepared (app_name = self .app_name , platform = Platform .IOS , output = log , prepare = Prepare .SKIP )
148
146
Device .screen_match (device_type = DeviceType .SIMULATOR , device_name = SIMULATOR_NAME ,
149
147
device_id = self .SIMULATOR_ID , expected_image = 'livesync-hello-world_home' )
150
148
151
149
# Attach debugger
152
- log = Tns .debug_ios (attributes = {'--path' : self .app_name , '--start' : '' })
150
+ log = Tns .debug_ios (attributes = {'--path' : self .app_name , '--emulator' : '' , '-- start' : '' })
153
151
self .__verify_debugger_attach (log = log )
0 commit comments