androidviewclient 23.1.1__tar.gz → 23.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. {androidviewclient-23.1.1/src/androidviewclient.egg-info → androidviewclient-23.3.0}/PKG-INFO +2 -2
  2. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/README.md +15 -14
  3. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/setup.py +2 -2
  4. {androidviewclient-23.1.1 → androidviewclient-23.3.0/src/androidviewclient.egg-info}/PKG-INFO +2 -2
  5. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/androidviewclient.egg-info/requires.txt +1 -1
  6. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/adb/adbclient.py +9 -9
  7. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/adb/dumpsys.py +1 -1
  8. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/code_generator.py +1 -1
  9. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/common.py +1 -1
  10. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/concertina.py +1 -1
  11. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/controlpanel.py +1 -1
  12. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/culebron.py +1 -1
  13. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/plot.py +1 -1
  14. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/robotframework/viewclientwrapper.py +1 -1
  15. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/uiautomator/uiautomatorhelper.py +47 -5
  16. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/viewclient.py +1 -1
  17. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/tools/culebra +1 -1
  18. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/tools/dump +1 -1
  19. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/LICENSE +0 -0
  20. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/setup.cfg +0 -0
  21. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/androidviewclient.egg-info/SOURCES.txt +0 -0
  22. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/androidviewclient.egg-info/dependency_links.txt +0 -0
  23. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/androidviewclient.egg-info/top_level.txt +0 -0
  24. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/__init__.py +0 -0
  25. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/__init__.py +0 -0
  26. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/__init__.py +0 -0
  27. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/adb/__init__.py +0 -0
  28. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/adb/androidkeymap.py +0 -0
  29. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/distance.py +0 -0
  30. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/kato/__init__.py +0 -0
  31. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/kato/kato.py +0 -0
  32. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/keyevent.py +0 -0
  33. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/robotframework/__init__.py +0 -0
  34. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/uiautomator/__init__.py +0 -0
  35. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/uiautomator/utils.py +0 -0
  36. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/com/dtmilano/android/window.py +0 -0
  37. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/share/__init__.py +0 -0
  38. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/share/pixmaps/__init__.py +0 -0
  39. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/share/pixmaps/culebra.png +0 -0
  40. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/share/pixmaps/plugins/__init__.py +0 -0
  41. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/share/pixmaps/plugins/android/__init__.py +0 -0
  42. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/share/pixmaps/plugins/android/lib/__init__.py +0 -0
  43. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/share/pixmaps/plugins/android/lib/device-art-resources/__init__.py +0 -0
  44. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/share/pixmaps/plugins/android/lib/device-art-resources/samsung_s4/__init__.py +0 -0
  45. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/share/pixmaps/plugins/android/lib/device-art-resources/samsung_s4/port_back.png +0 -0
  46. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/share/pixmaps/plugins/android/lib/device-art-resources/samsung_s4/port_fore.png +0 -0
  47. {androidviewclient-23.1.1 → androidviewclient-23.3.0}/src/share/pixmaps/plugins/android/lib/device-art-resources/samsung_s4/port_shadow.png +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: androidviewclient
3
- Version: 23.1.1
3
+ Version: 23.3.0
4
4
  Summary: AndroidViewClient is a 100% pure python library and tools
5
5
  Home-page: https://github.com/dtmilano/AndroidViewClient/
6
6
  Author: Diego Torres Milano
@@ -15,4 +15,4 @@ Requires-Dist: setuptools
15
15
  Requires-Dist: requests
16
16
  Requires-Dist: numpy
17
17
  Requires-Dist: matplotlib
18
- Requires-Dist: culebratester-client>=2.0.64
18
+ Requires-Dist: culebratester-client>=2.0.70
@@ -1,19 +1,18 @@
1
1
  AndroidViewClient
2
2
  =================
3
3
  <a href="#"><img src="https://github.com/dtmilano/AndroidViewClient/wiki/images/culebra-logo-transparent-204x209-rb-border.png" align="left" hspace="0" vspace="6"></a>
