AltTester-Driver 2.0.2__tar.gz → 2.1.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 (110) hide show
  1. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/AltTester_Driver.egg-info/PKG-INFO +9 -5
  2. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/AltTester_Driver.egg-info/SOURCES.txt +2 -1
  3. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/PKG-INFO +9 -5
  4. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/README.md +3 -3
  5. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/__version__.py +1 -1
  6. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/_websocket.py +64 -41
  7. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/altdriver.py +30 -8
  8. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/FindObjects/wait_for_component_property.py +35 -18
  9. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/base_command.py +1 -1
  10. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/exceptions.py +19 -3
  11. alttester_driver-2.1.0/requirements-dev.txt +28 -0
  12. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/setup.py +1 -1
  13. alttester_driver-2.1.0/tests/integration/conftest.py +219 -0
  14. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/tests/integration/test_driver.py +1 -1
  15. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/tests/integration/test_notifications.py +5 -3
  16. alttester_driver-2.1.0/tests/integration/test_scene01_part1.py +517 -0
  17. AltTester-Driver-2.0.2/tests/integration/test_scene01.py → alttester_driver-2.1.0/tests/integration/test_scene01_part2.py +6 -430
  18. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/tests/integration/test_scene02.py +6 -5
  19. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/tests/integration/test_scene03.py +1 -2
  20. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/tests/integration/test_scene05.py +1 -2
  21. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/tests/integration/test_scene07.py +1 -2
  22. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/tests/integration/test_scene09.py +1 -2
  23. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/tests/integration/test_scene10.py +1 -2
  24. AltTester-Driver-2.0.2/requirements-dev.txt +0 -16
  25. AltTester-Driver-2.0.2/tests/integration/conftest.py +0 -129
  26. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/AltTester_Driver.egg-info/dependency_links.txt +0 -0
  27. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/AltTester_Driver.egg-info/not-zip-safe +0 -0
  28. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/AltTester_Driver.egg-info/requires.txt +0 -0
  29. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/AltTester_Driver.egg-info/top_level.txt +0 -0
  30. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/MANIFEST.in +0 -0
  31. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/__init__.py +0 -0
  32. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/altobject.py +0 -0
  33. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/by.py +0 -0
  34. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/AltTesterCommands/__init__.py +0 -0
  35. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/AltTesterCommands/add_notification_listener.py +0 -0
  36. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/AltTesterCommands/remove_notification_listener.py +0 -0
  37. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/AltTesterCommands/reset_input.py +0 -0
  38. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/AltTesterCommands/set_server_logging.py +0 -0
  39. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/FindObjects/__init__.py +0 -0
  40. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/FindObjects/find_object.py +0 -0
  41. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/FindObjects/find_object_at_coordinates.py +0 -0
  42. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/FindObjects/find_object_which_contains.py +0 -0
  43. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/FindObjects/find_objects.py +0 -0
  44. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/FindObjects/find_objects_which_contains.py +0 -0
  45. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/FindObjects/wait_for_object.py +0 -0
  46. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/FindObjects/wait_for_object_to_not_be_present.py +0 -0
  47. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/FindObjects/wait_for_object_which_contains.py +0 -0
  48. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/InputActions/__init__.py +0 -0
  49. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/InputActions/begin_touch.py +0 -0
  50. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/InputActions/click_coordinates.py +0 -0
  51. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/InputActions/end_touch.py +0 -0
  52. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/InputActions/keys_down.py +0 -0
  53. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/InputActions/keys_up.py +0 -0
  54. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/InputActions/move_mouse.py +0 -0
  55. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/InputActions/move_touch.py +0 -0
  56. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/InputActions/multi_point_swipe.py +0 -0
  57. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/InputActions/press_keys.py +0 -0
  58. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/InputActions/scroll_mouse.py +0 -0
  59. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/InputActions/swipe.py +0 -0
  60. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/InputActions/tap_coordinates.py +0 -0
  61. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/InputActions/tilt.py +0 -0
  62. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/Notifications/__init__.py +0 -0
  63. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/Notifications/base_notification_callbacks.py +0 -0
  64. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/Notifications/load_scene_mode.py +0 -0
  65. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/Notifications/load_scene_notification_result.py +0 -0
  66. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/Notifications/log_notification_result.py +0 -0
  67. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/Notifications/notification_type.py +0 -0
  68. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/ObjectCommands/__init__.py +0 -0
  69. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/ObjectCommands/call_method.py +0 -0
  70. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/ObjectCommands/click_element.py +0 -0
  71. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/ObjectCommands/get_all_components.py +0 -0
  72. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/ObjectCommands/get_component_property.py +0 -0
  73. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/ObjectCommands/get_text.py +0 -0
  74. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/ObjectCommands/pointer_down.py +0 -0
  75. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/ObjectCommands/pointer_enter.py +0 -0
  76. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/ObjectCommands/pointer_exit.py +0 -0
  77. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/ObjectCommands/pointer_up.py +0 -0
  78. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/ObjectCommands/set_component_property.py +0 -0
  79. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/ObjectCommands/set_text.py +0 -0
  80. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/ObjectCommands/tap_element.py +0 -0
  81. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/UnityCommands/__init__.py +0 -0
  82. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/UnityCommands/delete_player_pref.py +0 -0
  83. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/UnityCommands/delete_player_pref_key.py +0 -0
  84. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/UnityCommands/get_all_loaded_scenes.py +0 -0
  85. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/UnityCommands/get_current_scene.py +0 -0
  86. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/UnityCommands/get_player_pref_key.py +0 -0
  87. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/UnityCommands/get_time_scale.py +0 -0
  88. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/UnityCommands/load_scene.py +0 -0
  89. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/UnityCommands/set_player_pref_key.py +0 -0
  90. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/UnityCommands/set_time_scale.py +0 -0
  91. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/UnityCommands/unload_scene.py +0 -0
  92. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/UnityCommands/wait_for_current_scene_to_be.py +0 -0
  93. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/__init__.py +0 -0
  94. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/get_png_screenshot.py +0 -0
  95. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/get_server_version.py +0 -0
  96. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/get_static_property.py +0 -0
  97. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/commands/set_static_property.py +0 -0
  98. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/keycode.py +0 -0
  99. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/logging.py +0 -0
  100. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/playerpref.py +0 -0
  101. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/alttester/reverse_port_forwarding.py +0 -0
  102. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/requirements.txt +0 -0
  103. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/setup.cfg +0 -0
  104. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/tests/integration/__init__.py +0 -0
  105. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/tests/integration/test_reverse_port_forwarding.py +0 -0
  106. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/tests/integration/utils.py +0 -0
  107. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/tests/unit/__init__.py +0 -0
  108. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/tests/unit/test_altobject.py +0 -0
  109. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/tests/unit/test_commands.py +0 -0
  110. {AltTester-Driver-2.0.2 → alttester_driver-2.1.0}/tests/unit/test_websocket.py +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: AltTester-Driver
