Skip to content

Commit 4f7e857

Browse files
committed
Extend test_200_tns_run_android_break_and_fix_app
Cover app crash/fix caused by missing app.js during livesync
1 parent 38a3ed5 commit 4f7e857

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.DS_Store
22
.idea
3+
app.js
34
*.pyc
45
/*.csv
56
/*.png

tests/emulator/run_android_tests.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from core.osutils.folder import Folder
2828
from core.osutils.os_type import OSType
2929
from core.settings.settings import ANDROID_RUNTIME_PATH, ANDROID_KEYSTORE_PATH, ANDROID_KEYSTORE_PASS, \
30-
ANDROID_KEYSTORE_ALIAS, ANDROID_KEYSTORE_ALIAS_PASS, EMULATOR_ID, EMULATOR_NAME, CURRENT_OS
30+
ANDROID_KEYSTORE_ALIAS, ANDROID_KEYSTORE_ALIAS_PASS, EMULATOR_ID, EMULATOR_NAME, CURRENT_OS, TEST_RUN_HOME
3131
from core.settings.strings import cannot_resolve_device, list_devices
3232
from core.tns.replace_helper import ReplaceHelper
3333
from core.tns.tns import Tns
@@ -179,6 +179,7 @@ def test_100_tns_run_android_release(self):
179179
def test_200_tns_run_android_break_and_fix_app(self):
180180
"""
181181
Make changes in xml that break the app and then changes that fix the app.
182+
Add/remove js files that break the app and then fix it.
182183
"""
183184

184185
log = Tns.run_android(attributes={'--path': self.app_name, '--device': EMULATOR_ID}, wait=False,
@@ -208,6 +209,22 @@ def test_200_tns_run_android_break_and_fix_app(self):
208209
Device.screen_match(device_name=EMULATOR_NAME, device_id=EMULATOR_ID,
209210
expected_image='livesync-hello-world_home')
210211

212+
# Move js files
213+
app_js_original_path = src=os.path.join(self.app_name, 'app', 'app.js')
214+
app_js_new_path = src = os.path.join(TEST_RUN_HOME, 'app.js')
215+
File.copy(src=app_js_original_path, dest=app_js_new_path)
216+
File.remove(file_path=app_js_original_path)
217+
strings = ['Successfully synced application', EMULATOR_ID]
218+
Tns.wait_for_log(log_file=log, string_list=strings, timeout=30, check_interval=10)
219+
220+
File.copy(src=app_js_new_path, dest=app_js_original_path)
221+
strings = ['Successfully synced application', 'app.js', EMULATOR_ID]
222+
Tns.wait_for_log(log_file=log, string_list=strings, timeout=30, check_interval=10)
223+
224+
# Verify app looks correct inside emulator
225+
Device.screen_match(device_name=EMULATOR_NAME, device_id=EMULATOR_ID,
226+
expected_image='livesync-hello-world_home')
227+
211228
def test_210_tns_run_android_add_remove_files_and_folders(self):
212229
"""
213230
New files and folders should be synced properly.

0 commit comments

Comments
 (0)