AltTester-Driver 2.2.2__py3-none-any.whl → 2.2.4__py3-none-any.whl
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.
- alttester/__version__.py +1 -1
- alttester/_websocket.py +10 -1
- alttester/altdriver.py +23 -5
- alttester/altobject.py +30 -1
- alttester/commands/FindObjects/__init__.py +1 -0
- alttester/commands/FindObjects/wait_for_component_property.py +8 -2
- alttester/commands/FindObjects/wait_for_visual_element_property.py +79 -0
- alttester/commands/base_command.py +0 -1
- {AltTester_Driver-2.2.2.dist-info → alttester_driver-2.2.4.dist-info}/METADATA +2 -2
- {AltTester_Driver-2.2.2.dist-info → alttester_driver-2.2.4.dist-info}/RECORD +12 -29
- {AltTester_Driver-2.2.2.dist-info → alttester_driver-2.2.4.dist-info}/WHEEL +1 -1
- {AltTester_Driver-2.2.2.dist-info → alttester_driver-2.2.4.dist-info}/top_level.txt +0 -1
- tests/integration/__init__.py +0 -16
- tests/integration/conftest.py +0 -219
- tests/integration/test_driver.py +0 -141
- tests/integration/test_notifications.py +0 -100
- tests/integration/test_reverse_port_forwarding.py +0 -45
- tests/integration/test_scene01_part1.py +0 -542
- tests/integration/test_scene01_part2.py +0 -511
- tests/integration/test_scene02.py +0 -154
- tests/integration/test_scene03.py +0 -163
- tests/integration/test_scene05.py +0 -145
- tests/integration/test_scene07.py +0 -125
- tests/integration/test_scene09.py +0 -60
- tests/integration/test_scene10.py +0 -122
- tests/integration/utils.py +0 -29
- tests/unit/__init__.py +0 -16
- tests/unit/test_altobject.py +0 -75
- tests/unit/test_commands.py +0 -65
- tests/unit/test_websocket.py +0 -197
alttester/__version__.py
CHANGED
alttester/_websocket.py
CHANGED
|
@@ -179,6 +179,7 @@ class WebsocketConnection:
|
|
|
179
179
|
self._command_handler = command_handler
|
|
180
180
|
self._notification_handler = notification_handler
|
|
181
181
|
self._driver_registered_called = False
|
|
182
|
+
self._implicit_timeout = -1
|
|
182
183
|
|
|
183
184
|
def __repr__(self):
|
|
184
185
|
return "{}({!r}, {!r}, {!r}, {!r}, {!r})".format(
|
|
@@ -287,6 +288,14 @@ class WebsocketConnection:
|
|
|
287
288
|
def get_command_timeout(self):
|
|
288
289
|
return self.command_timeout
|
|
289
290
|
|
|
291
|
+
def set_implicit_timeout(self, timeout):
|
|
292
|
+
if timeout < 0:
|
|
293
|
+
raise ValueError("Timeout cannot be negative")
|
|
294
|
+
self._implicit_timeout = timeout
|
|
295
|
+
|
|
296
|
+
def get_implicit_timeout(self):
|
|
297
|
+
return self._implicit_timeout
|
|
298
|
+
|
|
290
299
|
def connect(self):
|
|
291
300
|
logger.info("Connecting to URL: '{}'.", self.url)
|
|
292
301
|
last_close_message = None
|
|
@@ -330,7 +339,7 @@ class WebsocketConnection:
|
|
|
330
339
|
def recv(self):
|
|
331
340
|
self._ensure_connection_is_open()
|
|
332
341
|
elapsed_time = 0
|
|
333
|
-
delay = 0.
|
|
342
|
+
delay = 0.01
|
|
334
343
|
|
|
335
344
|
while elapsed_time <= self.command_timeout:
|
|
336
345
|
if self._command_handler.has_response():
|
alttester/altdriver.py
CHANGED
|
@@ -147,6 +147,8 @@ class AltDriver:
|
|
|
147
147
|
if not is_supported:
|
|
148
148
|
message = "Version mismatch. AltDriver version is {}. AltTester(R) version is {}.".format(
|
|
149
149
|
VERSION, server_version)
|
|
150
|
+
if server_major == 1:
|
|
151
|
+
message += " Please update AltTester(R) to version 1.1."
|
|
150
152
|
logger.warning(message)
|
|
151
153
|
|
|
152
154
|
def _get_alt_object(self, data):
|
|
@@ -283,13 +285,13 @@ class AltDriver:
|
|
|
283
285
|
scene_name, load_single
|
|
284
286
|
)
|
|
285
287
|
|
|
286
|
-
def wait_for_current_scene_to_be(self, scene_name, timeout=
|
|
288
|
+
def wait_for_current_scene_to_be(self, scene_name, timeout=20, interval=1):
|
|
287
289
|
"""Waits for the scene to be loaded for a specified amount of time.
|
|
288
290
|
|
|
289
291
|
Args:
|
|
290
292
|
scene_name (:obj:`str`): The name of the scene to wait for.
|
|
291
293
|
timeout (obj:`int`, :obj:`float`, optional): The time measured in seconds to wait for the specified scene.
|
|
292
|
-
Defaults to ``
|
|
294
|
+
Defaults to ``20``.
|
|
293
295
|
interval (obj:`int`, :obj:`float`, optional): How often to check that the scene was loaded in the given
|
|
294
296
|
timeout. Defaults to ``1``.
|
|
295
297
|
|
|
@@ -297,7 +299,8 @@ class AltDriver:
|
|
|
297
299
|
str: The name of the loaded scene.
|
|
298
300
|
|
|
299
301
|
"""
|
|
300
|
-
|
|
302
|
+
if self._connection.get_implicit_timeout() != -1 and timeout == 20:
|
|
303
|
+
timeout = self._connection.get_implicit_timeout()
|
|
301
304
|
return commands.WaitForCurrentSceneToBe.run(
|
|
302
305
|
self._connection,
|
|
303
306
|
scene_name, timeout, interval
|
|
@@ -518,6 +521,8 @@ class AltDriver:
|
|
|
518
521
|
|
|
519
522
|
"""
|
|
520
523
|
|
|
524
|
+
if self._connection.get_implicit_timeout() != -1 and timeout == 20:
|
|
525
|
+
timeout = self._connection.get_implicit_timeout()
|
|
521
526
|
data = commands.WaitForObject.run(
|
|
522
527
|
self._connection,
|
|
523
528
|
by, value, camera_by, camera_value, timeout, interval, enabled
|
|
@@ -548,7 +553,8 @@ class AltDriver:
|
|
|
548
553
|
AltObject: The object.
|
|
549
554
|
|
|
550
555
|
"""
|
|
551
|
-
|
|
556
|
+
if self._connection.get_implicit_timeout() != -1 and timeout == 20:
|
|
557
|
+
timeout = self._connection.get_implicit_timeout()
|
|
552
558
|
data = commands.WaitForObjectWhichContains.run(
|
|
553
559
|
self._connection,
|
|
554
560
|
by, value, camera_by, camera_value, timeout, interval, enabled
|
|
@@ -577,7 +583,8 @@ class AltDriver:
|
|
|
577
583
|
``False`` will match all objects. Defaults to ``True``.
|
|
578
584
|
|
|
579
585
|
"""
|
|
580
|
-
|
|
586
|
+
if self._connection.get_implicit_timeout() != -1 and timeout == 20:
|
|
587
|
+
timeout = self._connection.get_implicit_timeout()
|
|
581
588
|
commands.WaitForObjectToNotBePresent.run(
|
|
582
589
|
self._connection,
|
|
583
590
|
by, value, camera_by, camera_value, timeout, interval, enabled
|
|
@@ -933,3 +940,14 @@ class AltDriver:
|
|
|
933
940
|
"""Clear all active input actions simulated by AltTester."""
|
|
934
941
|
|
|
935
942
|
commands.ResetInput.run(self._connection)
|
|
943
|
+
|
|
944
|
+
def set_implicit_timeout(self, timeout):
|
|
945
|
+
"""Sets an implicit timeout from tests for the AltTester commands using a timeout.
|
|
946
|
+
Args:
|
|
947
|
+
timeout (:obj:`int`): the new value of the timeout.
|
|
948
|
+
"""
|
|
949
|
+
self._connection.set_implicit_timeout(timeout)
|
|
950
|
+
|
|
951
|
+
def get_implicit_timeout(self):
|
|
952
|
+
"""Returns the implicit timeout used by AltTester commands."""
|
|
953
|
+
return self._connection.get_implicit_timeout()
|
alttester/altobject.py
CHANGED
|
@@ -201,6 +201,8 @@ class AltObject:
|
|
|
201
201
|
str: The property value is serialized to a JSON string.
|
|
202
202
|
|
|
203
203
|
"""
|
|
204
|
+
if self._connection.get_implicit_timeout() != -1 and timeout == 20:
|
|
205
|
+
timeout = self._connection.get_implicit_timeout()
|
|
204
206
|
return commands.WaitForComponentProperty.run(
|
|
205
207
|
component_name, property_name, property_value,
|
|
206
208
|
assembly, self, timeout, interval, get_property_as_string, max_depth
|
|
@@ -398,4 +400,31 @@ class AltObject:
|
|
|
398
400
|
if self.type != "UIToolkit":
|
|
399
401
|
raise exceptions.WrongAltObjectTypeException(
|
|
400
402
|
"This method is only available for VisualElement objects")
|
|
401
|
-
return commands.GetVisualElementProperty.run(self._connection, property_name, self
|
|
403
|
+
return commands.GetVisualElementProperty.run(self._connection, property_name, self)
|
|
404
|
+
|
|
405
|
+
def wait_for_visual_element_property(self, property_name,
|
|
406
|
+
property_value, timeout=20, interval=0.5,
|
|
407
|
+
get_property_as_string=False):
|
|
408
|
+
"""Waits until a property of the current object has a specific value.
|
|
409
|
+
|
|
410
|
+
Args:
|
|
411
|
+
property_name (str): The name of the property of which value you want to get.
|
|
412
|
+
property_value (str): The value of the property expected.
|
|
413
|
+
timeout (int, optional): The number of seconds that it will wait for property. Defaults to 20.
|
|
414
|
+
interval (int, optional): Time in seconds before retrying. Defaults to 0.5.
|
|
415
|
+
get_property_as_string (bool, optional): A boolean value that makes the property_value
|
|
416
|
+
to be compared as a string with the property from the instrumented app. Defaults to False.
|
|
417
|
+
|
|
418
|
+
Returns:
|
|
419
|
+
The property value is serialized to a JSON string.
|
|
420
|
+
|
|
421
|
+
Raises:
|
|
422
|
+
WrongAltObjectTypeException: The method is called on an object that is not a VisualElement.
|
|
423
|
+
"""
|
|
424
|
+
if self.type != "UIToolkit":
|
|
425
|
+
raise exceptions.WrongAltObjectTypeException(
|
|
426
|
+
"This method is only available for VisualElement objects")
|
|
427
|
+
if self._connection.get_implicit_timeout() != -1 and timeout == 20:
|
|
428
|
+
timeout = self._connection.get_implicit_timeout()
|
|
429
|
+
return commands.WaitForVisualElementProperty.run(
|
|
430
|
+
property_name, property_value, self, timeout, interval, get_property_as_string)
|
|
@@ -24,3 +24,4 @@ from alttester.commands.FindObjects.wait_for_object_to_not_be_present import *
|
|
|
24
24
|
from alttester.commands.FindObjects.wait_for_object_which_contains import *
|
|
25
25
|
from alttester.commands.FindObjects.find_object_at_coordinates import *
|
|
26
26
|
from alttester.commands.FindObjects.wait_for_component_property import *
|
|
27
|
+
from alttester.commands.FindObjects.wait_for_visual_element_property import *
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
import time
|
|
19
|
+
import json
|
|
19
20
|
from loguru import logger
|
|
20
21
|
from alttester.commands.base_command import Command
|
|
21
22
|
from alttester.exceptions import WaitTimeOutException
|
|
@@ -55,8 +56,13 @@ class WaitForComponentProperty(Command):
|
|
|
55
56
|
)
|
|
56
57
|
if not self.get_property_as_string and property_found == self.property_value:
|
|
57
58
|
return property_found
|
|
58
|
-
if
|
|
59
|
-
|
|
59
|
+
if (str(property_found) == "0.0" and str(self.property_value) == "0"):
|
|
60
|
+
return property_found
|
|
61
|
+
if self.get_property_as_string and (
|
|
62
|
+
str(property_found).replace(" ", "") == str(self.property_value).replace(" ", "") or
|
|
63
|
+
str(json.dumps(property_found)).replace(" ", "") == str(
|
|
64
|
+
self.property_value).replace(" ", "")
|
|
65
|
+
):
|
|
60
66
|
return property_found
|
|
61
67
|
except Exception as ex:
|
|
62
68
|
exception = ex
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright(C) 2025 Altom Consulting
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU General Public License as published by
|
|
6
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
(at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License
|
|
15
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
import time
|
|
19
|
+
import json
|
|
20
|
+
from loguru import logger
|
|
21
|
+
from alttester.commands.base_command import Command
|
|
22
|
+
from alttester.exceptions import WaitTimeOutException
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class WaitForVisualElementProperty(Command):
|
|
26
|
+
def __init__(
|
|
27
|
+
self,
|
|
28
|
+
property_name,
|
|
29
|
+
property_value,
|
|
30
|
+
altObject,
|
|
31
|
+
timeout=20,
|
|
32
|
+
interval=0.5,
|
|
33
|
+
get_property_as_string=False,
|
|
34
|
+
):
|
|
35
|
+
self.property_name = property_name
|
|
36
|
+
self.property_value = property_value
|
|
37
|
+
self.timeout = timeout
|
|
38
|
+
self.interval = interval
|
|
39
|
+
self.get_property_as_string = get_property_as_string
|
|
40
|
+
self.altObject = altObject
|
|
41
|
+
|
|
42
|
+
def execute(self):
|
|
43
|
+
t = 0
|
|
44
|
+
exception = None
|
|
45
|
+
property_found = None
|
|
46
|
+
while t <= self.timeout:
|
|
47
|
+
try:
|
|
48
|
+
property_found = self.altObject.get_visual_element_property(
|
|
49
|
+
self.property_name
|
|
50
|
+
)
|
|
51
|
+
if not self.get_property_as_string and property_found == self.property_value:
|
|
52
|
+
return property_found
|
|
53
|
+
if (str(property_found) == "0.0" and str(self.property_value) == "0"):
|
|
54
|
+
return property_found
|
|
55
|
+
if self.get_property_as_string and \
|
|
56
|
+
(
|
|
57
|
+
str(property_found).replace(" ", "") == str(self.property_value).replace(" ", "") or
|
|
58
|
+
str(json.dumps(property_found)).replace(" ", "") == str(
|
|
59
|
+
self.property_value).replace(" ", "")
|
|
60
|
+
):
|
|
61
|
+
|
|
62
|
+
return property_found
|
|
63
|
+
except Exception as ex:
|
|
64
|
+
exception = ex
|
|
65
|
+
|
|
66
|
+
logger.debug("Waiting for property {}...", self.property_name)
|
|
67
|
+
time.sleep(self.interval)
|
|
68
|
+
t += self.interval
|
|
69
|
+
if exception:
|
|
70
|
+
raise WaitTimeOutException(
|
|
71
|
+
"After {} seconds, exception was: {} for property {}".format(
|
|
72
|
+
self.timeout, exception, self.property_name
|
|
73
|
+
)
|
|
74
|
+
)
|
|
75
|
+
raise WaitTimeOutException(
|
|
76
|
+
"Property {} was {}, not {} as expected, after {} seconds".format(
|
|
77
|
+
self.property_name, property_found, self.property_value, self.timeout
|
|
78
|
+
)
|
|
79
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: AltTester-Driver
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.4
|
|
4
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
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
alttester/__init__.py,sha256=xvLbhPErIpUHOk8YX4wQtHh4pPCPRGex0tXh_gbkcT4,1040
|
|
2
|
-
alttester/__version__.py,sha256=
|
|
3
|
-
alttester/_websocket.py,sha256=
|
|
4
|
-
alttester/altdriver.py,sha256=
|
|
5
|
-
alttester/altobject.py,sha256=
|
|
2
|
+
alttester/__version__.py,sha256=yOnjGFEtpvVC3ApSY6eX0piYlH0TLCspPEx4r2JMkVg,718
|
|
3
|
+
alttester/_websocket.py,sha256=1JRn5ay4W7SFedDaxkQM4AIllMFPU19Ne3cWIvk5gTU,12553
|
|
4
|
+
alttester/altdriver.py,sha256=qAbXGM3JIPmZEgX9d5HhhvdnF2EBgr1J9FYZR2XC8X4,39016
|
|
5
|
+
alttester/altobject.py,sha256=JiK3tCtRyJz76uU1zgkm6fRLiwhJmaCZJL4H2D4yHqU,15469
|
|
6
6
|
alttester/by.py,sha256=f-2Z5AWw2Y13ytakZ3eLC0J-EB6dTq9dxkdK8HcTeVA,977
|
|
7
7
|
alttester/exceptions.py,sha256=TDFr0ZxAM2iV-JgH_1hO-w6BqNFBtubPeaw2dDD44LU,5242
|
|
8
8
|
alttester/keycode.py,sha256=Huh2VHiIuVO4brUi3a-pSuLWh7PhvcMunar57h0ZHXg,8202
|
|
@@ -10,7 +10,7 @@ alttester/logging.py,sha256=lBjs9c9ooEbBRukmw1siqIdas0zPPm9Ove6lXMThsCY,1033
|
|
|
10
10
|
alttester/playerpref.py,sha256=GYAwJpBBERHiRXuHmct2CJg7Ckecw7UspyeGX_Qlxoo,960
|
|
11
11
|
alttester/reverse_port_forwarding.py,sha256=4ztoW-tMPC2Bz62iiFaXxQgh0X2xIm4u0aBuTnvdo2g,1976
|
|
12
12
|
alttester/commands/__init__.py,sha256=4CMXXC2MBYxVmDzD9ccwxHE0D0gIy-5P8bnFJ3t8zvY,1256
|
|
13
|
-
alttester/commands/base_command.py,sha256=
|
|
13
|
+
alttester/commands/base_command.py,sha256=Qv0Td5FBNuTMtfNHqnM943yk2SOa9TSuHqYDDtcE6ec,9200
|
|
14
14
|
alttester/commands/get_png_screenshot.py,sha256=6lGP9Jl4PBOg0F0io2GlN9Y4af-8JMqbBB5ZW1yYOj0,1187
|
|
15
15
|
alttester/commands/get_server_version.py,sha256=dipZdhNv2Fc578BDj2AUnnABzmNHgFUkfMrWNnm8e4A,940
|
|
16
16
|
alttester/commands/get_static_property.py,sha256=69zHQ9GJlcy6kiW22NKutw6mDhLyx6X8CQ_ahlbZSIE,1574
|
|
@@ -20,16 +20,17 @@ alttester/commands/AltTesterCommands/add_notification_listener.py,sha256=gY-sCl7
|
|
|
20
20
|
alttester/commands/AltTesterCommands/remove_notification_listener.py,sha256=smeeaqFaz9SdwP4McChCwu_FRP5u5SWNIh7-Ck6P_9Y,1837
|
|
21
21
|
alttester/commands/AltTesterCommands/reset_input.py,sha256=q4_PdEL4hfmXVGQNDCsieRH4oU8FXZLR7svQ83m6Z-I,992
|
|
22
22
|
alttester/commands/AltTesterCommands/set_server_logging.py,sha256=Q6rQeNN_stmMO7W9-UcFkoewEM42BUKAqxaEHGnNwdE,1908
|
|
23
|
-
alttester/commands/FindObjects/__init__.py,sha256=
|
|
23
|
+
alttester/commands/FindObjects/__init__.py,sha256=wvuz_9PqAjGdZI-9SyH0vbDFy9gpu1G6nh2XVLXT0TE,1399
|
|
24
24
|
alttester/commands/FindObjects/find_object.py,sha256=9o8-lkXkF2nwanzZUYz0SSmRh7UXS9lhHCxa9R-Kn0o,2042
|
|
25
25
|
alttester/commands/FindObjects/find_object_at_coordinates.py,sha256=lcLHe0Ak9sgZzmqcc6iPV1xMjTMEAsUlvpr4D8CfsYk,1247
|
|
26
26
|
alttester/commands/FindObjects/find_object_which_contains.py,sha256=1gV5ZtTPABf4wLmVmwTAVxknyTIfhdlD9ND_lSMUWNU,2063
|
|
27
27
|
alttester/commands/FindObjects/find_objects.py,sha256=SHj5jaxjtDZCwbFtXvBxPB6EHOSHsJuHSh0AXNUgVLY,2043
|
|
28
28
|
alttester/commands/FindObjects/find_objects_which_contains.py,sha256=m8vy63ZDLO8DqbhsQA71s5iL4gBK9dOEyFZJtFiJC5M,2064
|
|
29
|
-
alttester/commands/FindObjects/wait_for_component_property.py,sha256=
|
|
29
|
+
alttester/commands/FindObjects/wait_for_component_property.py,sha256=XYw3cORwGlF33qzq-Rx9X4Q4EhEPcGREvseD8rIiRD4,3176
|
|
30
30
|
alttester/commands/FindObjects/wait_for_object.py,sha256=raKPZFnli-wX6xDJHuWVDlyYLNHOSlSOTJ4gNVL6uOg,2513
|
|
31
31
|
alttester/commands/FindObjects/wait_for_object_to_not_be_present.py,sha256=SI8fSG8nipwmHYGWoGzV7da3mbdioNbCDqOP2CPgxcU,2619
|
|
32
32
|
alttester/commands/FindObjects/wait_for_object_which_contains.py,sha256=rpn5tvHb0kVZdQfSqxxa8lpzM-QLwo8fhqHFSDPvGeY,2675
|
|
33
|
+
alttester/commands/FindObjects/wait_for_visual_element_property.py,sha256=9sgqnt7WSml5znX-DX0D64lCxkHsx8baYPQmJMCfI2E,2941
|
|
33
34
|
alttester/commands/InputActions/__init__.py,sha256=M0X1IplzD-3u8eu7svotHRZhIqnHCI8UozPxsv6uPxo,1447
|
|
34
35
|
alttester/commands/InputActions/begin_touch.py,sha256=OT48W_FxhEN3PjgH_t-Bl9OGMG3flkKtSCFpB1lE9N8,1225
|
|
35
36
|
alttester/commands/InputActions/click_coordinates.py,sha256=zKxwdvEFC5Xg_TEL3kDZukZ-LYvGUk9S5qv3RQes1D4,1614
|
|
@@ -77,25 +78,7 @@ alttester/commands/UnityCommands/set_player_pref_key.py,sha256=r2SJmStiwpUUPOz_k
|
|
|
77
78
|
alttester/commands/UnityCommands/set_time_scale.py,sha256=L7er_Lkmw5QKNLjLumUt_WSeuRyN2tq9n7tZnGPcy2w,1410
|
|
78
79
|
alttester/commands/UnityCommands/unload_scene.py,sha256=NhRO9KZZgGCgTLPBA8iO892Ib-Y7HaA9UVnHw69JfTA,1337
|
|
79
80
|
alttester/commands/UnityCommands/wait_for_current_scene_to_be.py,sha256=QEy5KBn_uApfovExKaZwoHgnhE3ffz24xciIIMsL8BE,1727
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
tests/integration/test_reverse_port_forwarding.py,sha256=0vwvw5qKsILfeBTxKQS2nMrr90y9YSJOb1AdlmaaRnM,1519
|
|
85
|
-
tests/integration/test_scene01_part1.py,sha256=Cgw10JxxihK1odhDLn9BW2RIlJAQAdOwsaCfu2Qoxfo,22787
|
|
86
|
-
tests/integration/test_scene01_part2.py,sha256=AyglRrdA-J5zT5QCYKowlHJ9TxrTJ9EMm8M_UI-hT38,20449
|
|
87
|
-
tests/integration/test_scene02.py,sha256=rZABtzvm582FmxhIkt5dNOHrvvhjvnxTwmYZsEsnwns,5219
|
|
88
|
-
tests/integration/test_scene03.py,sha256=uQUFWLEmWIRH0mpPmXGV3D2D-gpAKaz0Bo7P-1fx0n0,6544
|
|
89
|
-
tests/integration/test_scene05.py,sha256=b_fBDmkE7AOrSATsH9GNonmRkK4qiwDSNwqaAmkLOu0,5448
|
|
90
|
-
tests/integration/test_scene07.py,sha256=V6ggr_z_zCaPVO2M24ExI6X9TZEzsZSXtnHQoKbeuzw,4590
|
|
91
|
-
tests/integration/test_scene09.py,sha256=-bb7ORlA7E6DU6-E4HDmb_vyRN2kXddzgAcrdi63ops,2356
|
|
92
|
-
tests/integration/test_scene10.py,sha256=RYYMVupYVaAQWBRUaC3eyuTNmWQFbA4qkDP_Jr6wt0w,4436
|
|
93
|
-
tests/integration/utils.py,sha256=qGqARqBhUDsoTW6HLD7qVgidWJKEsUKCxSXXX4M654k,1114
|
|
94
|
-
tests/unit/__init__.py,sha256=Rgy0Ym8Rd1lyOmNPbANSF6c06UQKrvg5RQLhnNDksyc,699
|
|
95
|
-
tests/unit/test_altobject.py,sha256=20kEGW6k75iMDHWx3gOgZ2ea2SqlEPOZxZbpKZFoTGs,2381
|
|
96
|
-
tests/unit/test_commands.py,sha256=uZvo_YzhfRECYQ_8qsCEnIhFV4UCfrQPGLJDf5ZhqJ4,2242
|
|
97
|
-
tests/unit/test_websocket.py,sha256=gR0AXWsln9XHPZbWtsJWPiaiKXLgPLSIbepELigN_J0,6142
|
|
98
|
-
AltTester_Driver-2.2.2.dist-info/METADATA,sha256=_SkocAB3evxqsi9KaZLpRSuXKMTihbeb0XSHC9ZoBnw,3813
|
|
99
|
-
AltTester_Driver-2.2.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
100
|
-
AltTester_Driver-2.2.2.dist-info/top_level.txt,sha256=35Qjh9Z8doemyhWbQbWuGCmKGoRfQM5jsyhxB009k1g,16
|
|
101
|
-
AltTester_Driver-2.2.2.dist-info/RECORD,,
|
|
81
|
+
alttester_driver-2.2.4.dist-info/METADATA,sha256=B96qzE3ppYiBEfUc2Pz9wbiJF70o8F1DpPMRVHNfxXM,3813
|
|
82
|
+
alttester_driver-2.2.4.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
83
|
+
alttester_driver-2.2.4.dist-info/top_level.txt,sha256=l_4VpPaMD4aSqNdlTx-SrtG7cS_AUyMYlNf4s3o7JDg,10
|
|
84
|
+
alttester_driver-2.2.4.dist-info/RECORD,,
|
tests/integration/__init__.py
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Copyright(C) 2025 Altom Consulting
|
|
3
|
-
|
|
4
|
-
This program is free software: you can redistribute it and/or modify
|
|
5
|
-
it under the terms of the GNU General Public License as published by
|
|
6
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
7
|
-
(at your option) any later version.
|
|
8
|
-
|
|
9
|
-
This program is distributed in the hope that it will be useful,
|
|
10
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
GNU General Public License for more details.
|
|
13
|
-
|
|
14
|
-
You should have received a copy of the GNU General Public License
|
|
15
|
-
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
-
"""
|
tests/integration/conftest.py
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Copyright(C) 2025 Altom Consulting
|
|
3
|
-
|
|
4
|
-
This program is free software: you can redistribute it and/or modify
|
|
5
|
-
it under the terms of the GNU General Public License as published by
|
|
6
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
7
|
-
(at your option) any later version.
|
|
8
|
-
|
|
9
|
-
This program is distributed in the hope that it will be useful,
|
|
10
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
GNU General Public License for more details.
|
|
13
|
-
|
|
14
|
-
You should have received a copy of the GNU General Public License
|
|
15
|
-
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
import allure
|
|
19
|
-
import datetime
|
|
20
|
-
import os
|
|
21
|
-
import sys
|
|
22
|
-
import pytest
|
|
23
|
-
import time
|
|
24
|
-
from alttester import AltDriver
|
|
25
|
-
from appium import webdriver
|
|
26
|
-
from appium.webdriver.common.mobileby import MobileBy
|
|
27
|
-
from appium.options.android import UiAutomator2Options
|
|
28
|
-
from appium.options.ios import XCUITestOptions
|
|
29
|
-
|
|
30
|
-
sys.stdout = sys.stderr
|
|
31
|
-
|
|
32
|
-
devices = [
|
|
33
|
-
{"name": "Samsung Galaxy S23", "os": "android", "os_version": "13.0"},
|
|
34
|
-
{"name": "Google Pixel 6 Pro", "os": "android", "os_version": "13.0"},
|
|
35
|
-
{"name": "iPhone 14 Pro Max", "os": "ios", "os_version": "16"},
|
|
36
|
-
{"name": "OnePlus 9", "os": "android", "os_version": "11.0"},
|
|
37
|
-
{"name": "iPhone 13 Pro Max", "os": "ios", "os_version": "15"},
|
|
38
|
-
{"name": "Google Pixel 6", "os": "android", "os_version": "12.0"},
|
|
39
|
-
# Add more devices as needed
|
|
40
|
-
]
|
|
41
|
-
|
|
42
|
-
android_devices = [
|
|
43
|
-
{"name": "Samsung Galaxy S23", "os": "android", "os_version": "13.0"},
|
|
44
|
-
{"name": "OnePlus 9", "os": "android", "os_version": "11.0"},
|
|
45
|
-
{"name": "Google Pixel 6", "os": "android", "os_version": "12.0"},
|
|
46
|
-
]
|
|
47
|
-
|
|
48
|
-
ios_devices = [
|
|
49
|
-
{"name": "iPhone 14 Pro Max", "os": "ios", "os_version": "16"},
|
|
50
|
-
{"name": "iPhone 13 Pro Max", "os": "ios", "os_version": "15"},
|
|
51
|
-
{"name": "iPhone 12 Pro", "os": "ios", "os_version": "14"},
|
|
52
|
-
]
|
|
53
|
-
|
|
54
|
-
local_run_device = [
|
|
55
|
-
|
|
56
|
-
{"name": "__default__", "os": "unknown", "os_version": "unknown"},
|
|
57
|
-
]
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"""Holds test fixtures that need to be shared among all tests."""
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
def get_port():
|
|
64
|
-
return int(os.environ.get("ALTSERVER_PORT", 13000))
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def get_host():
|
|
68
|
-
return os.environ.get("ALTSERVER_HOST", "127.0.0.1")
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
def get_app_name():
|
|
72
|
-
return os.environ.get("ALTSERVER_APP_NAME", "__default__")
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
def get_browserstack_username():
|
|
76
|
-
return os.environ.get("BROWSERSTACK_USERNAME", "")
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
def get_browserstack_key():
|
|
80
|
-
return os.environ.get("BROWSERSTACK_KEY", "")
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
def get_browserstack_app_url(device):
|
|
84
|
-
if device["os"] == "android":
|
|
85
|
-
return os.environ.get("APP_URL_ANDROID", "")
|
|
86
|
-
return os.environ.get("APP_URL_IOS", "")
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
@pytest.fixture(scope="class", autouse=True)
|
|
90
|
-
def alt_driver(request, appium_driver, worker_id, current_device):
|
|
91
|
-
platform = current_device["os"]
|
|
92
|
-
if current_device["os"] == "ios":
|
|
93
|
-
platform = "iphone"
|
|
94
|
-
alt_driver = AltDriver(
|
|
95
|
-
host=get_host(),
|
|
96
|
-
port=get_port(),
|
|
97
|
-
app_name=get_app_name(),
|
|
98
|
-
platform=platform,
|
|
99
|
-
platform_version=current_device["os_version"].split(".")[0],
|
|
100
|
-
timeout=180
|
|
101
|
-
)
|
|
102
|
-
request.cls.alt_driver = alt_driver
|
|
103
|
-
print("Started alt_driver (worker {})".format(worker_id) +
|
|
104
|
-
" with device: {}".format(current_device))
|
|
105
|
-
yield alt_driver
|
|
106
|
-
|
|
107
|
-
alt_driver.stop()
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
def get_ui_automator_capabilities(device):
|
|
111
|
-
return {
|
|
112
|
-
"platformName": device["os"],
|
|
113
|
-
"platformVersion": device["os_version"],
|
|
114
|
-
"deviceName": device["name"],
|
|
115
|
-
"app": get_browserstack_app_url(device),
|
|
116
|
-
"newCommandTimeout": "300",
|
|
117
|
-
# Set other BrowserStack capabilities
|
|
118
|
-
"bstack:options": {
|
|
119
|
-
"projectName": "AltTester",
|
|
120
|
-
"buildName": "pipeline-build-{}".format(device["os"]),
|
|
121
|
-
"sessionName": "tests-{date:%Y-%m-%d_%H:%M:%S}".format(
|
|
122
|
-
date=datetime.datetime.now()
|
|
123
|
-
),
|
|
124
|
-
"local": "true",
|
|
125
|
-
"wsLocalSupport": "true",
|
|
126
|
-
"deviceOrientation": "landscape",
|
|
127
|
-
"idleTimeout": "300",
|
|
128
|
-
"networkLogs": "true",
|
|
129
|
-
"userName": get_browserstack_username(),
|
|
130
|
-
"accessKey": get_browserstack_key(),
|
|
131
|
-
},
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
@allure.step("Log: {message}")
|
|
136
|
-
def log_to_report(message):
|
|
137
|
-
print(message)
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
@pytest.fixture(autouse=True, scope="class")
|
|
141
|
-
def current_device(request, worker_id):
|
|
142
|
-
global devices
|
|
143
|
-
global local_run_device
|
|
144
|
-
global android_devices
|
|
145
|
-
global ios_devices
|
|
146
|
-
current_device = None
|
|
147
|
-
selected_devices = []
|
|
148
|
-
if os.environ.get("RUN_IN_BROWSERSTACK", "") != "true":
|
|
149
|
-
current_device = local_run_device[0]
|
|
150
|
-
else:
|
|
151
|
-
if worker_id == "master":
|
|
152
|
-
current_device = devices[0]
|
|
153
|
-
else:
|
|
154
|
-
index = int(worker_id.split("gw")[1])
|
|
155
|
-
if os.environ.get("RUN_IN_BROWSERSTACK_ANDROID_ONLY", "") == "true":
|
|
156
|
-
selected_devices = android_devices
|
|
157
|
-
elif os.environ.get("RUN_IN_BROWSERSTACK_IOS_ONLY", "") == "true":
|
|
158
|
-
selected_devices = ios_devices
|
|
159
|
-
else:
|
|
160
|
-
selected_devices = devices
|
|
161
|
-
current_device = selected_devices[index]
|
|
162
|
-
log_to_report("Using device: {}".format(current_device))
|
|
163
|
-
yield current_device
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
@pytest.fixture(scope="class", autouse=True)
|
|
167
|
-
def appium_driver(request, current_device, worker_id):
|
|
168
|
-
appium_driver = None
|
|
169
|
-
options = None
|
|
170
|
-
if os.environ.get("RUN_IN_BROWSERSTACK", "") == "true":
|
|
171
|
-
if current_device["os"] == "android":
|
|
172
|
-
options = UiAutomator2Options().load_capabilities(
|
|
173
|
-
get_ui_automator_capabilities(current_device)
|
|
174
|
-
)
|
|
175
|
-
else:
|
|
176
|
-
options = options = XCUITestOptions().load_capabilities(
|
|
177
|
-
get_ui_automator_capabilities(current_device)
|
|
178
|
-
)
|
|
179
|
-
print("Starting appium driver (worker id: {})".format(worker_id) +
|
|
180
|
-
" for device: {}".format(current_device["name"]))
|
|
181
|
-
appium_driver = webdriver.Remote(
|
|
182
|
-
"http://hub.browserstack.com/wd/hub", options=options
|
|
183
|
-
)
|
|
184
|
-
time.sleep(10)
|
|
185
|
-
if current_device["os"] == "ios":
|
|
186
|
-
try:
|
|
187
|
-
allow_button = appium_driver.find_element(MobileBy.ID, "Allow")
|
|
188
|
-
allow_button.click()
|
|
189
|
-
except Exception as e:
|
|
190
|
-
try:
|
|
191
|
-
print(
|
|
192
|
-
"No Allow button found: {}".format(type(e).__name__)
|
|
193
|
-
)
|
|
194
|
-
ok_button = appium_driver.find_element(MobileBy.ID, "OK")
|
|
195
|
-
ok_button.click()
|
|
196
|
-
except Exception as e:
|
|
197
|
-
print("No OK button found: {}".format(type(e).__name__))
|
|
198
|
-
pass
|
|
199
|
-
request.cls.appium_driver = appium_driver
|
|
200
|
-
request.cls.current_device = current_device
|
|
201
|
-
|
|
202
|
-
yield appium_driver
|
|
203
|
-
|
|
204
|
-
if os.environ.get("RUN_IN_BROWSERSTACK", "") == "true":
|
|
205
|
-
request.cls.appium_driver.quit()
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
@pytest.fixture(autouse=True)
|
|
209
|
-
def do_something_with_appium(request):
|
|
210
|
-
if os.environ.get("RUN_IN_BROWSERSTACK", "") != "true":
|
|
211
|
-
return
|
|
212
|
-
# browserstack has an idle timeout of max 300 seconds
|
|
213
|
-
# so we need to do something with the appium driver
|
|
214
|
-
# to keep it alive
|
|
215
|
-
try:
|
|
216
|
-
request.cls.appium_driver.get_window_size()
|
|
217
|
-
except Exception as e:
|
|
218
|
-
print("Could not get window size: {}".format(type(e).__name__))
|
|
219
|
-
pass
|