9
9
10
10
import shutil , time
11
11
12
- from helpers ._os_lib import cleanup_folder , replace
12
+ from helpers ._os_lib import cleanup_folder , replace , remove
13
13
from helpers ._tns_lib import IOS_RUNTIME_SYMLINK_PATH , \
14
14
create_project , platform_add , run , livesync , TNS_PATH
15
15
from helpers .device import stop_emulators
@@ -98,6 +98,8 @@ def test_001_full_livesync_ios_simulator_xml_js_css_tns_files(self):
98
98
"app/tns_modules/application/application-common.js" )
99
99
assert "require(\" globals\" ); // test" in output
100
100
101
+
102
+ # Add new files
101
103
def test_101_livesync_ios_simulator_watch_add_xml_file (self ):
102
104
shutil .copyfile ("TNS_App/app/main-page.xml" , "TNS_App/app/test/test.xml" )
103
105
self .wait_for_text_in_output ("app/test/test.xml" )
@@ -120,6 +122,8 @@ def test_103_livesync_ios_simulator_watch_add_css_file(self):
120
122
output = cat_app_file_on_simulator ("TNSApp" , "app/test/test.css" )
121
123
assert "color: #284848;" in output
122
124
125
+
126
+ # Change in files
123
127
def test_111_livesync_ios_simulator_watch_change_xml_file (self ):
124
128
replace ("TNS_App/app/main-page.xml" , "TEST" , "WATCH" )
125
129
self .wait_for_text_in_output ("app/main-page.xml" )
@@ -142,101 +146,60 @@ def test_113_livesync_ios_simulator_watch_change_css_file(self):
142
146
output = cat_app_file_on_simulator ("TNSApp" , "app/app.css" )
143
147
assert "color: green;" in output
144
148
145
- # https://github.com/NativeScript/nativescript-cli/issues/1210
149
+
150
+ # # Delete files
146
151
# def test_121_livesync_ios_simulator_watch_delete_xml_file(self):
147
152
# remove("TNS_App/app/test/test.xml")
148
153
# self.wait_for_text_in_output("app/test/test.xml")
149
- #
154
+ #
150
155
# output = cat_app_file_on_simulator("TNSApp", "app/test/test.xml")
151
156
# assert "No such file or directory" in output
152
- #
157
+ #
153
158
# def test_122_livesync_ios_simulator_watch_delete_js_file(self):
154
159
# remove("TNS_App/app/test/test.js")
155
160
# self.wait_for_text_in_output("app/test/test.js")
156
161
# time.sleep(2)
157
- #
162
+ #
158
163
# output = cat_app_file_on_simulator("TNSApp", "app/test/test.js")
159
164
# assert "No such file or directory" in output
160
- #
165
+ #
161
166
# def test_123_livesync_ios_simulator_watch_delete_css_file(self):
162
167
# remove("TNS_App/app/test/test.css")
163
168
# self.wait_for_text_in_output("app/test/test.css")
164
- #
169
+ #
165
170
# output = cat_app_file_on_simulator("TNSApp", "app/test/test.css")
166
171
# assert "No such file or directory" in output
167
172
173
+
168
174
def test_301_livesync_ios_simulator_before_run (self ):
169
175
self .terminate_watcher ()
170
- cleanup_folder ('TNS_App ' )
176
+ cleanup_folder ('appTest ' )
171
177
172
- create_project (proj_name = "TNS_App " )
178
+ create_project (proj_name = "appTest " )
173
179
platform_add (platform = "ios" , framework_path = IOS_RUNTIME_SYMLINK_PATH , \
174
- path = "TNS_App " , symlink = True )
180
+ path = "appTest " , symlink = True )
175
181
176
182
# replace
177
- replace ("TNS_App /app/main-page.xml" , "TAP" , "TEST" )
178
- replace ("TNS_App /app/main-view-model.js" , "taps" , "clicks" )
179
- replace ("TNS_App /app/app.css" , "30" , "20" )
183
+ replace ("appTest /app/main-page.xml" , "TAP" , "TEST" )
184
+ replace ("appTest /app/main-view-model.js" , "taps" , "clicks" )
185
+ replace ("appTest /app/app.css" , "30" , "20" )
180
186
181
- replace ("TNS_App /node_modules/tns-core-modules/LICENSE" , "2015" , "9999" )
187
+ replace ("appTest /node_modules/tns-core-modules/LICENSE" , "2015" , "9999" )
182
188
replace (
183
- "TNS_App /node_modules/tns-core-modules/application/application-common.js" ,
189
+ "appTest /node_modules/tns-core-modules/application/application-common.js" ,
184
190
"(\" globals\" );" , "(\" globals\" ); // test" )
185
191
186
- livesync (platform = "ios" , emulator = True , path = "TNS_App " )
192
+ livesync (platform = "ios" , emulator = True , path = "appTest " )
187
193
188
- output = cat_app_file_on_simulator ("TNSApp " , "app/main-page.xml" )
194
+ output = cat_app_file_on_simulator ("appTest " , "app/main-page.xml" )
189
195
assert "<Button text=\" TEST\" tap=\" {{ tapAction }}\" />" in output
190
- output = cat_app_file_on_simulator ("TNSApp " , "app/main-view-model.js" )
196
+ output = cat_app_file_on_simulator ("appTest " , "app/main-view-model.js" )
191
197
assert "this.set(\" message\" , this.counter + \" clicks left\" );" in output
192
- output = cat_app_file_on_simulator ("TNSApp " , "app/app.css" )
198
+ output = cat_app_file_on_simulator ("appTest " , "app/app.css" )
193
199
assert "font-size: 20;" in output
194
200
195
- output = cat_app_file_on_simulator ("TNSApp " , "app/tns_modules/LICENSE" )
201
+ output = cat_app_file_on_simulator ("appTest " , "app/tns_modules/LICENSE" )
196
202
assert "Copyright (c) 9999 Telerik AD" in output
197
- output = cat_app_file_on_simulator ("TNSApp " , \
203
+ output = cat_app_file_on_simulator ("appTest " , \
198
204
"app/tns_modules/application/application-common.js" )
199
205
assert "require(\" globals\" ); // test" in output
200
-
201
- # https://github.com/NativeScript/nativescript-cli/issues/1225
202
- # def test_301_livesync_ios_simulator_before_run(self):
203
- # print "~~~ Killing subprocess ..."
204
- # self.process.terminate()
205
- #
206
- # time.sleep(2)
207
- # if psutil.pid_exists(self.process.pid):
208
- # print "~~~ Forced killing subprocess ..."
209
- # self.process.kill()
210
- #
211
- # cleanup_folder('appTest')
212
- # create_project(proj_name="appTest")
213
- # platform_add(platform="ios", framework_path=IOS_RUNTIME_SYMLINK_PATH, \
214
- # path="appTest", symlink=True)
215
- # build(platform="ios", path="appTest")
216
- #
217
- # # replace
218
- # replace("appTest/app/main-page.xml", "TAP", "TEST")
219
- # replace("appTest/app/main-view-model.js", "taps", "clicks")
220
- # replace("appTest/app/app.css", "30", "20")
221
- #
222
- # replace("appTest/node_modules/tns-core-modules/LICENSE", "2015", "9999")
223
- # replace(
224
- # "appTest/node_modules/tns-core-modules/application/application-common.js",
225
- # "(\"globals\");", "(\"globals\"); // test")
226
- #
227
- # livesync(platform="ios", emulator=True, path="appTest")
228
- # self.wait_for_text_in_output("prepared")
229
- # time.sleep(2)
230
- #
231
- # output = cat_app_file_on_simulator("appTest", "app/main-page.xml")
232
- # assert "<Button text=\"TEST\" tap=\"{{ tapAction }}\" />" in output
233
- # output = cat_app_file_on_simulator("appTest", "app/main-view-model.js")
234
- # assert "this.set(\"message\", this.counter + \" clicks left\");" in output
235
- # output = cat_app_file_on_simulator("appTest", "app/app.css")
236
- # assert "font-size: 20;" in output
237
- #
238
- # output = cat_app_file_on_simulator("appTest", "app/tns_modules/LICENSE")
239
- # assert "Copyright (c) 9999 Telerik AD" in output
240
- # output = cat_app_file_on_simulator("appTest", \
241
- # "app/tns_modules/application/application-common.js")
242
- # assert "require(\"globals\"); // test" in output
0 commit comments