pumapy 2.0.0__tar.gz → 2.0.2__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.
- {pumapy-2.0.0/pumapy.egg-info → pumapy-2.0.2}/PKG-INFO +1 -1
- {pumapy-2.0.0 → pumapy-2.0.2}/puma/apps/android/appium_actions.py +5 -6
- {pumapy-2.0.0 → pumapy-2.0.2}/puma/apps/android/telegram/telegram.py +14 -5
- pumapy-2.0.2/puma/version.py +1 -0
- {pumapy-2.0.0 → pumapy-2.0.2/pumapy.egg-info}/PKG-INFO +1 -1
- pumapy-2.0.0/puma/version.py +0 -1
- {pumapy-2.0.0 → pumapy-2.0.2}/LICENSE.txt +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/README.md +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/puma/__init__.py +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/puma/apps/__init__.py +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/puma/apps/android/__init__.py +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/puma/apps/android/snapchat/__init__.py +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/puma/apps/android/snapchat/snapchat.py +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/puma/apps/android/telegram/__init__.py +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/puma/apps/android/whatsapp/__init__.py +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/puma/apps/android/whatsapp/whatsapp.py +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/puma/computer_vision/__init__.py +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/puma/computer_vision/ocr.py +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/puma/utils/__init__.py +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/puma/utils/route_simulator.py +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/puma/utils/video_utils.py +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/pumapy.egg-info/SOURCES.txt +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/pumapy.egg-info/dependency_links.txt +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/pumapy.egg-info/requires.txt +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/pumapy.egg-info/top_level.txt +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/setup.cfg +0 -0
- {pumapy-2.0.0 → pumapy-2.0.2}/setup.py +0 -0
|
@@ -10,7 +10,6 @@ from appium import webdriver
|
|
|
10
10
|
from appium.options.android import UiAutomator2Options
|
|
11
11
|
from appium.webdriver import WebElement
|
|
12
12
|
from appium.webdriver.common.appiumby import AppiumBy
|
|
13
|
-
from appium.webdriver.common.touch_action import TouchAction
|
|
14
13
|
from appium.webdriver.extensions.android.nativekey import AndroidKey
|
|
15
14
|
from appium.webdriver.webdriver import WebDriver
|
|
16
15
|
|
|
@@ -69,7 +68,7 @@ class AndroidAppiumActions:
|
|
|
69
68
|
# prepare options
|
|
70
69
|
self.options = _get_android_default_options()
|
|
71
70
|
self.options.udid = udid
|
|
72
|
-
self.
|
|
71
|
+
self.app_package = app_package
|
|
73
72
|
if desired_capabilities:
|
|
74
73
|
self.options.load_capabilities(desired_capabilities)
|
|
75
74
|
# connect to appium server
|
|
@@ -88,7 +87,7 @@ class AndroidAppiumActions:
|
|
|
88
87
|
self.activate_app()
|
|
89
88
|
|
|
90
89
|
def activate_app(self):
|
|
91
|
-
self.driver.activate_app(self.
|
|
90
|
+
self.driver.activate_app(self.app_package)
|
|
92
91
|
|
|
93
92
|
def __enter__(self):
|
|
94
93
|
return self
|
|
@@ -184,9 +183,9 @@ class AndroidAppiumActions:
|
|
|
184
183
|
log_error_and_raise_exception(logger, msg)
|
|
185
184
|
else:
|
|
186
185
|
logger.warning(f'Found multiple occurrences of text {text_to_click} on screen, clicking first one')
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
186
|
+
x = found_text[0].bounding_box.middle[0]
|
|
187
|
+
y = found_text[0].bounding_box.middle[1]
|
|
188
|
+
self.driver.execute_script('mobile: clickGesture', {'x': x, 'y': y})
|
|
190
189
|
|
|
191
190
|
def set_idle_timeout(self, timeout: int):
|
|
192
191
|
# https://github.com/appium/appium-uiautomator2-driver#poor-elements-interaction-performance
|
|
@@ -6,6 +6,7 @@ from appium.webdriver.common.appiumby import AppiumBy
|
|
|
6
6
|
from puma.apps.android.appium_actions import supported_version, AndroidAppiumActions
|
|
7
7
|
|
|
8
8
|
TELEGRAM_PACKAGE = 'org.telegram.messenger'
|
|
9
|
+
TELEGRAM_WEB_PACKAGE = 'org.telegram.messenger.web'
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
@supported_version("10.13.4")
|
|
@@ -13,18 +14,23 @@ class TelegramActions(AndroidAppiumActions):
|
|
|
13
14
|
|
|
14
15
|
def __init__(self,
|
|
15
16
|
device_udid,
|
|
17
|
+
telegram_web_version: bool = False,
|
|
16
18
|
desired_capabilities: Dict[str, str] = None,
|
|
17
19
|
implicit_wait=1,
|
|
18
20
|
appium_server='http://localhost:4723'):
|
|
19
21
|
"""
|
|
20
|
-
Class with an API for Telegram Android using Appium. Can be used with an emulator or real device attached to the
|
|
22
|
+
Class with an API for Telegram Android using Appium. Can be used with an emulator or real device attached to the
|
|
23
|
+
computer.
|
|
24
|
+
This class can be used for both the Play Store version and the version found at telegram.org. When using the
|
|
25
|
+
latter however, you need to use the `telegram_web_version` parameter, and set it to True.
|
|
21
26
|
"""
|
|
22
27
|
AndroidAppiumActions.__init__(self,
|
|
23
28
|
device_udid,
|
|
24
|
-
TELEGRAM_PACKAGE,
|
|
29
|
+
TELEGRAM_WEB_PACKAGE if telegram_web_version else TELEGRAM_PACKAGE,
|
|
25
30
|
desired_capabilities=desired_capabilities,
|
|
26
31
|
implicit_wait=implicit_wait,
|
|
27
32
|
appium_server=appium_server)
|
|
33
|
+
self.package_name = TELEGRAM_WEB_PACKAGE if telegram_web_version else TELEGRAM_PACKAGE
|
|
28
34
|
|
|
29
35
|
def _currently_at_homescreen(self) -> bool:
|
|
30
36
|
return self.is_present('//android.widget.FrameLayout[@content-desc="New Message"]')
|
|
@@ -47,14 +53,16 @@ class TelegramActions(AndroidAppiumActions):
|
|
|
47
53
|
print('some conversations still do not have a title loaded, clicking...')
|
|
48
54
|
convos[0].click()
|
|
49
55
|
self.driver.back()
|
|
56
|
+
if not self._currently_at_homescreen():
|
|
57
|
+
self.driver.back()
|
|
50
58
|
print('all conversations loaded!')
|
|
51
59
|
|
|
52
60
|
def return_to_homescreen(self):
|
|
53
61
|
"""
|
|
54
62
|
Returns to the start screen of Telegram
|
|
55
63
|
"""
|
|
56
|
-
if self.driver.current_package !=
|
|
57
|
-
self.driver.activate_app(
|
|
64
|
+
if self.driver.current_package != self.package_name:
|
|
65
|
+
self.driver.activate_app(self.package_name)
|
|
58
66
|
while not self._currently_at_homescreen():
|
|
59
67
|
self.driver.back()
|
|
60
68
|
self._load_conversation_titles()
|
|
@@ -164,6 +172,7 @@ class TelegramActions(AndroidAppiumActions):
|
|
|
164
172
|
# click the attachment icon
|
|
165
173
|
self.driver.find_element(by=AppiumBy.XPATH,
|
|
166
174
|
value='//android.widget.ImageView[lower-case(@content-desc)="attach media"]').click()
|
|
175
|
+
sleep(wait_time)
|
|
167
176
|
# click the camera: this might be unstable due to bad xpath expression
|
|
168
177
|
self.driver.find_element(by=AppiumBy.XPATH,
|
|
169
178
|
value='//android.widget.FrameLayout[@resource-id="android:id/content"]/android.widget.FrameLayout/android.widget.FrameLayout[2]').click()
|
|
@@ -266,7 +275,7 @@ class TelegramActions(AndroidAppiumActions):
|
|
|
266
275
|
|
|
267
276
|
def _if_chat_go_to_chat(self, chat: str):
|
|
268
277
|
if chat is not None:
|
|
269
|
-
self.return_to_homescreen()
|
|
270
278
|
self.select_chat(chat)
|
|
279
|
+
sleep(1)
|
|
271
280
|
if not self._currently_in_conversation():
|
|
272
281
|
raise Exception('Expected to be in conversation screen now, but screen contents are unknown')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
version = "2.0.2"
|
pumapy-2.0.0/puma/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
version = "2.0.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|