3
- Version: 2.0.2
4
- Summary: Python bindings for the AltTester framework. AltTester is an open-source UI driven test automation tool that helps you find objects in your game and interacts with them.
3
+ Version: 2.1.0
4
+ Summary: Python bindings for the AltTester® framework. AltTester® is an open-source UI driven test automation tool that helps you find objects in your game and interacts with them.
5
5
  Home-page: https://alttester.com/docs/sdk/latest/
6
6
  Author: Altom Consulting
7
7
  Author-email: contact@alttester.com
@@ -34,12 +34,16 @@ Classifier: Topic :: Software Development :: Testing :: Acceptance
34
34
  Classifier: Topic :: Software Development :: Testing :: Unit
35
35
  Requires-Python: >=3.4.0
36
36
  Description-Content-Type: text/markdown
37
+ Requires-Dist: loguru
38
+ Requires-Dist: deprecated
39
+ Requires-Dist: websocket-client
40
+ Requires-Dist: pure-python-adb
37
41
 
38
- # AltTester Python Bindings
42
+ # AltTester® Python Bindings
39
43
 
40
- This package contains an library for adding Python language binding to the AltTester framework.
44
+ This package contains an library for adding Python language binding to the AltTester® framework.
41
45
 
42
- AltTester Unity SDK is an open-source UI driven test automation tool that helps you find objects in your application and interacts with them using tests written in C#, Python or Java.
46
+ AltTester® Unity SDK is an open-source UI driven test automation tool that helps you find objects in your application and interacts with them using tests written in C#, Python, Java or Robot Framework.
43
47
 
