12
12
13
13
from helpers ._os_lib import cleanup_folder , replace , remove
14
14
from helpers ._tns_lib import IOS_RUNTIME_SYMLINK_PATH , \
15
- create_project , platform_add , run , livesync , TNS_PATH
15
+ create_project , platform_add , build , run , livesync , TNS_PATH
16
16
from helpers .device import stop_emulators
17
17
from helpers .simulator import create_simulator , delete_simulator , \
18
- cat_app_file_on_simulator , start_simulator , stop_simulators
18
+ cat_app_file_on_simulator , start_simulator , stop_simulators , \
19
+ SIMULATOR_NAME
19
20
20
21
21
22
class LiveSyncSimulator (unittest .TestCase ):
@@ -29,11 +30,12 @@ def setUpClass(cls):
29
30
stop_emulators ()
30
31
stop_simulators ()
31
32
32
- delete_simulator ('iPhone 6s 90' )
33
- create_simulator ('iPhone 6s 90' , 'iPhone 6s' , '9.0' )
33
+ delete_simulator (SIMULATOR_NAME )
34
+ create_simulator (SIMULATOR_NAME , 'iPhone 6s' , '9.0' )
34
35
35
- start_simulator ('iPhone 6s 90' )
36
+ start_simulator (SIMULATOR_NAME )
36
37
cleanup_folder ('TNS_App' )
38
+ cleanup_folder ('appTest' )
37
39
38
40
# setup app
39
41
create_project (proj_name = "TNS_App" , copy_from = "data/apps/livesync-hello-world" )
@@ -81,6 +83,7 @@ def tearDownClass(cls):
81
83
82
84
stop_simulators ()
83
85
cleanup_folder ('TNS_App' )
86
+ cleanup_folder ('appTest' )
84
87
85
88
def wait_for_text_in_output (self , text ):
86
89
def read_loop ():
@@ -220,13 +223,35 @@ def test_301_livesync_ios_simulator_before_run(self):
220
223
print "~~~ Forced killing subprocess ..."
221
224
self .process .kill ()
222
225
223
- cleanup_folder ('TNS_App ' )
224
- create_project (proj_name = "TNS_App " )
226
+ cleanup_folder ('appTest ' )
227
+ create_project (proj_name = "appTest " )
225
228
platform_add (platform = "ios" , framework_path = IOS_RUNTIME_SYMLINK_PATH , \
226
- path = "TNS_App" , symlink = True )
229
+ path = "appTest" , symlink = True )
230
+ build (platform = "ios" , path = "appTest" )
227
231
228
- replace ("TNS_App/app/main-page.xml" , "TAP" , "TEST" )
229
- livesync (platform = "ios" , emulator = True , path = "TNS_App" )
232
+ # replace
233
+ replace ("appTest/app/main-page.xml" , "TAP" , "TEST" )
234
+ replace ("appTest/app/main-view-model.js" , "taps" , "clicks" )
235
+ replace ("appTest/app/app.css" , "30" , "20" )
230
236
231
- output = cat_app_file_on_simulator ("TNSApp" , "app/main-page.xml" )
237
+ replace ("appTest/node_modules/tns-core-modules/LICENSE" , "2015" , "9999" )
238
+ replace (
239
+ "appTest/node_modules/tns-core-modules/application/application-common.js" ,
240
+ "(\" globals\" );" , "(\" globals\" ); // test" )
241
+
242
+ livesync (platform = "ios" , emulator = True , path = "appTest" )
243
+ self .wait_for_text_in_output ("prepared" )
244
+ time .sleep (2 )
245
+
246
+ output = cat_app_file_on_simulator ("appTest" , "app/main-page.xml" )
232
247
assert "<Button text=\" TEST\" tap=\" {{ tapAction }}\" />" in output
248
+ output = cat_app_file_on_simulator ("appTest" , "app/main-view-model.js" )
249
+ assert "this.set(\" message\" , this.counter + \" clicks left\" );" in output
250
+ output = cat_app_file_on_simulator ("appTest" , "app/app.css" )
251
+ assert "font-size: 20;" in output
252
+
253
+ output = cat_app_file_on_simulator ("appTest" , "app/tns_modules/LICENSE" )
254
+ assert "Copyright (c) 9999 Telerik AD" in output
255
+ output = cat_app_file_on_simulator ("appTest" , \
256
+ "app/tns_modules/application/application-common.js" )
257
+ assert "require(\" globals\" ); // test" in output
0 commit comments