pumapy 2.3.2__tar.gz → 2.4.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 (30) hide show
  1. {pumapy-2.3.2/pumapy.egg-info → pumapy-2.4.0}/PKG-INFO +10 -3
  2. {pumapy-2.3.2 → pumapy-2.4.0}/puma/apps/android/telegram/telegram.py +39 -16
  3. pumapy-2.4.0/puma/version.py +1 -0
  4. {pumapy-2.3.2 → pumapy-2.4.0/pumapy.egg-info}/PKG-INFO +10 -3
  5. {pumapy-2.3.2 → pumapy-2.4.0}/pumapy.egg-info/requires.txt +1 -1
  6. {pumapy-2.3.2 → pumapy-2.4.0}/setup.py +1 -1
  7. pumapy-2.3.2/puma/version.py +0 -1
  8. {pumapy-2.3.2 → pumapy-2.4.0}/LICENSE.txt +0 -0
  9. {pumapy-2.3.2 → pumapy-2.4.0}/README.md +0 -0
  10. {pumapy-2.3.2 → pumapy-2.4.0}/puma/__init__.py +0 -0
  11. {pumapy-2.3.2 → pumapy-2.4.0}/puma/apps/__init__.py +0 -0
  12. {pumapy-2.3.2 → pumapy-2.4.0}/puma/apps/android/__init__.py +0 -0
  13. {pumapy-2.3.2 → pumapy-2.4.0}/puma/apps/android/appium_actions.py +0 -0
  14. {pumapy-2.3.2 → pumapy-2.4.0}/puma/apps/android/google_maps/__init__.py +0 -0
  15. {pumapy-2.3.2 → pumapy-2.4.0}/puma/apps/android/google_maps/google_maps.py +0 -0
  16. {pumapy-2.3.2 → pumapy-2.4.0}/puma/apps/android/snapchat/__init__.py +0 -0
  17. {pumapy-2.3.2 → pumapy-2.4.0}/puma/apps/android/snapchat/snapchat.py +0 -0
  18. {pumapy-2.3.2 → pumapy-2.4.0}/puma/apps/android/telegram/__init__.py +0 -0
  19. {pumapy-2.3.2 → pumapy-2.4.0}/puma/apps/android/whatsapp/__init__.py +0 -0
  20. {pumapy-2.3.2 → pumapy-2.4.0}/puma/apps/android/whatsapp/whatsapp.py +0 -0
  21. {pumapy-2.3.2 → pumapy-2.4.0}/puma/computer_vision/__init__.py +0 -0
  22. {pumapy-2.3.2 → pumapy-2.4.0}/puma/computer_vision/ocr.py +0 -0
  23. {pumapy-2.3.2 → pumapy-2.4.0}/puma/utils/__init__.py +0 -0
  24. {pumapy-2.3.2 → pumapy-2.4.0}/puma/utils/route_simulator.py +0 -0
  25. {pumapy-2.3.2 → pumapy-2.4.0}/puma/utils/video_utils.py +0 -0
  26. {pumapy-2.3.2 → pumapy-2.4.0}/pumapy.egg-info/SOURCES.txt +0 -0
  27. {pumapy-2.3.2 → pumapy-2.4.0}/pumapy.egg-info/dependency_links.txt +0 -0
  28. {pumapy-2.3.2 → pumapy-2.4.0}/pumapy.egg-info/top_level.txt +0 -0
  29. {pumapy-2.3.2 → pumapy-2.4.0}/setup.cfg +0 -0
  30. {pumapy-2.3.2 → pumapy-2.4.0}/test/test_version.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: pumapy
3
- Version: 2.3.2
3
+ Version: 2.4.0
4
4
  Home-page: https://github.com/NetherlandsForensicInstitute/puma
5
5
  Author: Netherlands Forensic Institute
6
6
  Author-email: netherlandsforensicinstitute@users.noreply.github.com
@@ -13,8 +13,15 @@ Requires-Dist: pytesseract==0.3.10
13
13
  Requires-Dist: geopy~=2.4.1