44
48
  You can run your tests on real devices (mobile, PCs, etc.) or inside the Unity Editor.
45
49
 
@@ -91,7 +91,8 @@ tests/integration/conftest.py
91
91
  tests/integration/test_driver.py
92
92
  tests/integration/test_notifications.py
93
93
  tests/integration/test_reverse_port_forwarding.py
94
- tests/integration/test_scene01.py
94
+ tests/integration/test_scene01_part1.py
95
+ tests/integration/test_scene01_part2.py
95
96
  tests/integration/test_scene02.py
96
97
  tests/integration/test_scene03.py
97
98
  tests/integration/test_scene05.py
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: AltTester-Driver
3
- Version: 2.0.2
4
- Summary: Python bindings for the AltTester framework. AltTester is an open-source UI driven test automation tool that helps you find objects in your game and interacts with them.
3
+ Version: 2.1.0
4
+ Summary: Python bindings for the AltTester® framework. AltTester® is an open-source UI driven test automation tool that helps you find objects in your game and interacts with them.
5
5
  Home-page: https://alttester.com/docs/sdk/latest/
6
6
  Author: Altom Consulting
7
7
  Author-email: contact@alttester.com
@@ -34,12 +34,16 @@ Classifier: Topic :: Software Development :: Testing :: Acceptance
34
34
  Classifier: Topic :: Software Development :: Testing :: Unit
35
35
  Requires-Python: >=3.4.0
36
36
  Description-Content-Type: text/markdown
37
+ Requires-Dist: loguru
38
+ Requires-Dist: deprecated
39
+ Requires-Dist: websocket-client
40
+ Requires-Dist: pure-python-adb
37
41
 
38
- # AltTester Python Bindings
42
+ # AltTester® Python Bindings
39
43
 
40
- This package contains an library for adding Python language binding to the AltTester framework.
44
+ This package contains an library for adding Python language binding to the AltTester® framework.
41
45
 
42
- AltTester Unity SDK is an open-source UI driven test automation tool that helps you find objects in your application and interacts with them using tests written in C#, Python or Java.
46
+ AltTester® Unity SDK is an open-source UI driven test automation tool that helps you find objects in your application and interacts with them using tests written in C#, Python, Java or Robot Framework.
43
47
 
44
48
  You can run your tests on real devices (mobile, PCs, etc.) or inside the Unity Editor.
45
49
 
@@ -1,8 +1,8 @@
1
- # AltTester Python Bindings
1
+ # AltTester® Python Bindings
2
2
 
3
- This package contains an library for adding Python language binding to the AltTester framework.
3
+ This package contains an library for adding Python language binding to the AltTester® framework.
4
4
 
5
- AltTester Unity SDK is an open-source UI driven test automation tool that helps you find objects in your application and interacts with them using tests written in C#, Python or Java.
5
+ AltTester® Unity SDK is an open-source UI driven test automation tool that helps you find objects in your application and interacts with them using tests written in C#, Python, Java or Robot Framework.
6
6
 
7
7
  You can run your tests on real devices (mobile, PCs, etc.) or inside the Unity Editor.
8
8
 
@@ -15,4 +15,4 @@
15
15
  along with this program. If not, see <https://www.gnu.org/licenses/>.
