本文整理汇总了Python中core.tns.tns.Tns.wait_for_log方法的典型用法代码示例。如果您正苦于以下问题:Python Tns.wait_for_log方法的具体用法?Python Tns.wait_for_log怎么用?Python Tns.wait_for_log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.tns.tns.Tns
的用法示例。
在下文中一共展示了Tns.wait_for_log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_370_tns_run_android_with_jar_and_aar_files_in_app_res
# 需要导入模块: from core.tns.tns import Tns [as 别名]
# 或者: from core.tns.tns.Tns import wait_for_log [as 别名]
def test_370_tns_run_android_with_jar_and_aar_files_in_app_res(self):
"""
App should not crash when reference .jar or/and .aar file in App_Resources/Android/libs
https://github.com/NativeScript/android-runtime/issues/899
"""
# Create libs/ in app/App_resources/, add .jar and .aar files in it and modify the app to reference them
curr_folder = os.getcwd()
Folder.navigate_to(os.path.join(self.app_name, 'app', 'App_Resources', 'Android'))
Folder.create("libs")
app_res_libs = os.path.join(self.app_name, 'app', 'App_Resources', 'Android', 'libs')
Folder.navigate_to(curr_folder)
custom_jar_file = os.path.join('data', 'issues', 'android-runtime-pr-905', 'customLib.jar')
custom_aar_file = os.path.join('data', 'issues', 'android-runtime-899', 'mylibrary.aar')
File.copy(src=custom_jar_file, dest=app_res_libs)
File.copy(src=custom_aar_file, dest=app_res_libs)
source = os.path.join('data', 'issues', 'android-runtime-899', 'app.js')
target = os.path.join(self.app_name, 'app', 'app.js')
File.copy(src=source, dest=target)
# `tns run android` and wait until app is deployed
log = Tns.run_android(attributes={'--path': self.app_name, '--device': EMULATOR_ID}, wait=False,
assert_success=False)
strings = ['Project successfully built',
'Successfully installed on device with identifier', EMULATOR_ID,
'Successfully synced application']
Tns.wait_for_log(log_file=log, string_list=strings, timeout=180, check_interval=10)
# Verify app looks correct inside emulator
Device.screen_match(device_name=EMULATOR_NAME, device_id=EMULATOR_ID,
expected_image='livesync-hello-world_home')
示例2: test_181_tns_run_android_console_dir
# 需要导入模块: from core.tns.tns import Tns [as 别名]
# 或者: from core.tns.tns.Tns import wait_for_log [as 别名]
def test_181_tns_run_android_console_dir(self):
"""
Test console.dir() of different objects.
"""
# Change main-page.js so it contains console logging
source_js = os.path.join('data', 'console-dir', 'main-page.js')
target_js = os.path.join(self.app_name, 'app', 'main-page.js')
File.copy(src=source_js, dest=target_js)
log = Tns.run_android(attributes={'--path': self.app_name, '--device': EMULATOR_ID}, wait=False,
assert_success=False)
strings = ['Project successfully built',
'Successfully installed on device with identifier', EMULATOR_ID,
'Successfully synced application',
"true",
"false",
"null",
"undefined",
"-1",
"text",
"==== object dump start ====",
"name: \"John\"",
"age: \"34\"",
"==== object dump end ====",
self.max_long_string
]
Tns.wait_for_log(log_file=log, string_list=strings, timeout=180, check_interval=10)
assert self.very_long_string not in log
示例3: test_360_tns_run_android_with_jar_file_in_plugin
# 需要导入模块: from core.tns.tns import Tns [as 别名]
# 或者: from core.tns.tns.Tns import wait_for_log [as 别名]
def test_360_tns_run_android_with_jar_file_in_plugin(self):
"""
App should not crash when reference .jar file in some plugin
https://github.com/NativeScript/android-runtime/pull/905
"""
# Add .jar file in plugin and modify the app to reference it
custom_jar_file = os.path.join('data', 'issues', 'android-runtime-pr-905', 'customLib.jar')
modules_widgets = os.path.join(self.app_name, 'node_modules', 'tns-core-modules-widgets', 'platforms',
'android')
File.copy(src=custom_jar_file, dest=modules_widgets)
source = os.path.join('data', 'issues', 'android-runtime-pr-905', 'app.js')
target = os.path.join(self.app_name, 'app', 'app.js')
File.copy(src=source, dest=target)
# `tns run android` and wait until app is deployed
log = Tns.run_android(attributes={'--path': self.app_name, '--device': EMULATOR_ID}, wait=False,
assert_success=False)
strings = ['Project successfully built',
'Successfully installed on device with identifier', EMULATOR_ID,
'Successfully synced application']
Tns.wait_for_log(log_file=log, string_list=strings, timeout=180, check_interval=10)
# Verify app looks correct inside emulator
Device.screen_match(device_name=EMULATOR_NAME, device_id=EMULATOR_ID,
expected_image='livesync-hello-world_home')
示例4: test_200_tns_run_android_extending_class_inside_file_containing_dots
# 需要导入模块: from core.tns.tns import Tns [as 别名]
# 或者: from core.tns.tns.Tns import wait_for_log [as 别名]
def test_200_tns_run_android_extending_class_inside_file_containing_dots(self):
"""Test for https://github.com/NativeScript/android-runtime/issues/761"""
# Copy the app folder (app is modified in order to get some console logs on loaded)
source = os.path.join('data', 'apps', 'livesync-hello-world-ng', 'src')
target = os.path.join(self.app_name, 'src')
Folder.cleanup(target)
Folder.copy(src=source, dst=target)
source_html = os.path.join('data', 'issues', 'android-runtime-761', 'items.component.html')
target_html = os.path.join(self.app_name, 'src', 'app', 'item', 'items.component.html')
File.copy(src=source_html, dest=target_html)
source_ts = os.path.join('data', 'issues', 'android-runtime-761', 'items.component.ts')
target_ts = os.path.join(self.app_name, 'src', 'app', 'item', 'items.component.ts')
File.copy(src=source_ts, dest=target_ts)
source_xml = os.path.join('data', 'issues', 'android-runtime-761', 'AndroidManifest.xml')
target_xml = os.path.join(self.app_name, 'App_Resources', 'Android', 'src', 'main', 'AndroidManifest.xml')
File.copy(src=source_xml, dest=target_xml)
# Verify the app is running
log = Tns.run_android(attributes={'--path': self.app_name, '--device': EMULATOR_ID}, wait=False,
assert_success=False)
strings = ['Project successfully built',
'Successfully installed on device with identifier', EMULATOR_ID,
'Successfully synced application']
Tns.wait_for_log(log_file=log, string_list=strings, timeout=180, check_interval=10)
示例5: test_280_tns_run_android_console_time
# 需要导入模块: from core.tns.tns import Tns [as 别名]
# 或者: from core.tns.tns.Tns import wait_for_log [as 别名]
def test_280_tns_run_android_console_time(self):
# Copy the app folder (app is modified in order to get some console logs on loaded)
source = os.path.join('data', 'apps', 'livesync-hello-world-ng', 'src')
target = os.path.join(self.app_name, 'src')
Folder.cleanup(target)
Folder.copy(src=source, dst=target)
# Replace app.component.ts to use console.time() and console.timeEnd()
source = os.path.join('data', 'issues', 'ios-runtime-843', 'app.component.ts')
target = os.path.join(self.app_name, 'src', 'app', 'app.component.ts')
File.copy(src=source, dest=target)
# `tns run android` and wait until app is deployed
log = Tns.run_android(attributes={'--path': self.app_name, '--device': EMULATOR_ID}, wait=False,
assert_success=False)
# Verify the app is running
strings = ['Successfully synced application',
'Application loaded!',
'Home page loaded!']
Tns.wait_for_log(log_file=log, string_list=strings, timeout=180, check_interval=10, clean_log=False)
# Verify initial state of the app
Device.screen_match(device_name=EMULATOR_NAME, device_id=EMULATOR_ID,
expected_image='ng-hello-world-home-white', tolerance=5.0)
# Verify console.time() works
console_time = ['JS: startup:']
Tns.wait_for_log(log_file=log, string_list=console_time)
示例6: test_181_tns_run_ios_console_dir
# 需要导入模块: from core.tns.tns import Tns [as 别名]
# 或者: from core.tns.tns.Tns import wait_for_log [as 别名]
def test_181_tns_run_ios_console_dir(self):
"""
Test console.dir() of different objects.
"""
# Change main-page.js so it contains console logging
source_js = os.path.join('data', 'console-dir', 'main-page.js')
target_js = os.path.join(self.app_name, 'app', 'main-page.js')
File.copy(src=source_js, dest=target_js)
john_obj = "==== object dump start ====\n" \
"name: John\n" \
"age: 34\n" \
"==== object dump end ===="
log = Tns.run_ios(attributes={'--path': self.app_name, '--emulator': ''}, wait=False, assert_success=False)
strings = ['Project successfully built',
'Successfully installed on device with identifier', self.SIMULATOR_ID,
"true",
"false",
"null",
"undefined",
"-1",
"text",
self.max_long_string,
john_obj
]
Tns.wait_for_log(log_file=log, string_list=strings, timeout=150, check_interval=10)
assert self.very_long_string not in log
示例7: test_210_tns_run_android_add_remove_files_and_folders
# 需要导入模块: from core.tns.tns import Tns [as 别名]
# 或者: from core.tns.tns.Tns import wait_for_log [as 别名]
def test_210_tns_run_android_add_remove_files_and_folders(self):
"""
New files and folders should be synced properly.
"""
log = Tns.run_android(attributes={'--path': self.app_name, '--device': self.DEVICE_ID}, wait=False,
assert_success=False)
strings = ['Successfully synced application', self.DEVICE_ID]
Tns.wait_for_log(log_file=log, string_list=strings, timeout=120, check_interval=10)
# Add new files
new_file_name = 'main-page2.xml'
source_file = os.path.join(self.app_name, 'app', 'main-page.xml')
destination_file = os.path.join(self.app_name, 'app', new_file_name)
File.copy(source_file, destination_file)
strings = ['Successfully transferred main-page2.xml', 'Successfully synced application', self.DEVICE_ID]
Tns.wait_for_log(log_file=log, string_list=strings)
# Verify new file is synced and available on device.
error_message = 'Newly created file {0} not found on {1}'.format(new_file_name, self.DEVICE_ID)
app_id = Tns.get_app_id(app_name=self.app_name)
path = 'app/{0}'.format(new_file_name)
assert Adb.path_exists(device_id=self.DEVICE_ID, package_id=app_id, path=path), error_message
# Revert changes(rename file and delete file)
File.copy(destination_file, source_file)
File.remove(destination_file)
strings = ['Successfully transferred main-page.xml', 'Successfully synced application', self.DEVICE_ID]
Tns.wait_for_log(log_file=log, string_list=strings)
# Verify new file is synced and available on device.
error_message = '{0} was deleted, but still available on {1}'.format(new_file_name, self.DEVICE_ID)
assert Adb.path_does_not_exist(device_id=self.DEVICE_ID, package_id=app_id, path=path), error_message
# Add folder
new_folder_name = 'feature2'
source_file = os.path.join(self.app_name, 'app', 'feature1')
destination_file = os.path.join(self.app_name, 'app', new_folder_name)
Folder.copy(source_file, destination_file)
strings = ['Successfully transferred', 'Successfully transferred', 'feature1.js', self.DEVICE_ID]
Tns.wait_for_log(log_file=log, string_list=strings)
# Verify new folder is synced and available on device.
error_message = 'Newly created folder {0} not found on {1}'.format(new_folder_name, self.DEVICE_ID)
path = 'app/{0}'.format(new_folder_name)
assert Adb.path_exists(device_id=self.DEVICE_ID, package_id=app_id, path=path, timeout=20), error_message
path = 'app/{0}/{1}'.format(new_folder_name, 'feature1.js')
assert Adb.path_exists(device_id=self.DEVICE_ID, package_id=app_id, path=path, timeout=20), error_message
# Delete folder
Folder.cleanup(destination_file)
strings = ['Successfully synced application', self.DEVICE_ID]
Tns.wait_for_log(log_file=log, string_list=strings)
# Verify new folder is deleted from device.
error_message = 'Deleted folder {0} is still available on {1}'.format(new_folder_name, self.DEVICE_ID)
assert Adb.path_does_not_exist(device_id=self.DEVICE_ID, package_id=app_id, path=path), error_message
示例8: test_001_android_run_hmr
# 需要导入模块: from core.tns.tns import Tns [as 别名]
# 或者: from core.tns.tns.Tns import wait_for_log [as 别名]
def test_001_android_run_hmr(self):
log = Tns.run_android(attributes={'--path': self.app_name, '--device': EMULATOR_ID, '--hmr': ''}, wait=False,
assert_success=False)
Tns.wait_for_log(log_file=log, string_list=HelpersHMR.run_hmr, not_existing_string_list=HelpersHMR.errors_hmr,
timeout=240)
Helpers.android_screen_match(image=HelpersHMR.image_original, timeout=120)
HelpersHMR.apply_changes(app_name=self.app_name, log=log, platform=Platform.ANDROID)
HelpersHMR.revert_changes(app_name=self.app_name, log=log, platform=Platform.ANDROID)
示例9: test_008_ios_run_hmr_console_log
# 需要导入模块: from core.tns.tns import Tns [as 别名]
# 或者: from core.tns.tns.Tns import wait_for_log [as 别名]
def test_008_ios_run_hmr_console_log(self):
source_js = os.path.join('data', "issues", 'console-log-hmr', 'main-view-model.js')
target_js = os.path.join(self.app_name, 'app', 'main-view-model.js')
File.copy(src=source_js, dest=target_js)
log = Tns.run_ios(attributes={'--path': self.app_name, '--emulator': '', '--hmr': ''}, wait=False,
assert_success=False)
strings = ['LOG Hello']
Tns.wait_for_log(log_file=log, string_list=strings)
Helpers.ios_screen_match(sim_id=self.SIMULATOR_ID, image=HelpersHMR.image_original, timeout=120)
示例10: test_009_android_run_hmr_delete_file
# 需要导入模块: from core.tns.tns import Tns [as 别名]
# 或者: from core.tns.tns.Tns import wait_for_log [as 别名]
def test_009_android_run_hmr_delete_file(self):
log = Tns.run_android(attributes={'--path': self.app_name, '--device': EMULATOR_ID, '--hmr': ''}, wait=False,
assert_success=False)
Tns.wait_for_log(log_file=log, string_list=HelpersHMR.wp_run, not_existing_string_list=HelpersHMR.wp_errors,
timeout=240)
HelpersHMR.android_screen_match(image=self.image_original, timeout=120)
File.remove(self.app_name + 'app', 'main-view-model.js')
self.apply_changes(app_name=self.app_name, log=log, platform=Platform.ANDROID)
self.revert_changes(app_name=self.app_name, log=log, platform=Platform.ANDROID)
示例11: __verify_debugger_attach
# 需要导入模块: from core.tns.tns import Tns [as 别名]
# 或者: from core.tns.tns.Tns import wait_for_log [as 别名]
def __verify_debugger_attach(log, app_started=True):
strings = ["Frontend client connected", "Backend socket created", "NativeScript debugger attached"]
Tns.wait_for_log(log_file=log, string_list=strings, timeout=90, check_interval=10, clean_log=False)
time.sleep(10)
output = File.read(log)
assert "Frontend socket closed" not in output
assert "Backend socket closed" not in output
assert "NativeScript debugger detached" not in output
assert Process.is_running('NativeScript Inspector')
if app_started:
assert "Page loaded 1 time" in output, "Page not reloaded, this is bug!"
else:
assert "Page loaded 1 time" not in output, "Page reloaded, this is bug!"
示例12: test_008_android_run_hmr_console_log
# 需要导入模块: from core.tns.tns import Tns [as 别名]
# 或者: from core.tns.tns.Tns import wait_for_log [as 别名]
def test_008_android_run_hmr_console_log(self):
source_js = os.path.join('data', "issues", 'console-log-hmr', 'main-view-model.js')
target_js = os.path.join(self.app_name, 'app', 'main-view-model.js')
File.copy(src=source_js, dest=target_js)
log = Tns.run_android(attributes={'--path': self.app_name, '--device': EMULATOR_ID, '--hmr': ''}, wait=False,
assert_success=False)
strings = ['LOG Hello']
Tns.wait_for_log(log_file=log, string_list=strings, timeout=120, check_interval=10)
# Verify app looks correct inside emulator
Device.screen_match(device_name=EMULATOR_NAME, device_id=EMULATOR_ID,
expected_image=HelpersHMR.image_original)
示例13: test_400_tns_run_ios_should_not_crash_when_uninstall_app
# 需要导入模块: from core.tns.tns import Tns [as 别名]
# 或者: from core.tns.tns.Tns import wait_for_log [as 别名]
def test_400_tns_run_ios_should_not_crash_when_uninstall_app(self):
"""
`tns run ios` should work properly even if I manually uninstall the app (test for issue #3007)
"""
# `tns run ios` and wait until app is deployed
log = Tns.run_ios(attributes={'--path': self.app_name, "--device": self.DEVICE_ID}, wait=False,
assert_success=False)
strings = [self.DEVICE_ID, 'Successfully synced application']
Tns.wait_for_log(log_file=log, string_list=strings, timeout=180, check_interval=10)
# Verify app is running
assert Device.wait_for_text(device_id=self.DEVICE_ID, text="taps left"), "App failed to load!"
assert Device.wait_for_text(device_id=self.DEVICE_ID, text="TAP"), "App failed to load!"
# Change JS and wait until app is synced
ReplaceHelper.replace(self.app_name, ReplaceHelper.CHANGE_JS, sleep=3)
strings = ['Successfully transferred', 'main-view-model.js', 'Successfully synced application', self.DEVICE_ID]
Tns.wait_for_log(log_file=log, string_list=strings)
assert Device.wait_for_text(device_id=self.DEVICE_ID, text="clicks"), "JS changes not synced on device!"
# Uninstall app while `tns run` is running
Device.uninstall_app(app_prefix='org.nativescript.', platform=Platform.IOS)
sleep(10)
# Change XML and wait until app is synced
Tns.wait_for_log(log_file=log, string_list=[], timeout=30) # Just to cleanup log file
ReplaceHelper.replace(self.app_name, ReplaceHelper.CHANGE_XML, sleep=10)
strings = ['Successfully installed', 'Successfully synced application']
Tns.wait_for_log(log_file=log, string_list=strings, timeout=180, check_interval=10)
assert Device.wait_for_text(device_id=self.DEVICE_ID, text="TEST"), "XML changes not synced on device!"
示例14: test_330_tns_run_ios_after_rebuild_of_native_project
# 需要导入模块: from core.tns.tns import Tns [as 别名]
# 或者: from core.tns.tns.Tns import wait_for_log [as 别名]
def test_330_tns_run_ios_after_rebuild_of_native_project(self):
"""
`tns run ios` should work properly after rebuild of native project (test for issue #2860)
"""
# `tns run ios` and wait until app is deployed
log = Tns.run_ios(attributes={'--path': self.app_name, '--device': self.DEVICE_ID}, wait=False,
assert_success=False, log_trace=True)
strings = [self.DEVICE_ID, 'Successfully synced application']
Tns.wait_for_log(log_file=log, string_list=strings, timeout=120, check_interval=10)
# Verify app is running
assert Device.wait_for_text(device_id=self.DEVICE_ID, text="Tap the button"), "App failed to load!"
# Update native project
config_path = os.path.join(self.app_name, 'app', 'App_Resources', 'iOS', 'build.xcconfig')
File.replace(file_path=config_path, str1='More info', str2='If you need more info')
strings = ['ARCHIVE SUCCEEDED', 'Successfully synced application', self.DEVICE_ID, 'CONSOLE LOG']
not_existing_strings = ['Unable to sync files', 'Multiple errors were thrown']
Tns.wait_for_log(log_file=log, string_list=strings, not_existing_string_list=not_existing_strings, timeout=120)
# Verify app is running
assert Device.wait_for_text(device_id=self.DEVICE_ID, text="Tap the button"), "App failed to load!"
# Change JS and wait until app is synced
ReplaceHelper.replace(self.app_name, ReplaceHelper.CHANGE_JS, sleep=10)
strings = ['Successfully transferred', 'main-view-model.js', 'Successfully synced application', self.DEVICE_ID]
Tns.wait_for_log(log_file=log, string_list=strings)
assert Device.wait_for_text(device_id=self.DEVICE_ID, text="clicks"), "JS changes not synced on device!"
# Rollback all the changes and verify files are synced
ReplaceHelper.rollback(self.app_name, ReplaceHelper.CHANGE_JS, sleep=10)
strings = ['Successfully transferred', 'main-view-model.js', 'Restarting application']
Tns.wait_for_log(log_file=log, string_list=strings)
assert Device.wait_for_text(device_id=self.DEVICE_ID, text="taps left"), "JS changes not synced on device!"
示例15: test_001_ios_run_hmr
# 需要导入模块: from core.tns.tns import Tns [as 别名]
# 或者: from core.tns.tns.Tns import wait_for_log [as 别名]
def test_001_ios_run_hmr(self):
log = Tns.run_ios(attributes={'--path': self.app_name, '--emulator': '', '--hmr': ''}, wait=False,
assert_success=False)
Tns.wait_for_log(log_file=log, string_list=HelpersHMR.run_hmr, not_existing_string_list=HelpersHMR.errors_hmr,
timeout=240)
Helpers.ios_screen_match(sim_id=self.SIMULATOR_ID, image=HelpersHMR.image_original, timeout=120)
Helpers.wait_webpack_watcher()
HelpersHMR.apply_changes(app_name=self.app_name, log=log, platform=Platform.IOS)
Helpers.ios_screen_match(sim_id=self.SIMULATOR_ID, image=HelpersHMR.image_change,
timeout=120)
HelpersHMR.revert_changes(app_name=self.app_name, log=log, platform=Platform.IOS)
Helpers.ios_screen_match(sim_id=self.SIMULATOR_ID, image=HelpersHMR.image_original,
timeout=120)