Skip to content

Commit ba4190e

Browse files
Vasil ChimevVasil Chimev
Vasil Chimev
authored and
Vasil Chimev
committed
Update test_301_livesync_ios_simulator_before_run.
NativeScript/nativescript-cli#1225
1 parent 41f87e6 commit ba4190e

File tree

1 file changed

+36
-11
lines changed

1 file changed

+36
-11
lines changed

tests/livesync_simulator.py

+36-11
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212

1313
from helpers._os_lib import cleanup_folder, replace, remove
1414
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
1616
from helpers.device import stop_emulators
1717
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
1920

2021

2122
class LiveSyncSimulator(unittest.TestCase):
@@ -29,11 +30,12 @@ def setUpClass(cls):
2930
stop_emulators()
3031
stop_simulators()
3132

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')
3435

35-
start_simulator('iPhone 6s 90')
36+
start_simulator(SIMULATOR_NAME)
3637
cleanup_folder('TNS_App')
38+
cleanup_folder('appTest')
3739

3840
# setup app
3941
create_project(proj_name="TNS_App", copy_from="data/apps/livesync-hello-world")
@@ -81,6 +83,7 @@ def tearDownClass(cls):
8183

8284
stop_simulators()
8385
cleanup_folder('TNS_App')
86+
cleanup_folder('appTest')
8487

8588
def wait_for_text_in_output(self, text):
8689
def read_loop():
@@ -220,13 +223,35 @@ def test_301_livesync_ios_simulator_before_run(self):
220223
print "~~~ Forced killing subprocess ..."
221224
self.process.kill()
222225

223-
cleanup_folder('TNS_App')
224-
create_project(proj_name="TNS_App")
226+
cleanup_folder('appTest')
227+
create_project(proj_name="appTest")
225228
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")
227231

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")
230236

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")
232247
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

Comments
 (0)