16
16
  """
17
17
 
18
- VERSION = "2.0.2"
18
+ VERSION = "2.1.0"
@@ -32,7 +32,7 @@ from .commands.Notifications.load_scene_mode import LoadSceneMode
32
32
 
33
33
 
34
34
  class Store:
35
- """Stores the responses from AltServer."""
35
+ """Stores the responses from AltTester® Server."""
36
36
 
37
37
  def __init__(self, dict=None):
38
38
  self._store = dict or defaultdict(deque)
@@ -57,7 +57,7 @@ class Store:
57
57
 
58
58
 
59
59
  class NotificationHandler:
60
- """Handles the parsing of the notification messages from AltServer."""
60
+ """Handles the parsing of the notification messages from AltTester® Server."""
61
61
 
62
62
  def __init__(self):
63
63
  self._notification_callbacks = defaultdict(list)
@@ -104,7 +104,7 @@ class NotificationHandler:
104
104
 
105
105
 
106
106
  class CommandHandler:
107
- """Handles the parsing of command messages from AltServer."""
107
+ """Handles the parsing of command messages from AltTester® Server."""
108
108
 
109
109
  def __init__(self):
110
110
  self._store = Store()
@@ -116,7 +116,8 @@ class CommandHandler:
116
116
  return "{}()".format(self.__class__.__name__)
117
117
 
118
118
  def set_current_command(self, message):
119
- self._current_command = (message.get("messageId"), message.get("commandName"))
119
+ self._current_command = (message.get(
120
+ "messageId"), message.get("commandName"))
120
121
 
121
122
  def get_current_command(self):
122
123
  return self._current_command
@@ -143,7 +144,7 @@ class CommandHandler:
143
144
 
144
145
 
145
146
  class WebsocketConnection:
146
- """Handles the websocket connection with AltServer.
147
+ """Handles the websocket connection with AltTester® Server.
147
148
 
148
149
  Args:
149
150
  host (:obj:`str`, optional): The host to connect to. Defaults to ``127.0.0.1``.
@@ -161,7 +162,8 @@ class WebsocketConnection:
161
162
  self.path = path
162
163
  self.params = params or {}
163
164
 
164
- self.url = urlunparse(["ws", "{}:{}".format(self.host, self.port), self.path, "", urlencode(self.params), ""])
165
+ self.url = urlunparse(["ws", "{}:{}".format(
166
+ self.host, self.port), self.path, "", urlencode(self.params), ""])
165
167
 
166
168
  self.timeout = timeout
167
169
  self.command_timeout = 60
@@ -176,6 +178,7 @@ class WebsocketConnection:
176
178
 
177
179
  self._command_handler = command_handler
178
180
  self._notification_handler = notification_handler
181
+ self._driver_registered_called = False
179
182
 
180
183
  def __repr__(self):
181
184
  return "{}({!r}, {!r}, {!r}, {!r}, {!r})".format(
@@ -198,20 +201,28 @@ class WebsocketConnection:
198
201
  on_error=self._on_error,
199
202
  on_close=self._on_close
200
203
  )
201
- self._thread = Thread(target=self._websocket.run_forever, daemon=True).start()
204
+ self._thread = Thread(
205
+ target=self._websocket.run_forever, daemon=True).start()
202
206
 
203
- def _check_close_message(self):
204
- if self._close_message:
205
- reason = self._close_message[1]
207
+ def _check_close_message(self, close_message):
208
+ if close_message:
209
+ reason = close_message[1]
206
210
 
207
- if self._close_message[0] == 4001:
211
+ if close_message[0] == 4001:
208
212
  raise exceptions.NoAppConnected(reason)
209
- if self._close_message[0] == 4002:
213
+ if close_message[0] == 4002:
210
214
  raise exceptions.AppDisconnectedError(reason)
211
- if self._close_message[0] == 4005:
212
- raise exceptions.AppDisconnectedError(reason)
213
-
214
- raise exceptions.ConnectionError("Connection closed by AltServer with reason: {}.".format(reason))
215
+ if close_message[0] == 4005:
216
+ raise exceptions.MultipleDriverError(reason)
217
+ if close_message[0] == 4007:
218
+ raise exceptions.MultipleDriversTryingToConnectException(
219
+ reason)
220
+ if close_message[0] == 4009:
221
+ raise exceptions.MaxNoOfConnectionsDriversExceeded(
222
+ reason)
223
+
224
+ raise exceptions.ConnectionError(
225
+ "Connection closed by AltTester® Server with reason: {}.".format(reason))
215
226
 
216
227
  def _check_errors(self):
217
228
  if self._errors:
@@ -220,12 +231,13 @@ class WebsocketConnection:
220
231
  raise exceptions.ConnectionError(error)
221
232
 
222
233
  def _ensure_connection_is_open(self):
223
- self._check_close_message()
234
+ self._check_close_message(self._close_message)
224
235
  self._check_errors()
225
236
 
226
237
  if self._websocket is None or not self._is_open:
227
238
  self.close()
228
- raise exceptions.ConnectionError("Connection closed. An unexpected error ocurred.")
239
+ raise exceptions.ConnectionError(
240
+ "Connection closed. An unexpected error ocurred.")
229
241
 
230
242
  def _on_message(self, ws, message):
231
243
  """A callback which is called when the connection receives data."""
@@ -234,7 +246,10 @@ class WebsocketConnection:
234
246
  response = json.loads(message)
235
247
 
236
248
  if response.get("isNotification"):
237
- self._notification_handler.handle_notification(response)
249
+ if "driverRegistered" in message:
250
+ self._driver_registered_called = True
251
+ else:
252
+ self._notification_handler.handle_notification(response)
238
253
  else:
239
254
  self._command_handler.handle_command(response)
240
255
 
@@ -248,15 +263,17 @@ class WebsocketConnection:
248
263
  """A callback which is called when the connection is closed."""
249
264
 
250
265
  logger.debug(
251
- "Connection to AltServer closed with status code: {} and message: '{}'.",
266
+ "Connection to AltTester® Server closed with status code: {} and message: '{}'.",
252
267
  close_status_code,
253
268
  close_msg
254
269
  )
255
270
 
256
271
  self._close_message = (close_status_code, close_msg)
257
-
272
+ self._driver_registered_called = False
258
273
  self._is_open = False
259
274
  self._websocket = None
275
+ if close_status_code == 4002:
276
+ self.connect()
260
277
 
261
278
  def _on_open(self, ws):
262
279
  """A callback which is called when the connection is opened."""
@@ -272,30 +289,34 @@ class WebsocketConnection:
272
289
 
273
290
  def connect(self):
274
291
  logger.info("Connecting to URL: '{}'.", self.url)
275
-
292
+ last_close_message = None
276
293
  elapsed_time = 0
277
- self._create_connection()
278
-
279
- while not self._is_open and (self.timeout is None or elapsed_time < self.timeout):
280
- self._close_message = None
281
- self._errors = []
282
-
283
- if self._errors or self._close_message:
294
+ while self.timeout is None or elapsed_time < self.timeout:
295
+ self._create_connection()
296
+ wait_for_notification = 0
297
+ try:
298
+ while wait_for_notification < 5:
299
+ if self._driver_registered_called:
300
+ logger.debug("Connected to: '{0}'.".format(self.url))
301
+ return
302
+ time.sleep(self.delay)
303
+ wait_for_notification += self.delay
304
+ self._check_close_message(self._close_message)
305
+ except Exception:
306
+ last_close_message = self._close_message
284
307
  self.close()
285
- self._create_connection()
286
308
 
287
- time.sleep(self.delay)
288
- elapsed_time += self.delay
309
+ elapsed_time += wait_for_notification
289
310
 
290
- self._check_close_message()
291
- self._check_errors()
292
-
293
- if not self._is_open:
294
- self.close()
311
+ if self._is_open: # Added this to be also backward compatible but it will be slower
312
+ return
295
313
 
296
- raise exceptions.ConnectionTimeoutError(
297
- "Failed to connect to AltServer host: {} port: {}.".format(self.host, self.port)
298
- )
314
+ self._check_close_message(last_close_message)
315
+ self._check_errors()
316
+ raise exceptions.ConnectionTimeoutError(
317
+ "Failed to connect to AltTester® Server host: {} port: {}.".format(
318
+ self.host, self.port)
319
+ )
299
320
 
300
321
  def send(self, data):
301
322
  self._ensure_connection_is_open()
@@ -323,7 +344,8 @@ class WebsocketConnection:
323
344
  raise exceptions.CommandResponseTimeoutException()
324
345
 
325
346
  def close(self):
326
- logger.info("Closing connection to AltServer on host: {} port: {}", self.host, self.port)
347
+ logger.info(
348
+ "Closing connection to AltTester® Server on host: {} port: {}", self.host, self.port)
327
349
 
328
350
  if self._websocket:
329
351
  self._websocket.close()
@@ -336,3 +358,4 @@ class WebsocketConnection:
336
358
  self._errors = []
337
359
  self._close_message = None
338
360
  self._is_open = False
361
+ self._driver_registered_called = False
@@ -36,7 +36,7 @@ class AltDriver:
36
36
 
37
37
  When you instantiate an ``AltDriver`` object in your tests, you can use it to “drive” your application like one of
38
38
  your users would, by interacting with all the application objects, their properties and methods. An ``AltDriver``
39
- instance will connect to the AltServer.
39
+ instance will connect to the AltTester® Server.
40
40
 
41
41
  Args:
42
42
  host (:obj:`str`, optional): The host to connect to.
@@ -48,17 +48,32 @@ class AltDriver:
48
48
 
49
49
  """