14
14
  Requires-Dist: setuptools~=75.1.0
15
15
  Requires-Dist: gpxpy~=1.6.2
16
- Requires-Dist: adb_pywrapper~=1.0.2
16
+ Requires-Dist: adb_pywrapper~=1.0.3
17
17
  Requires-Dist: requests~=2.32.3
18
+ Dynamic: author
19
+ Dynamic: author-email
20
+ Dynamic: description
21
+ Dynamic: description-content-type
22
+ Dynamic: home-page
23
+ Dynamic: license
24
+ Dynamic: requires-dist
18
25
 
19
26
  # Puma - Programmable Utility for Mobile Automation
20
27
 
@@ -1,16 +1,15 @@
1
1
  from time import sleep
2
- from typing import Dict
2
+ from typing import Dict, Optional
3
3
 
4
4
  from appium.webdriver.common.appiumby import AppiumBy
5
5
 
6
6
  from puma.apps.android.appium_actions import supported_version, AndroidAppiumActions
7
- from puma.apps.android.telegram import logger
8
7
 
9
8
  TELEGRAM_PACKAGE = 'org.telegram.messenger'
10
9
  TELEGRAM_WEB_PACKAGE = 'org.telegram.messenger.web'
11
10
 
12
11
 
13
- @supported_version("11.2.2")
12
+ @supported_version("11.6.1")
14
13
  class TelegramActions(AndroidAppiumActions):
15
14
 
16
15
  def __init__(self,
@@ -33,17 +32,23 @@ class TelegramActions(AndroidAppiumActions):
33
32
  appium_server=appium_server)
34
33
  self.package_name = TELEGRAM_WEB_PACKAGE if telegram_web_version else TELEGRAM_PACKAGE
35
34
 
36
- def _currently_at_homescreen(self) -> bool:
37
- return self.is_present('//android.widget.FrameLayout[@content-desc="New Message"]')
35
+ def _currently_at_homescreen(self, **kwargs) -> bool:
36
+ return self.is_present('//android.widget.FrameLayout[@content-desc="New Message"]', **kwargs)
38
37
 
39
- def _currently_in_conversation(self) -> bool:
40
- return self.is_present('//android.widget.ImageView[@content-desc="Emoji, stickers, and GIFs"]')
38
+ def _currently_in_conversation(self, **kwargs) -> bool:
39
+ return self.is_present('//android.widget.ImageView[@content-desc="Emoji, stickers, and GIFs"]', **kwargs)
41
40
 
42
- def _currently_in_camera(self) -> bool:
43
- return self.is_present('//android.widget.Button[lower-case(@content-desc)="shutter"]')
41
+ def _currently_in_camera(self, **kwargs) -> bool:
42
+ return self.is_present('//android.widget.Button[lower-case(@content-desc)="shutter"]', **kwargs)
44
43
 
45
- def _currently_in_call(self) -> bool:
46
- return self.is_present('//android.widget.Button[@text="End Call"]')
44
+ def _currently_in_call(self, **kwargs) -> bool:
45
+ return self.is_present('//android.widget.Button[lower-case(@text)="end call"]', **kwargs)
46
+
47
+ def _currently_in_active_call(self, **kwargs) -> bool:
48
+ """
49
+ Returns true if currently in a call that is in actual progress (meaning: the other party answered the call).
50
+ """
51
+ return self.is_present('//android.widget.LinearLayout[@content-desc="Encryption key of this call"]', **kwargs)
47
52
 
48
53
  def _load_conversation_titles(self):
49
54
  while True:
@@ -94,6 +99,8 @@ class TelegramActions(AndroidAppiumActions):
94
99
  self.return_to_homescreen()
95
100
  xpath = f'//android.view.ViewGroup[starts-with(lower-case(@content-desc), "{chat.lower()}")]'
96
101
  self.driver.find_element(by=AppiumBy.XPATH, value=xpath).click()
102
+ if not self._currently_in_conversation(implicit_wait=1):
103
+ raise RuntimeError("Conversation was not opened after clicking the conversation")
97
104
 