4
- **AndroidViewClient** was originally conceived as an extension to [monkeyrunner](http://developer.android.com/tools/help/monkeyrunner_concepts.html) but lately evolved
5
- as a pure python tool that automates or simplifies test script creation.
6
- It is a test framework for Android applications that:
4
+ **AndroidViewClient/culebra** was initially conceived as an extension to [monkeyrunner](http://developer.android.com/tools/help/monkeyrunner_concepts.html) but has since evolved
5
+ into a versatile pure Python tool.
6
+ It streamlines test script creation for Android applications by automating tasks and simplifying interactions. This test framework:
7
7
  <ul><ul>
8
- <li>Automates driving Android applications</li>
9
- <li>Generates re-usable scripts</li>
10
- <li>Provides view-based <i>device independent</i> UI interaction</li>
11
- <li>Uses 'logical' screen comparison (UI Automator Hierarchy based) over image comparison (Avoiding extraneous
12
- detail issues, such as time or data changes)</li>
13
- <li>Supports running concurrently on multiple devices</li>
14
- <li>Provides simple control for high level operations like language change and activity start</li>
15
- <li>Supports all Android APIs</li>
16
- <li>Is written in python (python 3.6+ support in 20.x.y+)</li>
8
+ <li>Automates the navigation of Android applications.</li>
9
+ <li>Generates reusable scripts for efficient testing.</li>
10
+ <li>Offers device-independent UI interaction based on views.</li>
11
+ <li>Utilizes 'logical' screen comparison (UI Automator Hierarchy based) instead of image comparison, avoiding extraneous detail issues like time or data changes.</li>
12
+ <li>Supports concurrent operation on multiple devices.</li>
13
+ <li>Provides straightforward control for high-level operations such as language change and activity start.</li>
14
+ <li>Fully supports all Android APIs.</li>
15
+ <li>Written in Python with support for Python 3.6 and above in versions 20.x.y and beyond.</li>
17
16
  </ul></ul>
18
17
 
19
18
  **🛎** |A new Kotlin backend is under development to provide more functionality and improve performance.<br>Take a look at [CulebraTester2](https://github.com/dtmilano/CulebraTester2-public) and 20.x.y-series prerelease. |
@@ -26,9 +25,11 @@ It is a test framework for Android applications that:
26
25
 
27
26
  **NOTE**: Pypi statistics are broken see [here](https://github.com/aclark4life/vanity/issues/22). The new statistics can be obtained from [BigQuery](https://bigquery.cloud.google.com/queries/culebra-tester).
28
27
 
29
- As of August 2021 we have reached:
28
+ As of February 2024 we have reached:
30
29
 
31
- <img src="https://github.com/dtmilano/AndroidViewClient/wiki/images/androidviewclient-culebra-1million.png" alt="culebra 1 million downloads" width="80%" align="center">
30
+ <p align="center">
31
+ <img src="https://github.com/dtmilano/AndroidViewClient/wiki/images/androidviewclient-culebra-2-million-downloads.png" alt="culebra 2 million downloads" width="80%" align="center">
32
+ </p>
32
33
 
33
34
  Thanks to all who made it possible.
34
35
 
@@ -3,7 +3,7 @@
3
3
  from setuptools import setup, find_packages
4
4
 
5
5
  setup(name='androidviewclient',
6
- version='23.1.1',
6
+ version='23.3.0',
7
7
  description='''AndroidViewClient is a 100% pure python library and tools
8
8
  that simplifies test script creation providing higher level
9
9
  operations and the ability of obtaining the tree of Views present at
@@ -22,5 +22,5 @@ setup(name='androidviewclient',
22
22
  classifiers=['Development Status :: 5 - Production/Stable',
23
23
  'Intended Audience :: Developers',
24
24
  'License :: OSI Approved :: Apache Software License'],
25
- install_requires=['setuptools', 'requests', 'numpy', 'matplotlib', 'culebratester-client >= 2.0.64'],
25
+ install_requires=['setuptools', 'requests', 'numpy', 'matplotlib', 'culebratester-client >= 2.0.70'],
26
26
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: androidviewclient
3
- Version: 23.1.1
3
+ Version: 23.3.0
4
4
  Summary: AndroidViewClient is a 100% pure python library and tools
5
5
  Home-page: https://github.com/dtmilano/AndroidViewClient/
6
6
  Author: Diego Torres Milano
@@ -15,4 +15,4 @@ Requires-Dist: setuptools
15
15
  Requires-Dist: requests
16
16
  Requires-Dist: numpy
17
17
  Requires-Dist: matplotlib
18
- Requires-Dist: culebratester-client>=2.0.64
18
+ Requires-Dist: culebratester-client>=2.0.70
@@ -2,4 +2,4 @@ setuptools
2
2
  requests
3
3
  numpy
4
4
  matplotlib
5
- culebratester-client>=2.0.64
5
+ culebratester-client>=2.0.70
@@ -27,7 +27,7 @@ from typing import Optional
27
27
 
28
28
  from com.dtmilano.android.adb.dumpsys import Dumpsys
29
29
 
30
- __version__ = '23.1.1'
30
+ __version__ = '23.3.0'
31
31
 
32
32
  import sys
33
33
  import warnings
@@ -1023,8 +1023,8 @@ class AdbClient:
1023
1023
  output_type = pytesseract.Output.DICT
1024
1024
  return pytesseract.image_to_data(image, output_type=output_type)
1025
1025
 
1026
- def __transformPointByOrientation(self, xxx_todo_changeme, orientationOrig, orientationDest):
1027
- (x, y) = xxx_todo_changeme
1026
+ def __transformPointByOrientation(self, initPoint, orientationOrig, orientationDest):
1027
+ (x, y) = initPoint
1028
1028
  if orientationOrig != orientationDest:
1029
1029
  if orientationDest == 1:
1030
1030
  _x = x
@@ -1075,7 +1075,7 @@ class AdbClient:
1075
1075
  self.__checkTransport()
1076
1076
  self.drag((x, y), (x, y), duration, orientation)
1077
1077
 
1078
- def drag(self, xxx_todo_changeme1, xxx_todo_changeme2, duration, steps=1, orientation=-1):
1078
+ def drag(self, startCoords, endCoords, duration, steps=1, orientation=-1):
1079
1079
  """
1080
1080
  Sends drag event in PX (actually it's using C{input swipe} command).
1081
1081
 
@@ -1085,8 +1085,8 @@ class AdbClient:
1085
1085
  @param steps: number of steps (currently ignored by C{input swipe})
1086
1086
  @param orientation: the orientation (-1: undefined)
1087
1087
  """
1088
- (x0, y0) = xxx_todo_changeme1
1089
- (x1, y1) = xxx_todo_changeme2
1088
+ (x0, y0) = startCoords
1089
+ (x1, y1) = endCoords
1090
1090
  self.__checkTransport()
1091
1091
  if orientation == -1:
1092
1092
  orientation = self.display['orientation']
@@ -1101,7 +1101,7 @@ class AdbClient:
1101
1101
  else:
1102
1102
  self.shell('input touchscreen swipe %d %d %d %d %d' % (x0, y0, x1, y1, duration))
1103
1103
 
1104
- def dragDip(self, xxx_todo_changeme3, xxx_todo_changeme4, duration, steps=1, orientation=-1):
1104
+ def dragDip(self, startCoords, endCoords, duration, steps=1, orientation=-1):
1105
1105
  """
1106
1106
  Sends drag event in DIP (actually it's using C{input swipe} command.
1107
1107
 
@@ -1110,8 +1110,8 @@ class AdbClient:
1110
1110
  @param duration: duration of the event in ms
1111
1111
  @param steps: number of steps (currently ignored by C{input swipe})
1112
1112
  """
1113
- (x0, y0) = xxx_todo_changeme3
1114
- (x1, y1) = xxx_todo_changeme4
1113
+ (x0, y0) = startCoords
1114
+ (x1, y1) = endCoords
1115
1115
  self.__checkTransport()
1116
1116
  if orientation == -1:
1117
1117
  orientation = self.display['orientation']
@@ -23,7 +23,7 @@ import re
23
23
  import sys
24
24
  from _warnings import warn
25
25
 
26
- __version__ = '23.1.1'
26
+ __version__ = '23.3.0'
27
27
 
28
28
  DEBUG = False
29
29
 
@@ -3,7 +3,7 @@ import textwrap
3
3
  from abc import ABC
4
4
  from datetime import date
5
5
 
6
- __version__ = '23.1.1'
6
+ __version__ = '23.3.0'
7
7
 
8
8
  from typing import TextIO, Union, Dict, List
9
9
 
@@ -20,7 +20,7 @@ limitations under the License.
20
20
 
21
21
  from __future__ import print_function
22
22
 
23
- __version__ = '23.1.1'
23
+ __version__ = '23.3.0'
24
24
 
25
25
  import ast
26
26
  import os
@@ -22,7 +22,7 @@ import json
22
22
  import random
23
23
 
24
24
  __author__ = 'diego'
25
- __version__ = '23.1.1'
25
+ __version__ = '23.3.0'
26
26
 
27
27
  DEBUG = True
28
28
 
@@ -20,7 +20,7 @@
20
20
  '''
21
21
  import platform
22
22
 
23
- __version__ = '23.1.1'
23
+ __version__ = '23.3.0'
24
24
 
25
25
  import tkinter
26
26
  import tkinter.ttk
@@ -38,7 +38,7 @@ from com.dtmilano.android.keyevent import KEY_EVENT
38
38
  from com.dtmilano.android.uiautomator.uiautomatorhelper import UiAutomatorHelper
39
39
  from com.dtmilano.android.viewclient import ViewClient, View, VERSION_SDK_PROPERTY
40
40
 
41
- __version__ = '23.1.1'
41
+ __version__ = '23.3.0'
42
42
 
43
43
  import sys
44
44
  import threading
@@ -31,7 +31,7 @@ from mpl_toolkits.axes_grid1 import host_subplot
31
31
 
32
32
  from com.dtmilano.android.adb.dumpsys import Dumpsys
33
33
 
34
- __version__ = '23.1.1'
34
+ __version__ = '23.3.0'
35
35
 
36
36
  DEBUG = False
37
37
 
@@ -18,7 +18,7 @@ limitations under the License.
18
18
  @author: Diego Torres Milano
19
19
  '''
20
20
 
21
- __version__ = '23.1.1'
21
+ __version__ = '23.3.0'
22
22
  __author__ = 'diego'
23
23
 
24
24
  import sys
@@ -20,8 +20,9 @@ limitations under the License.
20
20
 
21
21
  from __future__ import print_function
22
22
 
23
- __version__ = '23.1.1'
23
+ __version__ = '23.3.0'
24
24
 
25
+ import math
25
26
  import os
26
27
  import platform
27
28
  import re
@@ -36,7 +37,7 @@ from typing import Optional, List, Tuple
36
37
 
37
38
  import culebratester_client
38
39
  from culebratester_client import Text, ObjectRef, DefaultApi, Point, PerformTwoPointerGestureBody, \
39
- BooleanResponse, NumberResponse, StatusResponse, StringResponse
40
+ BooleanResponse, NumberResponse, StatusResponse, StringResponse, Rect
40
41
 
41
42
  from com.dtmilano.android.adb.adbclient import AdbClient
42
43
  from com.dtmilano.android.common import obtainAdbPath
@@ -317,6 +318,22 @@ class UiAutomatorHelper:
317
318
  """
318
319
  return self.uiAutomatorHelper.api_instance.device_display_real_size_get()
319
320
 
321
+ def display_physical_size(self):
322
+ """
323
+ Gets the physical width, height and diagonal
324
+ :return: physical width, height and diagonal
325
+ :rtype: dict
326
+ """
327
+ drs = self.uiAutomatorHelper.api_instance.device_display_real_size_get()
328
+ display = self.dumpsys("display")
329
+ m = re.search(r"density (\d+), ([\d.]+) x ([\d.]+) dpi", display)
330
+ assert len(m.groups()) == 3
331
+ density, xdpi, ydpi = m.groups()
332
+ pw = drs.x / float(xdpi)
333
+ ph = drs.y / float(xdpi)
334
+ diag = math.sqrt(pw * pw + ph * ph)
335
+ return {"physical_width": round(pw, 2), "physical_height": round(ph, 2), "screen": round(diag, 2)}
336
+
320
337
  def dumpsys(self, service, **kwargs) -> str:
321
338
  """
322
339
  :see https://github.com/dtmilano/CulebraTester2-public/blob/master/openapi.yaml
@@ -449,7 +466,18 @@ class UiAutomatorHelper:
449
466
  """
450
467
  check_response(self.uiAutomatorHelper.api_instance.ui_device_click_get(x=x, y=y))
451
468
 
452
- def drag(self, start_x: int, start_y: int, end_x: int, end_y:int , steps: int) -> None:
469
+ def display_size_dp(self):
470
+ """
471
+ Returns the default display size in dp (device-independent pixel).
472
+
473
+ The returned display size is adjusted per screen rotation. Also this will return the actual size of the
474
+ screen, rather than adjusted per system decorations (like status bar).
475
+ :return: the DPs
476
+ :rtype:
477
+ """
478
+ return self.uiAutomatorHelper.api_instance.ui_device_display_size_dp_get()
479
+
480
+ def drag(self, start_x: int, start_y: int, end_x: int, end_y: int, steps: int) -> None:
453
481
  """Performs a swipe from one coordinate to another coordinate.
454
482
 
455
483
  Performs a swipe from one coordinate to another coordinate. You can control the smoothness and speed of the
@@ -463,7 +491,8 @@ class UiAutomatorHelper:
463
491
  :param int end_y: end y (required)
464
492
  :param int steps: is the number of move steps sent to the system (required)
465
493
  """
466
- check_response(self.uiAutomatorHelper.api_instance.ui_device_drag_get(start_x, start_y, end_x, end_y, steps))
494
+ check_response(
495
+ self.uiAutomatorHelper.api_instance.ui_device_drag_get(start_x, start_y, end_x, end_y, steps))
467
496
 
468
497
  def dump_window_hierarchy(self, _format='JSON'):
469
498
  """
@@ -711,10 +740,23 @@ class UiAutomatorHelper:
711
740
  :param oid: the oid
712
741
  :return: the content description
713
742
  """
714
- response: StringResponse = self.uiAutomatorHelper.api_instance.ui_object2_oid_get_content_description_get(
743
+ response: StringResponse = self.uiAutomatorHelper.api_instance.ui_object_oid_get_content_description_get(
715
744
  oid=oid)
716
745
  return response.value
717
746
 
747
+ def get_bounds(self, oid: int) -> Tuple[int, int, int, int]:
748
+ """
749
+ Gets the view's bounds property. # noqa: E501
750
+ :see https://github.com/dtmilano/CulebraTester2-public/blob/master/openapi.yaml
751
+
752
+ :param oid:
753
+ :type oid:
754
+ :return:
755
+ :rtype:
756
+ """
757
+ rect: Rect = self.uiAutomatorHelper.api_instance.ui_object_oid_get_bounds_get(oid=oid)
758
+ return rect.left, rect.top, rect.right, rect.bottom
759
+
718
760
  def perform_two_pointer_gesture(self, oid: int, startPoint1: Tuple[int, int], startPoint2: Tuple[int, int],
719
761
  endPoint1: Tuple[int, int], endPoint2: Tuple[int, int], steps: int) -> None:
720
762
  """
@@ -26,7 +26,7 @@ from typing import Optional, Union, Dict, Tuple
26
26
  import culebratester_client
27
27
  from culebratester_client import WindowHierarchyChild, WindowHierarchy
28
28
 
29
- __version__ = '23.1.1'
29
+ __version__ = '23.3.0'
30
30
 
31
31
  import sys
32
32
  import warnings
@@ -28,7 +28,7 @@ from typing import Pattern
28
28
  import culebratester_client
29
29
  from culebratester_client import WindowHierarchy, Selector
30
30
 
31
- __version__ = '23.1.1'
31
+ __version__ = '23.3.0'
32
32
 
33
33
  import calendar
34
34
  import codecs
@@ -8,7 +8,7 @@ Created on Feb 3, 2012
8
8
 
9
9
  from __future__ import print_function
10
10
 
11
- __version__ = '23.1.1'
11
+ __version__ = '23.3.0'
12
12
 
13
13
  import getopt
14
14
  import os