50
50
 
51
- def __init__(self, host="127.0.0.1", port=13000, app_name="__default__", enable_logging=False, timeout=60):
51
+ def __init__(
52
+ self,
53
+ host="127.0.0.1",
54
+ port=13000,
55
+ app_name="__default__",
56
+ enable_logging=False,
57
+ timeout=60,
58
+ platform="unknown",
59
+ platform_version="unknown",
60
+ device_instance_id="unknown",
61
+ app_id="unknown"
62
+ ):
52
63
  self.host = host
53
64
  self.port = port
54
65
  self.app_name = app_name
55
66
  self.enable_logging = enable_logging
56
67
  self.timeout = timeout
68
+ self.platform = platform
69
+ self.platform_version = platform_version
70
+ self.device_instance_id = device_instance_id
71
+ self.app_id = app_id
57
72
 
58
73
  self._config_logging(self.enable_logging)
59
74
 
60
75
  logger.debug(
61
- "Connecting to AltTester on host: '{}', port: '{}' and app name: '{}'.",
76
+ "Connecting to AltTester® on host: '{}', port: '{}' and app name: '{}'.",
62
77
  self.host,
63
78
  self.port,
64
79
  self.app_name
@@ -71,7 +86,14 @@ class AltDriver:
71
86
  port=self.port,
72
87
  timeout=self.timeout,
73
88
  path="altws",
74
- params={"appName": self.app_name},
89
+ params={
90
+ "appName": self.app_name,
91
+ "platform": self.platform,
92
+ "platformVersion": self.platform_version,
93
+ "deviceInstanceId": self.device_instance_id,
94
+ "appId": self.app_id,
95
+ "driverType": "SDK"
96
+ },
75
97
  command_handler=self._command_handler,
76
98
  notification_handler=self._notification_handler
77
99
  )
@@ -109,13 +131,13 @@ class AltDriver:
109
131
 
110
132
  def _check_server_version(self):
111
133
  server_version = commands.GetServerVersion.run(self._connection)
112
- logger.info("Connection established with instrumented Unity app. AltTester Version: {}", server_version)
134
+ logger.info("Connection established with instrumented Unity app. AltTester® Version: {}", server_version)
113
135
 
114
136
  major_server, minor_server = self._split_version(server_version)
115
137
  major_driver, minor_driver = self._split_version(VERSION)
116
138
 
117
139
  if major_server != major_driver or minor_server != minor_driver:
118
- message = "Version mismatch. AltDriver version is {}. AltTester version is {}.".format(
140
+ message = "Version mismatch. AltDriver version is {}. AltTester® version is {}.".format(
119
141
  VERSION,
120
142
  server_version
121
143
  )
@@ -164,7 +186,7 @@ class AltDriver:
164
186
  self._connection.close()
165
187
 
166
188
  def get_command_response_timeout(self):
167
- """Gets the current command response timeout for the AltTester connection.
189
+ """Gets the current command response timeout for the AltTester® connection.
168
190
 
169
191
  Return:
170
192
  int or float: The current command response time.
@@ -174,7 +196,7 @@ class AltDriver:
174
196
  return self._connection.set_command_timeout()
175
197
 
176
198
  def set_command_response_timeout(self, timeout):
177
- """Sets the command response timeout for the AltTester connection.
199
+ """Sets the command response timeout for the AltTester® connection.
178
200
 
179
201
  Args:
180
202
  timeout (:obj:`int` or :obj:`float`): The new command response timeout in seconds.
@@ -18,12 +18,20 @@
18
18
  import time
19
19
  from loguru import logger
20
20
  from alttester.commands.base_command import Command
21
- from alttester.exceptions import NotFoundException, WaitTimeOutException
21
+ from alttester.exceptions import WaitTimeOutException
22
22
 
23
23
 
24
24
  class WaitForComponentProperty(Command):
25
- def __init__(self, component_name, property_name,
26
- property_value, assembly, altObject, timeout=20, interval=0.5):
25
+ def __init__(
26
+ self,
27
+ component_name,
28
+ property_name,
29
+ property_value,
30
+ assembly,
31
+ altObject,
32
+ timeout=20,
33
+ interval=0.5,
34
+ ):
27
35
  self.component_name = component_name
28
36
  self.property_name = property_name
29
37
  self.property_value = property_value
@@ -34,20 +42,29 @@ class WaitForComponentProperty(Command):
34
42
 
35
43
  def execute(self):
36
44
  t = 0
37
- while (t <= self.timeout):
45
+ exception = None
46
+ property_found = None
47
+ while t <= self.timeout:
38
48
  try:
39
49
  property_found = self.altObject.get_component_property(
40
- self.component_name, self.property_name, self.assembly)
41
- if (property_found == self.property_value):
42
- break
43
- except NotFoundException:
44
- logger.debug("Waiting for property {}...", self.property_name)
45
- time.sleep(self.interval)
46
- t += self.interval
47
-
48
- if t >= self.timeout:
49
- raise WaitTimeOutException("Property {} not found after {} seconds"
50
- .format(
51
- self.property_name, self.timeout))
52
-
53
- return property_found
50
+ self.component_name, self.property_name, self.assembly
51
+ )
52
+ if property_found == self.property_value:
53
+ return property_found
54
+ except Exception as ex:
55
+ exception = ex
56
+
57
+ logger.debug("Waiting for property {}...", self.property_name)
58
+ time.sleep(self.interval)
59
+ t += self.interval
60
+ if exception:
61
+ raise WaitTimeOutException(
62
+ "After {} seconds, exception was: {} for component: {} and property {}".format(
63
+ self.timeout, exception, self.component_name, self.property_name
64
+ )
65
+ )
66
+ raise WaitTimeOutException(
67
+ "Property {} was {}, not {} as expected, after {} seconds".format(
68
+ self.property_name, property_found, self.property_value, self.timeout
69
+ )
70
+ )
@@ -203,7 +203,7 @@ class BaseCommand(Command):
203
203
  raise exceptions.AltTesterInvalidServerResponse(expected, received)
204
204
 
205
205
  def send(self):
206
- """Send a command to the AltTester and return the response."""
206
+ """Send a command to the AltTester® and return the response."""
207
207
 
208
208
  self.connection.send(self._parameters)
209
209
  response = self.connection.recv()
@@ -38,6 +38,20 @@ class AppDisconnectedError(ConnectionError):
38
38
  """Raised when the app closed the connection or unexpectedly disconnected."""
39
39
 
40
40
 
41
+ class MultipleDriverError(ConnectionError):
42
+ """ Raised when the client tries to connect to a server with a driver already connected.
43
+ Free accounts are limited to a single driver connection at a time."""
44
+
45
+
46
+ class MultipleDriversTryingToConnectException(ConnectionError):
47
+ """Raised when the client tries to connect to a server at the same time with another driver"""
48
+
49
+
50
+ class MaxNoOfConnectionsDriversExceededException(ConnectionError):
51
+ """Raised when the client tries to connect to a server but the limit of drivers connected
52
+ is exceeded"""
53
+
54
+
41
55
  class AltTesterInvalidServerResponse(AltException):
42
56
  """Raised when the server responds with an invalid response."""
43
57
 
@@ -49,11 +63,13 @@ class InvalidParameterTypeException(TypeError, AltException):
49
63
  """Raised when an function or method receives an parameter that has the inappropriate type."""