98
105
  def select_group(self, group_name: str):
99
106
  """
@@ -232,16 +239,32 @@ class TelegramActions(AndroidAppiumActions):
232
239
  value='//android.widget.ImageButton[lower-case(@content-desc)="more options"]').click()
233
240
  self.driver.find_element(by=AppiumBy.XPATH,
234
241
  value='//android.widget.TextView[lower-case(@text)="video call"]').click()
242
+ # wait a short while (max 2s) for the call to have started
243
+ self._currently_in_active_call(implicit_wait=2)
244
+
245
+ def get_call_status(self) -> Optional[str]:
246
+ """
247
+ Returns a string describing the status of the current call, which is a text visible on the call screen.
248
+ If the call is in progress, no text indicates this, but this method will return "In progress".
249
+ If not currently in a call, this method returns None.
250
+ Known statuses include 'Requesting', 'Waiting' and 'Ringing'.
251
+ """
252
+ if not self._currently_in_call():
253
+ return None
254
+ if self._currently_in_active_call():
255
+ return "In progress"
256
+ status_element = '//android.widget.LinearLayout[ends-with(@text, "Telegram Call")]/android.widget.FrameLayout/android.widget.TextView'
257
+ status_element = self.driver.find_element(by=AppiumBy.XPATH, value=status_element)
258
+ return status_element.get_attribute("text")
235
259
 
236
260
  def end_call(self):
237
261
  """
238
262
  Ends the current call. Assumes the call screen is open.
239
263
  """
240
- if self._currently_in_call():
241
- self.driver.find_element(by=AppiumBy.XPATH,
242
- value='//android.widget.Button[lower-case(@text)="end call"]').click()
243
- else:
244
- logger.warn('Could not end call as current screen was not the call screen.')
264
+ if not self._currently_in_call():
265
+ raise Exception('Cannot end call while not in call screen.')
266
+ self.driver.find_element(by=AppiumBy.XPATH,
267
+ value='//android.widget.Button[lower-case(@text)="end call"]').click()
245
268
 
246
269
  def answer_call(self):
247
270
  """
@@ -0,0 +1 @@
1
+ version = "2.4.0"
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: pumapy
3
- Version: 2.3.2
3
+ Version: 2.4.0
4
4
  Home-page: https://github.com/NetherlandsForensicInstitute/puma
5
5
  Author: Netherlands Forensic Institute
6
6
  Author-email: netherlandsforensicinstitute@users.noreply.github.com
@@ -13,8 +13,15 @@ Requires-Dist: pytesseract==0.3.10
13
13
  Requires-Dist: geopy~=2.4.1
14
14
  Requires-Dist: setuptools~=75.1.0
15
15
  Requires-Dist: gpxpy~=1.6.2
16
- Requires-Dist: adb_pywrapper~=1.0.2
16
+ Requires-Dist: adb_pywrapper~=1.0.3
17
17
  Requires-Dist: requests~=2.32.3
18
+ Dynamic: author
19
+ Dynamic: author-email
20
+ Dynamic: description
21
+ Dynamic: description-content-type
22
+ Dynamic: home-page
23
+ Dynamic: license
24
+ Dynamic: requires-dist
18
25
 
19
26
  # Puma - Programmable Utility for Mobile Automation
20
27
 
@@ -4,5 +4,5 @@ pytesseract==0.3.10
4
4
  geopy~=2.4.1
5
5
  setuptools~=75.1.0
6
6
  gpxpy~=1.6.2
7
- adb_pywrapper~=1.0.2
7
+ adb_pywrapper~=1.0.3
8
8
  requests~=2.32.3
@@ -22,7 +22,7 @@ setup(
22
22
  "geopy~=2.4.1",
23
23
  "setuptools~=75.1.0",
24
24
  "gpxpy~=1.6.2",
25
- "adb_pywrapper~=1.0.2",
25
+ "adb_pywrapper~=1.0.3",
26
26
  "requests~=2.32.3"
27
27
  ],
28
28
  )
@@ -1 +0,0 @@
1
- version = "2.3.2"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes