Skip to content

Commit 38960df

Browse files
committed
1 parent 5a237b9 commit 38960df

File tree

2 files changed

+54
-2
lines changed

2 files changed

+54
-2
lines changed

core/tns/tns.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ def wait_for_log(log_file, string_list, not_existing_string_list=None, timeout=3
496496
pass
497497
else:
498498
for item in not_existing_string_list:
499-
assert item not in log, "{0} found! It should not be in logs."
499+
assert item not in log, "{0} found! It should not be in logs.".format(item)
500500
else:
501501
print "##### OUTPUT BEGIN #####\n"
502502
print log

tests/device/run_ios_tests.py

+53-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def test_001_tns_run_ios_js_css_xml(self):
8181

8282
# Verify app is running
8383
assert Device.wait_for_text(device_id=self.DEVICE_ID, text="taps left"), "App failed to load!"
84-
assert Device.wait_for_text(device_id=self.DEVICE_ID, text="TAP"), "XML changes not synced on device!"
84+
assert Device.wait_for_text(device_id=self.DEVICE_ID, text="TAP"), "App failed to load!"
8585

8686
# Verify Simulator is not started
8787
assert not Simulator.is_running()[0], 'Device is attached, but emulator is also started after `tns run ios`!'
@@ -198,3 +198,55 @@ def test_320_tns_run_ios_specific_device(self):
198198
for device_id in self.DEVICES:
199199
assert device_id not in output, \
200200
'Application is deployed on {0} while it should be only on {1}'.format(device_id, self.SIMULATOR_ID)
201+
202+
def test_330_tns_run_ios_after_rebuild_of_native_project(self):
203+
"""
204+
`tns run ios` should work properly after rebuild of native project (test for issue #2860)
205+
"""
206+
207+
# `tns run ios` and wait until app is deployed
208+
log = Tns.run_ios(attributes={'--path': self.app_name, '--device': self.DEVICE_ID}, wait=False,assert_success=False)
209+
strings = ['Project successfully built',
210+
'Successfully installed on device with identifier', self.DEVICE_ID,
211+
'Successfully synced application']
212+
Tns.wait_for_log(log_file=log, string_list=strings, timeout=120, check_interval=10)
213+
214+
# Verify app is running
215+
assert Device.wait_for_text(device_id=self.DEVICE_ID, text="taps left"), "App failed to load!"
216+
assert Device.wait_for_text(device_id=self.DEVICE_ID, text="TAP"), "App failed to load!"
217+
218+
# Update native project
219+
config_path = os.path.join(self.app_name, 'app', 'App_Resources', 'iOS', 'build.xcconfig')
220+
File.replace(file_path=config_path, str1='More info', str2='If you need more info')
221+
strings = ['BUILD SUCCEEDED', 'Successfully synced application', self.DEVICE_ID]
222+
Tns.wait_for_log(log_file=log, string_list=strings, timeout=120)
223+
224+
# Verify app is running
225+
assert Device.wait_for_text(device_id=self.DEVICE_ID, text="taps left"), "App failed to load!"
226+
assert Device.wait_for_text(device_id=self.DEVICE_ID, text="TAP"), "App failed to load!"
227+
228+
# Kill livesync process
229+
Process.kill(proc_name='node', proc_cmdline='tns')
230+
231+
# `tns run ios` and again and verify sync works without issues
232+
log = Tns.run_ios(attributes={'--path': self.app_name, '--device': self.DEVICE_ID}, wait=False, assert_success=False)
233+
strings = ['Successfully synced application', 'CONSOLE LOG']
234+
not_existing_strings = ['Unable to sync files', 'Multiple errors were thrown', '.nsbuildinfo']
235+
Tns.wait_for_log(log_file=log, string_list=strings, not_existing_string_list=not_existing_strings, timeout=120)
236+
237+
# Verify app is running
238+
assert Device.wait_for_text(device_id=self.DEVICE_ID, text="taps left"), "App failed to load!"
239+
assert Device.wait_for_text(device_id=self.DEVICE_ID, text="TAP"), "App failed to load!"
240+
241+
# TODO: After changes app freeze, uncomment when it is fixed
242+
# Change JS and wait until app is synced
243+
# ReplaceHelper.replace(self.app_name, ReplaceHelper.CHANGE_JS, sleep=10)
244+
# strings = ['Successfully transferred', 'main-view-model.js', 'Successfully synced application', self.DEVICE_ID]
245+
# Tns.wait_for_log(log_file=log, string_list=strings)
246+
# assert Device.wait_for_text(device_id=self.DEVICE_ID, text="clicks"), "JS changes not synced on device!"
247+
248+
# Rollback all the changes and verify files are synced
249+
# ReplaceHelper.rollback(self.app_name, ReplaceHelper.CHANGE_JS, sleep=10)
250+
# strings = ['Successfully transferred', 'main-view-model.js', 'Refreshing application']
251+
# Tns.wait_for_log(log_file=log, string_list=strings)
252+
# assert Device.wait_for_text(device_id=self.DEVICE_ID, text="taps left"), "JS changes not synced on device!"

0 commit comments

Comments
 (0)