Skip to content

Merge Master in Release #481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ max-locals=15
max-parents=7

# Maximum number of public methods for a class (see R0904).
max-public-methods=30
max-public-methods=35

# Maximum number of return / yield for function / method body.
max-returns=6
Expand Down
15 changes: 14 additions & 1 deletion core/utils/device/adb.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def is_running(device_id):
return bool('mSurface=Surface' in result.output)

@staticmethod
def wait_until_boot(device_id, timeout=180, check_interval=3):
def wait_until_boot(device_id, timeout=250, check_interval=3):
"""
Wait android device/emulator is up and running.
:param device_id: Device identifier.
Expand Down Expand Up @@ -413,6 +413,19 @@ def kill_process(device_id, process_name):
assert result.output == "", "Process {0} not killed! Logs:{1}".format(process_name, result.output)
time.sleep(5)

@staticmethod
def kill_application(device_id, app_id, process_id):
"""
Stop application
:param device_id: Device identifier
:param app_id: Bundle identifier (example: org.nativescript.TestApp)
:param process_id: The id of the process
"""
Adb.run_adb_command(command='shell run-as {0} kill {1}'.format(app_id, process_id),
device_id=device_id, wait=True)
# wait application to be killed
time.sleep(2)

@staticmethod
def run_adb_as_root(device_id):
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/runtimes/android/android_plugins_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def test_453_support_Kotlin_with_jar_without_use_kotlin(self):
strings = ['Successfully synced application org.nativescript.TestApp on device ']
test_result = Wait.until(lambda: all(string in File.read(log.log_file) for string in strings), timeout=300,
period=5)
messages = "App with Kotlin enabled and kotlin jar not build correctly! Logs: "
messages = "App with Kotlin enabled and kotlin jar not build correctly! Logs: " + File.read(log.log_file)
assert test_result, messages + File.read(log.log_file)
self.assert_kotlin_is_working(self.emulator)
with open(ANALYTICS_FILE, "r") as read_file:
Expand Down Expand Up @@ -464,7 +464,7 @@ def test_454_support_gradle_properties_for_enable_Kotlin_with_kotlin_file(self):

test_result = Wait.until(lambda: all(string in File.read(log.log_file) for string in strings), timeout=300,
period=5)
messages = "App with Kotlin enabled and kotlin jar not build correctly! Logs: "
messages = "App with Kotlin enabled and kotlin jar not build correctly! Logs: " + File.read(log.log_file)
assert test_result, messages + File.read(log.log_file)
self.assert_kotlin_is_working(self.emulator)
with open(ANALYTICS_FILE, "r") as read_file:
Expand Down
36 changes: 18 additions & 18 deletions tests/runtimes/android/android_runtime_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,14 @@ def test_316_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
JS:.+at Observable\.viewModel\.onTap \(file: app\/main-view-model\.js:\d+:\d+\)
JS:.+at Button\.push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify \(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at Button\.push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit \(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at Object\.ClickListenerImpl\.onClick \(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
JS:.+at Object\.ClickListenerImpl\.onClick \(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
JS:.+### UNCAUGHT MESSAGE: Calling js method onClick failed
JS:.+Error: New Error!
JS:.+### Stack Trace Start
JS:.+### UNCAUGHT STACKTRACE:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
JS:.+at com\.tns\.Runtime\.callJSMethodNative\(Native Method\)
JS:.+at com\.tns\.Runtime\.dispatchCallJSMethodNative\(Runtime\.java:\d+\)
JS:.+at com\.tns\.Runtime\.callJSMethodImpl\(Runtime\.java:\d+\)
Expand All @@ -203,7 +203,7 @@ def test_316_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
JS:.+### UNCAUGHT STACK:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
""" # noqa: E501
else:
stack_trace = r"""JS:.+### CAUGHT MESSAGE: New Error!
Expand All @@ -215,14 +215,14 @@ def test_316_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
JS:.+at Observable\.viewModel\.onTap \(file: app\/main-view-model\.js:\d+:\d+\)
JS:.+at Button\.push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify \(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at Button\.push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit \(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at Object\.ClickListenerImpl\.onClick \(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
JS:.+at Object\.ClickListenerImpl\.onClick \(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
JS:.+### UNCAUGHT MESSAGE: Calling js method onClick failed
JS:.+Error: New Error!
JS:.+### Stack Trace Start
JS:.+### UNCAUGHT STACKTRACE:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
JS:.+at com\.tns\.Runtime\.callJSMethodNative\(Native Method\)
JS:.+at com\.tns\.Runtime\.dispatchCallJSMethodNative\(Runtime\.java:\d+\)
JS:.+at com\.tns\.Runtime\.callJSMethodImpl\(Runtime\.java:\d+\)
Expand All @@ -247,7 +247,7 @@ def test_316_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
JS:.+### UNCAUGHT STACK:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
""" # noqa: E501

