Skip to content

Commit cc4670e

Browse files
author
Vasil Hristov
authored
Merge Master in Release (#481)
* add logs (#475) * Fix error activity test (#476) * Fix Api29 tests. Fix changing of time zone tests. increase the time for waiting an emulator. (#478) * Fix Api29 tests. Fix changing of time zone tests. increase the time for waiting an emulator. * Change max-public-methods value * Fix regex checks missing android class. (#480)
1 parent 717824d commit cc4670e

File tree

6 files changed

+42
-27
lines changed

6 files changed

+42
-27
lines changed

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ max-locals=15
530530
max-parents=7
531531

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

535535
# Maximum number of return / yield for function / method body.
536536
max-returns=6

core/utils/device/adb.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def is_running(device_id):
118118
return bool('mSurface=Surface' in result.output)
119119

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

416+
@staticmethod
417+
def kill_application(device_id, app_id, process_id):
418+
"""
419+
Stop application
420+
:param device_id: Device identifier
421+
:param app_id: Bundle identifier (example: org.nativescript.TestApp)
422+
:param process_id: The id of the process
423+
"""
424+
Adb.run_adb_command(command='shell run-as {0} kill {1}'.format(app_id, process_id),
425+
device_id=device_id, wait=True)
426+
# wait application to be killed
427+
time.sleep(2)
428+
416429
@staticmethod
417430
def run_adb_as_root(device_id):
418431
"""

tests/runtimes/android/android_plugins_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ def test_453_support_Kotlin_with_jar_without_use_kotlin(self):
422422
strings = ['Successfully synced application org.nativescript.TestApp on device ']
423423
test_result = Wait.until(lambda: all(string in File.read(log.log_file) for string in strings), timeout=300,
424424
period=5)
425-
messages = "App with Kotlin enabled and kotlin jar not build correctly! Logs: "
425+
messages = "App with Kotlin enabled and kotlin jar not build correctly! Logs: " + File.read(log.log_file)
426426
assert test_result, messages + File.read(log.log_file)
427427
self.assert_kotlin_is_working(self.emulator)
428428
with open(ANALYTICS_FILE, "r") as read_file:
@@ -464,7 +464,7 @@ def test_454_support_gradle_properties_for_enable_Kotlin_with_kotlin_file(self):
464464

465465
test_result = Wait.until(lambda: all(string in File.read(log.log_file) for string in strings), timeout=300,
466466
period=5)
467-
messages = "App with Kotlin enabled and kotlin jar not build correctly! Logs: "
467+
messages = "App with Kotlin enabled and kotlin jar not build correctly! Logs: " + File.read(log.log_file)
468468
assert test_result, messages + File.read(log.log_file)
469469
self.assert_kotlin_is_working(self.emulator)
470470
with open(ANALYTICS_FILE, "r") as read_file:

tests/runtimes/android/android_runtime_tests.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,14 @@ def test_316_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
173173
JS:.+at Observable\.viewModel\.onTap \(file: app\/main-view-model\.js:\d+:\d+\)
174174
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+\)
175175
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+\)
176-
JS:.+at Object\.ClickListenerImpl\.onClick \(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
176+
JS:.+at Object\.ClickListenerImpl\.onClick \(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
177177
JS:.+### UNCAUGHT MESSAGE: Calling js method onClick failed
178178
JS:.+Error: New Error!
179179
JS:.+### Stack Trace Start
180180
JS:.+### UNCAUGHT STACKTRACE:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
181181
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
182182
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
183-
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
183+
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
184184
JS:.+at com\.tns\.Runtime\.callJSMethodNative\(Native Method\)
185185
JS:.+at com\.tns\.Runtime\.dispatchCallJSMethodNative\(Runtime\.java:\d+\)
186186
JS:.+at com\.tns\.Runtime\.callJSMethodImpl\(Runtime\.java:\d+\)
@@ -203,7 +203,7 @@ def test_316_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
203203
JS:.+### UNCAUGHT STACK:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
204204
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
205205
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
206-
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
206+
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
207207
""" # noqa: E501
208208
else:
209209
stack_trace = r"""JS:.+### CAUGHT MESSAGE: New Error!
@@ -215,14 +215,14 @@ def test_316_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
215215
JS:.+at Observable\.viewModel\.onTap \(file: app\/main-view-model\.js:\d+:\d+\)
216216
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+\)
217217
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+\)
218-
JS:.+at Object\.ClickListenerImpl\.onClick \(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
218+
JS:.+at Object\.ClickListenerImpl\.onClick \(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
219219
JS:.+### UNCAUGHT MESSAGE: Calling js method onClick failed
220220
JS:.+Error: New Error!
221221
JS:.+### Stack Trace Start
222222
JS:.+### UNCAUGHT STACKTRACE:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
223223
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
224224
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
225-
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
225+
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
226226
JS:.+at com\.tns\.Runtime\.callJSMethodNative\(Native Method\)
227227
JS:.+at com\.tns\.Runtime\.dispatchCallJSMethodNative\(Runtime\.java:\d+\)
228228
JS:.+at com\.tns\.Runtime\.callJSMethodImpl\(Runtime\.java:\d+\)
@@ -247,7 +247,7 @@ def test_316_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
247247
JS:.+### UNCAUGHT STACK:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
248248
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
249249
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
250-
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
250+
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
251251
""" # noqa: E501
252252

253253
strings = ["Error: New Error!", "UNCAUGHT STACKTRACE:"]
@@ -300,7 +300,7 @@ def test_317_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
300300
JS:.+### CAUGHT STACKTRACE:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
301301
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
302302
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
303-
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
303+
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
304304
JS:.+com\.tns\.Runtime\.resolveMethodOverload\(Runtime\.java:\d+\)
305305
JS:.+com\.tns\.Runtime\.callJSMethodNative\(Native Method\)
306306
JS:.+com\.tns\.Runtime\.dispatchCallJSMethodNative\(Runtime\.java:\d+\)
@@ -323,14 +323,14 @@ def test_317_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
323323
JS:.+### CAUGHT STACK:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
324324
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
325325
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
326-
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
326+
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
327327
JS: ### UNCAUGHT MESSAGE: Calling js method onClick failed
328328
JS:.+Error: java\.lang\.Exception: Failed resolving method createTempFile on class java\.io\.File
329329
JS:.+### Stack Trace Start
330330
JS:.+### UNCAUGHT STACKTRACE:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
331331
JS: .+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
332332
JS: .+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
333-
JS: .+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
333+
JS: .+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
334334
JS: .+at com\.tns\.Runtime\.callJSMethodNative\(Native Method\)
335335
JS: .+at com\.tns\.Runtime\.dispatchCallJSMethodNative\(Runtime\.java:\d+\)
336336
JS: .+at com\.tns\.Runtime\.callJSMethodImpl\(Runtime\.java:\d+\)
@@ -356,7 +356,7 @@ def test_317_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
356356
JS:.+### UNCAUGHT STACK:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
357357
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
358358
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
359-
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
359+
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
360360
""" # noqa: E501
361361
else:
362362
stack_trace = r"""
@@ -365,7 +365,7 @@ def test_317_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
365365
JS:.+### CAUGHT STACKTRACE:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
366366
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
367367
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
368-
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
368+
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
369369
JS:.+com\.tns\.Runtime\.resolveMethodOverload\(Runtime\.java:\d+\)
370370
JS:.+com\.tns\.Runtime\.callJSMethodNative\(Native Method\)
371371
JS:.+com\.tns\.Runtime\.dispatchCallJSMethodNative\(Runtime\.java:\d+\)
@@ -390,14 +390,14 @@ def test_317_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
390390
JS:.+### CAUGHT STACK:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
391391
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
392392
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
393-
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
393+
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
394394
JS: ### UNCAUGHT MESSAGE: Calling js method onClick failed
395395
JS:.+Error: java\.lang\.Exception: Failed resolving method createTempFile on class java\.io\.File
396396
JS:.+### Stack Trace Start
397397
JS:.+### UNCAUGHT STACKTRACE:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
398398
JS: .+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
399399
JS: .+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
400-
JS: .+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
400+
JS: .+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
401401
JS: .+at com\.tns\.Runtime\.callJSMethodNative\(Native Method\)
402402
JS: .+at com\.tns\.Runtime\.dispatchCallJSMethodNative\(Runtime\.java:\d+\)
403403
JS: .+at com\.tns\.Runtime\.callJSMethodImpl\(Runtime\.java:\d+\)
@@ -425,7 +425,7 @@ def test_317_check_native_crash_will_not_crash_when_discardUncaughtJsExceptions_
425425
JS:.+### UNCAUGHT STACK:.+viewModel\.onTap\(file: app\/main-view-model\.js:\d+:\d+\)
426426
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\.notify\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
427427
JS:.+at push\.\.\.\/node_modules\/@nativescript\/core\/data\/observable\/observable\.js\.Observable\._emit\(file: node_modules\/@nativescript\/core\/data\/observable\/observable\.js:\d+:\d+\)
428-
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.js:\d+:\d+\)
428+
JS:.+at ClickListenerImpl\.onClick\(file: node_modules\/@nativescript\/core\/ui\/button\/button\.android\.js:\d+:\d+\)
429429
""" # noqa: E501
430430
strings = ["Error: java.lang.Exception: Failed resolving method createTempFile on class java.io.File",
431431
"Caused by: java.lang.Exception: Failed resolving method createTempFile on class java.io.File"]
@@ -627,10 +627,10 @@ def test_440_tns_run_android_new_date_work_as_expected_when_changing_timezone(se
627627
period=5)
628628
assert test_result, "Select time zone Button is missing on the device"
629629
Device.click(self.emulator, text="Select time zone")
630-
test_result = Wait.until(lambda: Device.is_text_visible(self.emulator, "Los Angeles", True),
630+
test_result = Wait.until(lambda: Device.is_text_visible(self.emulator, "Tijuana", True),
631631
timeout=30, period=5)
632632
assert test_result, "Los Angeles Button is missing on the device."
633-
Device.click(self.emulator, text="Los Angeles")
633+
Device.click(self.emulator, text="Tijuana")
634634

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

0 commit comments

Comments
 (0)