50
64
 
51
65
  def __init__(self, parameter_name, expected_types, received_type):
52
- expected_types = [expected_type.__name__ for expected_type in expected_types]
66
+ expected_types = [
67
+ expected_type.__name__ for expected_type in expected_types]
53
68
  expected_types = ", ".join(expected_types)
54
69
 
55
70
  super().__init__(
56
- "TypeError: {} must be {}; not {}.".format(parameter_name, expected_types, received_type.__name__)
71
+ "TypeError: {} must be {}; not {}.".format(
72
+ parameter_name, expected_types, received_type.__name__)
57
73
  )
58
74
 
59
75
 
@@ -102,7 +118,7 @@ class CouldNotPerformOperationException(AltException):
102
118
 
103
119
 
104
120
  class CouldNotParseJsonStringException(AltException):
105
- """Raised when AltTester could not parse an JSON command."""
121
+ """Raised when AltTester® could not parse an JSON command."""
106
122
 
107
123
 
108
124
  class NullReferenceException(AltException):
@@ -0,0 +1,28 @@
1
+ # Deploy
2
+ setuptools>=38.6.0
3
+ wheel>=0.31.0
4
+ twine>=1.11.0
5
+
6
+ # Lint
7
+ flake8
8
+
9
+ # Tests
10
+ pytest
11
+ pytest-cov
12
+ pytest-rerunfailures
13
+ pytest-xdist
14
+
15
+ #browserstack
16
+ jsonmerge
17
+ multiprocess
18
+ paver
19
+ selenium==4.6.0
20
+ psutil
21
+ pytest-variables
22
+ Appium-Python-Client
23
+ py
24
+ Appium-Python-Client
25
+
26
+ # Allure
27
+ allure-pytest
28
+ allure-combine
@@ -19,7 +19,7 @@ from setuptools import setup, find_packages
19
19
 
20
20
 
21
21
  NAME = 'AltTester-Driver'
22
- DESCRIPTION = "Python bindings for the AltTester framework. AltTester is an open-source UI driven test " \
22
+ DESCRIPTION = "Python bindings for the AltTester® framework. AltTester® is an open-source UI driven test " \
23
23
  "automation tool that helps you find objects in your game and interacts with them."
24
24
  URL = 'https://alttester.com/docs/sdk/latest/'
25
25
  EMAIL = 'contact@alttester.com'