strings = ["Error: New Error!", "UNCAUGHT STACKTRACE:"]
Expand Down Expand Up @@ -300,7 +300,7 @@ def test_317_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
JS:.+### CAUGHT STACKTRACE:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
JS:.+com\.tns\.Runtime\.resolveMethodOverload\(Runtime\.java:\d+\)
JS:.+com\.tns\.Runtime\.callJSMethodNative\(Native Method\)
JS:.+com\.tns\.Runtime\.dispatchCallJSMethodNative\(Runtime\.java:\d+\)
Expand All @@ -323,14 +323,14 @@ def test_317_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
JS:.+### CAUGHT STACK:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
JS: ### UNCAUGHT MESSAGE: Calling js method onClick failed
JS:.+Error: java\.lang\.Exception: Failed resolving method createTempFile on class java\.io\.File
JS:.+### Stack Trace Start
JS:.+### UNCAUGHT STACKTRACE:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
JS: .+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS: .+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS: .+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
JS: .+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
JS: .+at com\.tns\.Runtime\.callJSMethodNative\(Native Method\)
JS: .+at com\.tns\.Runtime\.dispatchCallJSMethodNative\(Runtime\.java:\d+\)
JS: .+at com\.tns\.Runtime\.callJSMethodImpl\(Runtime\.java:\d+\)
Expand All @@ -356,7 +356,7 @@ def test_317_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
JS:.+### UNCAUGHT STACK:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
""" # noqa: E501
else:
stack_trace = r"""
Expand All @@ -365,7 +365,7 @@ def test_317_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
JS:.+### CAUGHT STACKTRACE:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
JS:.+com\.tns\.Runtime\.resolveMethodOverload\(Runtime\.java:\d+\)
JS:.+com\.tns\.Runtime\.callJSMethodNative\(Native Method\)
JS:.+com\.tns\.Runtime\.dispatchCallJSMethodNative\(Runtime\.java:\d+\)
Expand All @@ -390,14 +390,14 @@ def test_317_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
JS:.+### CAUGHT STACK:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
JS: ### UNCAUGHT MESSAGE: Calling js method onClick failed
JS:.+Error: java\.lang\.Exception: Failed resolving method createTempFile on class java\.io\.File
JS:.+### Stack Trace Start
JS:.+### UNCAUGHT STACKTRACE:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
JS: .+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS: .+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS: .+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
JS: .+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
JS: .+at com\.tns\.Runtime\.callJSMethodNative\(Native Method\)
JS: .+at com\.tns\.Runtime\.dispatchCallJSMethodNative\(Runtime\.java:\d+\)
JS: .+at com\.tns\.Runtime\.callJSMethodImpl\(Runtime\.java:\d+\)
Expand Down Expand Up @@ -425,7 +425,7 @@ def test_317_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
JS:.+### UNCAUGHT STACK:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
""" # noqa: E501
strings = ["Error: java.lang.Exception: Failed resolving method createTempFile on class java.io.File",
"Caused by: java.lang.Exception: Failed resolving method createTempFile on class java.io.File"]
Expand Down Expand Up @@ -627,10 +627,10 @@ def test_440_tns_run_android_new_date_work_as_expected_when_changing_timezone(se
period=5)
assert test_result, "Select time zone Button is missing on the device"
Device.click(self.emulator, text="Select time zone")
test_result = Wait.until(lambda: Device.is_text_visible(self.emulator, "Los Angeles", True),
test_result = Wait.until(lambda: Device.is_text_visible(self.emulator, "Tijuana", True),
timeout=30, period=5)
assert test_result, "Los Angeles Button is missing on the device."
Device.click(self.emulator, text="Los Angeles")
Device.click(self.emulator, text="Tijuana")

else:
output = Adb.run_adb_command("shell am start -a android.settings.DATE_SETTINGS", self.emulator.id,
Expand All @@ -654,10 +654,10 @@ def test_440_tns_run_android_new_date_work_as_expected_when_changing_timezone(se
period=5)
assert test_result, "TAP Button is missing on the device"
Device.click(self.emulator, text="TAP", case_sensitive=True)
assert_result = Wait.until(lambda: "GMT-0800 (PST)" in File.read(log.log_file), timeout=240, period=5)
assert_result = Wait.until(lambda: "GMT-0700 (PDT)" in File.read(log.log_file), timeout=240, period=5)
assert assert_result, "Missing log for time! Logs: " + File.read(log.log_file)
# Generate regex for asserting date and time
date_to_find_los_angeles = los_angeles_time.strftime(r'%a %b %d %Y %H:.{2}:.{2}') + r" GMT\-0800 \(PST\)"
date_to_find_los_angeles = los_angeles_time.strftime(r'%a %b %d %Y %H:.{2}:.{2}') + r" GMT\-0700 \(PDT\)"
# Assert date time is correct
assert_result = Wait.until(lambda: re.search(date_to_find_los_angeles, File.read(log.log_file)), timeout=20,
period=5)
Expand Down
Loading