mangoautomation 1.1.21__tar.gz → 1.1.22__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.
Potentially problematic release.
This version of mangoautomation might be problematic. Click here for more details.
- {mangoautomation-1.1.21/mangoautomation.egg-info → mangoautomation-1.1.22}/PKG-INFO +2 -2
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/mangoautomation/__init__.py +1 -1
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/mangoautomation/enums/__init__.py +0 -1
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/mangoautomation/exceptions/__init__.py +0 -1
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/mangoautomation/exceptions/error_msg.py +1 -1
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/mangoautomation/models/__init__.py +0 -1
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/mangoautomation/models/_ui_model.py +1 -1
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/mangoautomation/tools/__init__.py +0 -1
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/mangoautomation/tools/_uiautodev.py +0 -2
- mangoautomation-1.1.22/mangoautomation/uidrive/__init__.py +16 -0
- mangoautomation-1.1.22/mangoautomation/uidrives/__init__.py +22 -0
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/_async_element.py +9 -7
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/_driver_object.py +4 -4
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/_sync_element.py +5 -6
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/android/_application.py +1 -1
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/android/_assertion.py +1 -1
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/android/_customization.py +1 -1
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/android/_element.py +3 -3
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/android/_equipment.py +1 -1
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/android/_page.py +1 -1
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/pc/__init__.py +3 -3
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/pc/customization.py +1 -1
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/pc/element.py +1 -1
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/pc/input_device.py +1 -1
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/web/async_web/__init__.py +8 -8
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/web/async_web/_assertion.py +1 -1
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/web/async_web/_browser.py +2 -2
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/web/async_web/_customization.py +1 -1
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/web/async_web/_element.py +3 -3
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/web/async_web/_input_device.py +1 -1
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/web/async_web/_page.py +1 -1
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/web/sync_web/__init__.py +8 -8
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/web/sync_web/_assertion.py +1 -1
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/web/sync_web/_browser.py +3 -3
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/web/sync_web/_customization.py +1 -1
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/web/sync_web/_element.py +3 -3
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/web/sync_web/_input_device.py +1 -1
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/web/sync_web/_page.py +2 -2
- {mangoautomation-1.1.21 → mangoautomation-1.1.22/mangoautomation.egg-info}/PKG-INFO +2 -2
- mangoautomation-1.1.22/mangoautomation.egg-info/SOURCES.txt +63 -0
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/mangoautomation.egg-info/requires.txt +1 -1
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/setup.py +2 -2
- mangoautomation-1.1.22/tests/test_ui_web.py +73 -0
- mangoautomation-1.1.21/mangoautomation/uidrive/__init__.py +0 -18
- mangoautomation-1.1.21/mangoautomation.egg-info/SOURCES.txt +0 -62
- mangoautomation-1.1.21/tests/test_ui_web.py +0 -77
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/LICENSE +0 -0
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/MANIFEST.in +0 -0
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/README.md +0 -0
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/mangoautomation/enums/_base_enum.py +0 -0
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/mangoautomation/enums/_ui_enum.py +0 -0
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/mangoautomation/exceptions/_exceptions.py +0 -0
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/mangoautomation/tools/_mate.py +0 -0
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/_base_data.py +0 -0
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/android/__init__.py +0 -0
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/android/_new_android.py +0 -0
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/ios/__init__.py +0 -0
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/pc/assertion.py +0 -0
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/pc/new_windows.py +0 -0
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/web/__init__.py +0 -0
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/web/async_web/_new_browser.py +0 -0
- {mangoautomation-1.1.21/mangoautomation/uidrive → mangoautomation-1.1.22/mangoautomation/uidrives}/web/sync_web/_new_browser.py +0 -0
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/mangoautomation.egg-info/dependency_links.txt +0 -0
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/mangoautomation.egg-info/top_level.txt +0 -0
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/setup.cfg +0 -0
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/tests/__init__.py +0 -0
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/tests/get_ope.py +0 -0
- {mangoautomation-1.1.21 → mangoautomation-1.1.22}/tests/test_ui_and.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mangoautomation
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.22
|
|
4
4
|
Summary: 测试工具
|
|
5
5
|
Home-page: https://gitee.com/mao-peng/testkit
|
|
6
6
|
Author: 毛鹏
|
|
@@ -10,7 +10,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.12
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.13
|
|
12
12
|
License-File: LICENSE
|
|
13
|
-
Requires-Dist: setuptools
|
|
13
|
+
Requires-Dist: setuptools==78.1.1
|
|
14
14
|
Requires-Dist: pydantic>=2.9.2
|
|
15
15
|
Requires-Dist: playwright==1.43.0
|
|
16
16
|
Requires-Dist: uiautomation>=2.0.20
|
|
@@ -14,7 +14,7 @@ ERROR_MSG_0007 = (4007, '安卓设备被关闭,请检查设备')
|
|
|
14
14
|
ERROR_MSG_0008 = (4008, '浏览器类型不正确,请联系管理员检查')
|
|
15
15
|
ERROR_MSG_0009 = (4009, '浏览器路径不正确,请手动设置一个正确的浏览器路径,现在的路径:{}')
|
|
16
16
|
ERROR_MSG_0010 = (4010, '浏览器被关闭,请不要手动关闭浏览器')
|
|
17
|
-
ERROR_MSG_0011 = (4011, '操作元素【{}
|
|
17
|
+
ERROR_MSG_0011 = (4011, '操作元素【{}】超时,请检查元素是否可见,或可以进行对应的操作')
|
|
18
18
|
ERROR_MSG_0012 = (4012, '操作失败,请检查输入的值是否有空字符串,null或不满足传参的值')
|
|
19
19
|
ERROR_MSG_0013 = (
|
|
20
20
|
313, '打开url时超时,分为2个问题:1.启用的浏览器过多,应当减少浏览器并发个数;2.自行查看为啥60秒还未打开:{}')
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# @Project: 芒果测试平台
|
|
3
|
+
# @Description: # @Time : 2023-07-15 11:57
|
|
4
|
+
# @Author : 毛鹏
|
|
5
|
+
from ..uidrives import *
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
'AsyncElement',
|
|
9
|
+
'BaseData',
|
|
10
|
+
'DriverObject',
|
|
11
|
+
'SyncElement',
|
|
12
|
+
'AsyncWebDevice',
|
|
13
|
+
'SyncWebDevice',
|
|
14
|
+
'AsyncWebCustomization',
|
|
15
|
+
'SyncWebCustomization',
|
|
16
|
+
]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# @Project: 芒果测试平台
|
|
3
|
+
# @Description: # @Time : 2023-07-15 11:57
|
|
4
|
+
# @Author : 毛鹏
|
|
5
|
+
|
|
6
|
+
from .web.async_web import AsyncWebDevice, AsyncWebCustomization
|
|
7
|
+
from .web.sync_web import SyncWebDevice, SyncWebCustomization
|
|
8
|
+
from ..uidrives._async_element import AsyncElement
|
|
9
|
+
from ..uidrives._base_data import BaseData
|
|
10
|
+
from ..uidrives._driver_object import DriverObject
|
|
11
|
+
from ..uidrives._sync_element import SyncElement
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
'AsyncElement',
|
|
15
|
+
'BaseData',
|
|
16
|
+
'DriverObject',
|
|
17
|
+
'SyncElement',
|
|
18
|
+
'AsyncWebDevice',
|
|
19
|
+
'SyncWebDevice',
|
|
20
|
+
'AsyncWebCustomization',
|
|
21
|
+
'SyncWebCustomization',
|
|
22
|
+
]
|
|
@@ -18,8 +18,8 @@ from ..enums import ElementOperationEnum, DriveTypeEnum
|
|
|
18
18
|
from ..exceptions import MangoAutomationError
|
|
19
19
|
from ..exceptions.error_msg import *
|
|
20
20
|
from ..models import ElementResultModel, ElementModel, ElementListResultModel
|
|
21
|
-
from ..
|
|
22
|
-
from ..
|
|
21
|
+
from ..uidrives.android import AndroidDriver
|
|
22
|
+
from ..uidrives.web.async_web import AsyncWebDevice, AsyncWebAssertion
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class AsyncElement(AsyncWebDevice, AndroidDriver):
|
|
@@ -45,7 +45,7 @@ class AsyncElement(AsyncWebDevice, AndroidDriver):
|
|
|
45
45
|
|
|
46
46
|
async def element_main(self,
|
|
47
47
|
element_model: ElementModel,
|
|
48
|
-
element_list_model: list[ElementModel]) -> ElementResultModel:
|
|
48
|
+
element_list_model: list[ElementModel] | None = None) -> ElementResultModel:
|
|
49
49
|
self.element_model = element_model
|
|
50
50
|
self.element_list_model = element_list_model
|
|
51
51
|
self.element_result_model = ElementResultModel(
|
|
@@ -196,6 +196,10 @@ class AsyncElement(AsyncWebDevice, AndroidDriver):
|
|
|
196
196
|
async def __custom(self):
|
|
197
197
|
for i in self.element_model.custom:
|
|
198
198
|
self.base_data.test_data.set_cache(i.get('key'), self.base_data.test_data.replace(i.get('value')))
|
|
199
|
+
for i in self.element_model.custom:
|
|
200
|
+
value = self.base_data.test_data.replace(i.get('value'))
|
|
201
|
+
self.base_data.log.debug(f'开始执行自定义-1:key: {i.get("key")}, value: {value}')
|
|
202
|
+
self.base_data.test_data.set_cache(i.get('key'), value)
|
|
199
203
|
|
|
200
204
|
async def __condition(self):
|
|
201
205
|
error_list = []
|
|
@@ -264,7 +268,6 @@ class AsyncElement(AsyncWebDevice, AndroidDriver):
|
|
|
264
268
|
else:
|
|
265
269
|
i.v = loc
|
|
266
270
|
i.v = self.base_data.test_data.replace(i.v)
|
|
267
|
-
|
|
268
271
|
except AttributeError as error:
|
|
269
272
|
self.base_data.log.debug(
|
|
270
273
|
f'获取操作值失败-1,类型:{type(error)},失败详情:{error},失败明细:{traceback.format_exc()}')
|
|
@@ -284,9 +287,8 @@ class AsyncElement(AsyncWebDevice, AndroidDriver):
|
|
|
284
287
|
)
|
|
285
288
|
if is_screenshot:
|
|
286
289
|
file_name = f'失败截图-{self.element_model.name}{self.base_data.test_data.get_time_for_min()}.jpg'
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
self.element_result_model.picture_path = file_path
|
|
290
|
+
await self.__error_screenshot(file_name)
|
|
291
|
+
self.element_result_model.picture_path = os.path.join(self.base_data.screenshot_path, file_name)
|
|
290
292
|
self.element_result_model.picture_name = file_name
|
|
291
293
|
except MangoAutomationError as error:
|
|
292
294
|
self.element_result_model.error_message += f'执行过程中发生失败,准备截图时截图失败,失败原因:{error.msg}'
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
from typing import Optional
|
|
8
8
|
|
|
9
|
-
from ..
|
|
10
|
-
from ..
|
|
11
|
-
from ..
|
|
12
|
-
from ..
|
|
9
|
+
from ..uidrives.android._new_android import NewAndroid
|
|
10
|
+
from ..uidrives.pc.new_windows import NewWindows
|
|
11
|
+
from ..uidrives.web.async_web._new_browser import AsyncWebNewBrowser
|
|
12
|
+
from ..uidrives.web.sync_web._new_browser import SyncWebNewBrowser
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class DriverObject:
|
|
@@ -18,8 +18,8 @@ from ..enums import ElementOperationEnum, DriveTypeEnum
|
|
|
18
18
|
from ..exceptions import MangoAutomationError
|
|
19
19
|
from ..exceptions.error_msg import *
|
|
20
20
|
from ..models import ElementResultModel, ElementModel, ElementListResultModel
|
|
21
|
-
from ..
|
|
22
|
-
from ..
|
|
21
|
+
from ..uidrives.android import AndroidDriver
|
|
22
|
+
from ..uidrives.web.sync_web import SyncWebDevice, SyncWebAssertion
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class SyncElement(SyncWebDevice, AndroidDriver):
|
|
@@ -232,7 +232,7 @@ class SyncElement(SyncWebDevice, AndroidDriver):
|
|
|
232
232
|
}
|
|
233
233
|
if self.drive_type == DriveTypeEnum.WEB.value:
|
|
234
234
|
loc, ele_quantity, element_text = self.web_find_ele(
|
|
235
|
-
**find_params,is_iframe=self.element_model.is_iframe)
|
|
235
|
+
**find_params, is_iframe=self.element_model.elements[random_element].is_iframe)
|
|
236
236
|
elif self.drive_type == DriveTypeEnum.ANDROID.value:
|
|
237
237
|
loc, ele_quantity, element_text = self.a_find_ele(**find_params)
|
|
238
238
|
else:
|
|
@@ -284,9 +284,8 @@ class SyncElement(SyncWebDevice, AndroidDriver):
|
|
|
284
284
|
)
|
|
285
285
|
if is_screenshot:
|
|
286
286
|
file_name = f'失败截图-{self.element_model.name}{self.base_data.test_data.get_time_for_min()}.jpg'
|
|
287
|
-
|
|
288
|
-
self.
|
|
289
|
-
self.element_result_model.picture_path = file_path
|
|
287
|
+
self.__error_screenshot(file_name)
|
|
288
|
+
self.element_result_model.picture_path = os.path.join(self.base_data.screenshot_path, file_name)
|
|
290
289
|
self.element_result_model.picture_name = file_name
|
|
291
290
|
except MangoAutomationError as error:
|
|
292
291
|
self.element_result_model.error_message += f'执行过程中发生失败,准备截图时截图失败,失败原因:{error.msg}'
|
|
@@ -10,7 +10,7 @@ from mangotools.models import MethodModel
|
|
|
10
10
|
from ...exceptions import MangoAutomationError
|
|
11
11
|
from ...exceptions.error_msg import ERROR_MSG_0046
|
|
12
12
|
from ...tools import Meta
|
|
13
|
-
from ...
|
|
13
|
+
from ...uidrives._base_data import BaseData
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class AndroidApplication(metaclass=Meta):
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
from uiautomator2 import UiObject
|
|
7
7
|
|
|
8
8
|
from mangoautomation.tools import Meta
|
|
9
|
-
from mangoautomation.
|
|
9
|
+
from mangoautomation.uidrives._base_data import BaseData
|
|
10
10
|
from mangotools.decorator import sync_method_callback
|
|
11
11
|
from mangotools.models import MethodModel
|
|
12
12
|
|
|
@@ -9,12 +9,12 @@ import time
|
|
|
9
9
|
from uiautomator2 import UiObject
|
|
10
10
|
from uiautomator2.xpath import XPathSelector
|
|
11
11
|
|
|
12
|
+
from mangotools.decorator import sync_method_callback
|
|
13
|
+
from mangotools.models import MethodModel
|
|
12
14
|
from ...exceptions import MangoAutomationError
|
|
13
15
|
from ...exceptions.error_msg import ERROR_MSG_0043, ERROR_MSG_0044
|
|
14
16
|
from ...tools import Meta
|
|
15
|
-
from ...
|
|
16
|
-
from mangotools.decorator import sync_method_callback
|
|
17
|
-
from mangotools.models import MethodModel
|
|
17
|
+
from ...uidrives._base_data import BaseData
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
class AndroidElement(metaclass=Meta):
|
|
@@ -8,7 +8,7 @@ from time import sleep
|
|
|
8
8
|
from mangotools.decorator import sync_method_callback
|
|
9
9
|
from mangotools.models import MethodModel
|
|
10
10
|
from ...tools import Meta
|
|
11
|
-
from ...
|
|
11
|
+
from ...uidrives._base_data import BaseData
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class AndroidEquipment(metaclass=Meta):
|
|
@@ -9,7 +9,7 @@ from uiautomator2 import Direction
|
|
|
9
9
|
from mangotools.decorator import sync_method_callback
|
|
10
10
|
from mangotools.models import MethodModel
|
|
11
11
|
from ...tools import Meta
|
|
12
|
-
from ...
|
|
12
|
+
from ...uidrives._base_data import BaseData
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class AndroidPage(metaclass=Meta):
|
|
@@ -24,9 +24,9 @@ else:
|
|
|
24
24
|
from uiautomation import Control
|
|
25
25
|
import uiautomation
|
|
26
26
|
|
|
27
|
-
from mangoautomation.
|
|
28
|
-
from mangoautomation.
|
|
29
|
-
from mangoautomation.
|
|
27
|
+
from mangoautomation.uidrives._base_data import BaseData
|
|
28
|
+
from mangoautomation.uidrives.pc.element import WinElement
|
|
29
|
+
from mangoautomation.uidrives.pc.input_device import WinDeviceInput
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
class WinDriver(WinElement, WinDeviceInput):
|
|
@@ -14,13 +14,13 @@ from mangotools.mangos import Mango
|
|
|
14
14
|
from ....enums import ElementExpEnum, ElementOperationEnum
|
|
15
15
|
from ....exceptions import MangoAutomationError
|
|
16
16
|
from ....exceptions.error_msg import *
|
|
17
|
-
from ....
|
|
18
|
-
from ....
|
|
19
|
-
from ....
|
|
20
|
-
from ....
|
|
21
|
-
from ....
|
|
22
|
-
from ....
|
|
23
|
-
from ....
|
|
17
|
+
from ....uidrives._base_data import BaseData
|
|
18
|
+
from ....uidrives.web.async_web._assertion import AsyncWebAssertion
|
|
19
|
+
from ....uidrives.web.async_web._browser import AsyncWebBrowser
|
|
20
|
+
from ....uidrives.web.async_web._customization import AsyncWebCustomization
|
|
21
|
+
from ....uidrives.web.async_web._element import AsyncWebElement
|
|
22
|
+
from ....uidrives.web.async_web._input_device import AsyncWebDeviceInput
|
|
23
|
+
from ....uidrives.web.async_web._page import AsyncWebPage
|
|
24
24
|
|
|
25
25
|
re = re
|
|
26
26
|
__all__ = [
|
|
@@ -54,7 +54,7 @@ class AsyncWebDevice(AsyncWebBrowser,
|
|
|
54
54
|
try:
|
|
55
55
|
await Mango.a_e(self, ope_key, ope_value)
|
|
56
56
|
except TimeoutError as error:
|
|
57
|
-
self.base_data.log.
|
|
57
|
+
self.base_data.log.debug(f'WEB自动化操作失败-1,类型:{type(error)},失败详情:{error}')
|
|
58
58
|
raise MangoAutomationError(*ERROR_MSG_0011, value=(name,))
|
|
59
59
|
except Error as error:
|
|
60
60
|
self.base_data.log.error(f'WEB自动化操作失败-2,类型:{type(error)},失败详情:{error}')
|
|
@@ -10,7 +10,7 @@ from mangotools.models import MethodModel
|
|
|
10
10
|
from ....exceptions import MangoAutomationError
|
|
11
11
|
from ....exceptions.error_msg import ERROR_MSG_0021
|
|
12
12
|
from ....tools import Meta
|
|
13
|
-
from ....
|
|
13
|
+
from ....uidrives._base_data import BaseData
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class AsyncWebAssertion(metaclass=Meta):
|
|
@@ -53,11 +53,11 @@ class AsyncWebBrowser(metaclass=Meta):
|
|
|
53
53
|
raise MangoAutomationError(*ERROR_MSG_0058, value=(url,))
|
|
54
54
|
|
|
55
55
|
@async_method_callback('web', '浏览器操作', 2, [
|
|
56
|
-
MethodModel(n='存储路径', f='path', p='
|
|
56
|
+
MethodModel(n='存储路径', f='path', p='请输入截图名称', d=True)])
|
|
57
57
|
async def w_screenshot(self, path: str):
|
|
58
58
|
"""整个页面截图"""
|
|
59
59
|
try:
|
|
60
|
-
await self.base_data.page.screenshot(path=path, full_page=True, timeout=10000)
|
|
60
|
+
await self.base_data.page.screenshot(path=os.path.join(self.base_data.screenshot_path, path), full_page=True, timeout=10000)
|
|
61
61
|
except (TargetClosedError, TimeoutError) as error:
|
|
62
62
|
self.base_data.log.debug(
|
|
63
63
|
f'截图出现异常失败-1,类型:{type(error)},失败详情:{error},失败明细:{traceback.format_exc()}')
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
# @Author : 毛鹏
|
|
5
5
|
import asyncio
|
|
6
6
|
import os
|
|
7
|
-
import time
|
|
8
7
|
|
|
8
|
+
import time
|
|
9
9
|
from playwright.async_api import Locator, Error, TimeoutError
|
|
10
10
|
|
|
11
11
|
from mangotools.decorator import async_method_callback
|
|
@@ -237,10 +237,10 @@ class AsyncWebElement(metaclass=Meta):
|
|
|
237
237
|
|
|
238
238
|
@async_method_callback('web', '元素操作', 15, [
|
|
239
239
|
MethodModel(f='locating'),
|
|
240
|
-
MethodModel(n='保存路径', f='path', p='
|
|
240
|
+
MethodModel(n='保存路径', f='path', p='请输入截图名称', d=True)])
|
|
241
241
|
async def w_ele_screenshot(self, locating: Locator, path: str):
|
|
242
242
|
"""元素截图"""
|
|
243
|
-
await locating.screenshot(path=path)
|
|
243
|
+
await locating.screenshot(path=os.path.join(self.base_data.download_path, path))
|
|
244
244
|
|
|
245
245
|
@async_method_callback('web', '元素操作', 20, [
|
|
246
246
|
MethodModel(f='locating1'),
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
from mangotools.decorator import async_method_callback
|
|
7
7
|
from mangotools.models import MethodModel
|
|
8
8
|
from ....tools import Meta
|
|
9
|
-
from ....
|
|
9
|
+
from ....uidrives._base_data import BaseData
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class AsyncWebDeviceInput(metaclass=Meta):
|
|
@@ -9,7 +9,7 @@ from playwright.async_api import Locator
|
|
|
9
9
|
from mangotools.decorator import async_method_callback
|
|
10
10
|
from mangotools.models import MethodModel
|
|
11
11
|
from ....tools import Meta
|
|
12
|
-
from ....
|
|
12
|
+
from ....uidrives._base_data import BaseData
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class AsyncWebPage(metaclass=Meta):
|
|
@@ -14,13 +14,13 @@ from mangotools.mangos import Mango
|
|
|
14
14
|
from ....enums import ElementExpEnum
|
|
15
15
|
from ....exceptions import MangoAutomationError
|
|
16
16
|
from ....exceptions.error_msg import *
|
|
17
|
-
from ....
|
|
18
|
-
from ....
|
|
19
|
-
from ....
|
|
20
|
-
from ....
|
|
21
|
-
from ....
|
|
22
|
-
from ....
|
|
23
|
-
from ....
|
|
17
|
+
from ....uidrives._base_data import BaseData
|
|
18
|
+
from ....uidrives.web.sync_web._assertion import SyncWebAssertion
|
|
19
|
+
from ....uidrives.web.sync_web._browser import SyncWebBrowser
|
|
20
|
+
from ....uidrives.web.sync_web._customization import SyncWebCustomization
|
|
21
|
+
from ....uidrives.web.sync_web._element import SyncWebElement
|
|
22
|
+
from ....uidrives.web.sync_web._input_device import SyncWebDeviceInput
|
|
23
|
+
from ....uidrives.web.sync_web._page import SyncWebPage
|
|
24
24
|
|
|
25
25
|
re = re
|
|
26
26
|
__all__ = [
|
|
@@ -54,7 +54,7 @@ class SyncWebDevice(SyncWebBrowser,
|
|
|
54
54
|
try:
|
|
55
55
|
Mango.s_e(self, ope_key, ope_value)
|
|
56
56
|
except TimeoutError as error:
|
|
57
|
-
self.base_data.log.
|
|
57
|
+
self.base_data.log.debug(f'WEB自动化操作失败-1,类型:{type(error)},失败详情:{error}')
|
|
58
58
|
raise MangoAutomationError(*ERROR_MSG_0011, value=(name,))
|
|
59
59
|
except Error as error:
|
|
60
60
|
self.base_data.log.error(f'WEB自动化操作失败-2,类型:{type(error)},失败详情:{error}')
|
|
@@ -10,7 +10,7 @@ from mangotools.exceptions.error_msg import ERROR_MSG_0021
|
|
|
10
10
|
from mangotools.models import MethodModel
|
|
11
11
|
from ....exceptions import MangoAutomationError
|
|
12
12
|
from ....tools import Meta
|
|
13
|
-
from ....
|
|
13
|
+
from ....uidrives._base_data import BaseData
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class SyncWebAssertion(metaclass=Meta):
|
|
@@ -15,7 +15,7 @@ from mangotools.models import MethodModel
|
|
|
15
15
|
from ....exceptions import MangoAutomationError
|
|
16
16
|
from ....exceptions.error_msg import ERROR_MSG_0049, ERROR_MSG_0013, ERROR_MSG_0058, ERROR_MSG_0059, ERROR_MSG_0010
|
|
17
17
|
from ....tools import Meta
|
|
18
|
-
from ....
|
|
18
|
+
from ....uidrives._base_data import BaseData
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
class SyncWebBrowser(metaclass=Meta):
|
|
@@ -53,11 +53,11 @@ class SyncWebBrowser(metaclass=Meta):
|
|
|
53
53
|
raise MangoAutomationError(*ERROR_MSG_0058, value=(url,))
|
|
54
54
|
|
|
55
55
|
@sync_method_callback('web', '浏览器操作', 2, [
|
|
56
|
-
MethodModel(n='保存路径', f='path', p='
|
|
56
|
+
MethodModel(n='保存路径', f='path', p='请输入截图名称', d=True)])
|
|
57
57
|
def w_screenshot(self, path: str):
|
|
58
58
|
"""整个页面截图"""
|
|
59
59
|
try:
|
|
60
|
-
self.base_data.page.screenshot(path=path, full_page=True, timeout=10000)
|
|
60
|
+
self.base_data.page.screenshot(path=os.path.join(self.base_data.screenshot_path, path), full_page=True, timeout=10000)
|
|
61
61
|
except (TargetClosedError, TimeoutError) as error:
|
|
62
62
|
self.base_data.log.debug(
|
|
63
63
|
f'截图出现异常失败-1,类型:{type(error)},失败详情:{error},失败明细:{traceback.format_exc()}')
|
|
@@ -12,7 +12,7 @@ from mangotools.models import MethodModel
|
|
|
12
12
|
from ....exceptions import MangoAutomationError
|
|
13
13
|
from ....exceptions.error_msg import ERROR_MSG_0024, ERROR_MSG_0056
|
|
14
14
|
from ....tools import Meta
|
|
15
|
-
from ....
|
|
15
|
+
from ....uidrives._base_data import BaseData
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class SyncWebElement(metaclass=Meta):
|
|
@@ -237,10 +237,10 @@ class SyncWebElement(metaclass=Meta):
|
|
|
237
237
|
|
|
238
238
|
@sync_method_callback('web', '元素操作', 15, [
|
|
239
239
|
MethodModel(f='locating'),
|
|
240
|
-
MethodModel(n='截图路径', f='path', p='
|
|
240
|
+
MethodModel(n='截图路径', f='path', p='请输入截图名称', d=True)])
|
|
241
241
|
def w_ele_screenshot(self, locating: Locator, path: str):
|
|
242
242
|
"""元素截图"""
|
|
243
|
-
locating.screenshot(path=path)
|
|
243
|
+
locating.screenshot(path=os.path.join(self.base_data.download_path, path))
|
|
244
244
|
|
|
245
245
|
@sync_method_callback('web', '元素操作', 20, [
|
|
246
246
|
MethodModel(f='locating1'),
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
from mangotools.decorator import sync_method_callback
|
|
6
6
|
from mangotools.models import MethodModel
|
|
7
7
|
from ....tools import Meta
|
|
8
|
-
from ....
|
|
8
|
+
from ....uidrives._base_data import BaseData
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class SyncWebDeviceInput(metaclass=Meta):
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import time
|
|
6
6
|
from playwright.sync_api import Locator
|
|
7
7
|
|
|
8
|
-
from ....tools import Meta
|
|
9
|
-
from ....uidrive._base_data import BaseData
|
|
10
8
|
from mangotools.decorator import sync_method_callback
|
|
11
9
|
from mangotools.models import MethodModel
|
|
10
|
+
from ....tools import Meta
|
|
11
|
+
from ....uidrives._base_data import BaseData
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class SyncWebPage(metaclass=Meta):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mangoautomation
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.22
|
|
4
4
|
Summary: 测试工具
|
|
5
5
|
Home-page: https://gitee.com/mao-peng/testkit
|
|
6
6
|
Author: 毛鹏
|
|
@@ -10,7 +10,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.12
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.13
|
|
12
12
|
License-File: LICENSE
|
|
13
|
-
Requires-Dist: setuptools
|
|
13
|
+
Requires-Dist: setuptools==78.1.1
|
|
14
14
|
Requires-Dist: pydantic>=2.9.2
|
|
15
15
|
Requires-Dist: playwright==1.43.0
|
|
16
16
|
Requires-Dist: uiautomation>=2.0.20
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
setup.py
|
|
5
|
+
mangoautomation/__init__.py
|
|
6
|
+
mangoautomation.egg-info/PKG-INFO
|
|
7
|
+
mangoautomation.egg-info/SOURCES.txt
|
|
8
|
+
mangoautomation.egg-info/dependency_links.txt
|
|
9
|
+
mangoautomation.egg-info/requires.txt
|
|
10
|
+
mangoautomation.egg-info/top_level.txt
|
|
11
|
+
mangoautomation/enums/__init__.py
|
|
12
|
+
mangoautomation/enums/_base_enum.py
|
|
13
|
+
mangoautomation/enums/_ui_enum.py
|
|
14
|
+
mangoautomation/exceptions/__init__.py
|
|
15
|
+
mangoautomation/exceptions/_exceptions.py
|
|
16
|
+
mangoautomation/exceptions/error_msg.py
|
|
17
|
+
mangoautomation/models/__init__.py
|
|
18
|
+
mangoautomation/models/_ui_model.py
|
|
19
|
+
mangoautomation/tools/__init__.py
|
|
20
|
+
mangoautomation/tools/_mate.py
|
|
21
|
+
mangoautomation/tools/_uiautodev.py
|
|
22
|
+
mangoautomation/uidrive/__init__.py
|
|
23
|
+
mangoautomation/uidrives/__init__.py
|
|
24
|
+
mangoautomation/uidrives/_async_element.py
|
|
25
|
+
mangoautomation/uidrives/_base_data.py
|
|
26
|
+
mangoautomation/uidrives/_driver_object.py
|
|
27
|
+
mangoautomation/uidrives/_sync_element.py
|
|
28
|
+
mangoautomation/uidrives/android/__init__.py
|
|
29
|
+
mangoautomation/uidrives/android/_application.py
|
|
30
|
+
mangoautomation/uidrives/android/_assertion.py
|
|
31
|
+
mangoautomation/uidrives/android/_customization.py
|
|
32
|
+
mangoautomation/uidrives/android/_element.py
|
|
33
|
+
mangoautomation/uidrives/android/_equipment.py
|
|
34
|
+
mangoautomation/uidrives/android/_new_android.py
|
|
35
|
+
mangoautomation/uidrives/android/_page.py
|
|
36
|
+
mangoautomation/uidrives/ios/__init__.py
|
|
37
|
+
mangoautomation/uidrives/pc/__init__.py
|
|
38
|
+
mangoautomation/uidrives/pc/assertion.py
|
|
39
|
+
mangoautomation/uidrives/pc/customization.py
|
|
40
|
+
mangoautomation/uidrives/pc/element.py
|
|
41
|
+
mangoautomation/uidrives/pc/input_device.py
|
|
42
|
+
mangoautomation/uidrives/pc/new_windows.py
|
|
43
|
+
mangoautomation/uidrives/web/__init__.py
|
|
44
|
+
mangoautomation/uidrives/web/async_web/__init__.py
|
|
45
|
+
mangoautomation/uidrives/web/async_web/_assertion.py
|
|
46
|
+
mangoautomation/uidrives/web/async_web/_browser.py
|
|
47
|
+
mangoautomation/uidrives/web/async_web/_customization.py
|
|
48
|
+
mangoautomation/uidrives/web/async_web/_element.py
|
|
49
|
+
mangoautomation/uidrives/web/async_web/_input_device.py
|
|
50
|
+
mangoautomation/uidrives/web/async_web/_new_browser.py
|
|
51
|
+
mangoautomation/uidrives/web/async_web/_page.py
|
|
52
|
+
mangoautomation/uidrives/web/sync_web/__init__.py
|
|
53
|
+
mangoautomation/uidrives/web/sync_web/_assertion.py
|
|
54
|
+
mangoautomation/uidrives/web/sync_web/_browser.py
|
|
55
|
+
mangoautomation/uidrives/web/sync_web/_customization.py
|
|
56
|
+
mangoautomation/uidrives/web/sync_web/_element.py
|
|
57
|
+
mangoautomation/uidrives/web/sync_web/_input_device.py
|
|
58
|
+
mangoautomation/uidrives/web/sync_web/_new_browser.py
|
|
59
|
+
mangoautomation/uidrives/web/sync_web/_page.py
|
|
60
|
+
tests/__init__.py
|
|
61
|
+
tests/get_ope.py
|
|
62
|
+
tests/test_ui_and.py
|
|
63
|
+
tests/test_ui_web.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from setuptools import setup, find_packages
|
|
2
2
|
|
|
3
|
-
__version__ = '1.1.
|
|
3
|
+
__version__ = '1.1.22'
|
|
4
4
|
|
|
5
5
|
with open("README.md", "r", encoding='utf-8') as fh:
|
|
6
6
|
long_description = fh.read()
|
|
@@ -16,7 +16,7 @@ setup(
|
|
|
16
16
|
url='https://gitee.com/mao-peng/testkit',
|
|
17
17
|
packages=find_packages(),
|
|
18
18
|
install_requires=[
|
|
19
|
-
|
|
19
|
+
"setuptools==78.1.1",
|
|
20
20
|
'pydantic>=2.9.2',
|
|
21
21
|
'playwright==1.43.0',
|
|
22
22
|
'uiautomation>=2.0.20',
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# @Project: 芒果测试平台
|
|
3
|
+
# @Description:
|
|
4
|
+
# @Time : 2025-04-12 17:31
|
|
5
|
+
# @Author : 毛鹏
|
|
6
|
+
import asyncio
|
|
7
|
+
import unittest
|
|
8
|
+
|
|
9
|
+
from mangoautomation.models import ElementModel
|
|
10
|
+
from mangoautomation.uidrive import AsyncElement, BaseData, DriverObject, SyncElement
|
|
11
|
+
from mangotools.data_processor import DataProcessor
|
|
12
|
+
from mangotools.log_collector import set_log
|
|
13
|
+
|
|
14
|
+
log = set_log('D:\code\mango_automation\logs')
|
|
15
|
+
test_data = DataProcessor()
|
|
16
|
+
element_model = ElementModel(**{
|
|
17
|
+
"id": 3,
|
|
18
|
+
"type": 0,
|
|
19
|
+
"name": "设置",
|
|
20
|
+
"elements": [
|
|
21
|
+
{
|
|
22
|
+
"exp": 0,
|
|
23
|
+
"loc": "//span[@name=\"tj_settingicon\"]",
|
|
24
|
+
"sub": None,
|
|
25
|
+
"is_iframe": 0
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"sleep": None,
|
|
29
|
+
"ope_key": "w_hover",
|
|
30
|
+
"ope_value": [
|
|
31
|
+
{
|
|
32
|
+
"f": "locating",
|
|
33
|
+
"n": None,
|
|
34
|
+
"p": None,
|
|
35
|
+
"d": False,
|
|
36
|
+
"v": ""
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"sql_execute": None,
|
|
40
|
+
"custom": None,
|
|
41
|
+
"condition_value": None,
|
|
42
|
+
"func": None
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class TestUi(unittest.IsolatedAsyncioTestCase):
|
|
47
|
+
async def test_a(self):
|
|
48
|
+
driver_object = DriverObject(log, True)
|
|
49
|
+
driver_object.set_web(0, r"C:\Program Files\Google\Chrome\Application\chrome.exe")
|
|
50
|
+
base_data = BaseData(test_data, log)
|
|
51
|
+
base_data.log = log
|
|
52
|
+
base_data.url = 'https://www.baidu.com/'
|
|
53
|
+
|
|
54
|
+
base_data.context, base_data.page = await driver_object.web.new_web_page()
|
|
55
|
+
element = AsyncElement(base_data, 0)
|
|
56
|
+
await element.open_url()
|
|
57
|
+
await asyncio.sleep(5)
|
|
58
|
+
await element.element_main(element_model, )
|
|
59
|
+
assert element.element_result_model.elements[0].element_text == '设置'
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class TestUi2(unittest.TestCase):
|
|
63
|
+
|
|
64
|
+
def test_s(self):
|
|
65
|
+
driver_object = DriverObject(log)
|
|
66
|
+
driver_object.set_web(0, r"C:\Program Files\Google\Chrome\Application\chrome.exe")
|
|
67
|
+
base_data = BaseData(test_data, log)
|
|
68
|
+
base_data.url = 'https://www.baidu.com/'
|
|
69
|
+
base_data.context, base_data.page = driver_object.web.new_web_page()
|
|
70
|
+
element = SyncElement(base_data, 0)
|
|
71
|
+
element.open_url()
|
|
72
|
+
element.element_main(element_model, )
|
|
73
|
+
assert element.element_result_model.elements[0].element_text == '设置'
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# @Project: 芒果测试平台
|
|
3
|
-
# @Description: # @Time : 2023-07-15 11:57
|
|
4
|
-
# @Author : 毛鹏
|
|
5
|
-
import sys
|
|
6
|
-
|
|
7
|
-
from ..uidrive._async_element import AsyncElement
|
|
8
|
-
from ..uidrive._base_data import BaseData
|
|
9
|
-
from ..uidrive._driver_object import DriverObject
|
|
10
|
-
from ..uidrive._sync_element import SyncElement
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
__all__ = [
|
|
14
|
-
'AsyncElement',
|
|
15
|
-
'BaseData',
|
|
16
|
-
'DriverObject',
|
|
17
|
-
'SyncElement',
|
|
18
|
-
]
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
LICENSE
|
|
2
|
-
MANIFEST.in
|
|
3
|
-
README.md
|
|
4
|
-
setup.py
|
|
5
|
-
mangoautomation/__init__.py
|
|
6
|
-
mangoautomation.egg-info/PKG-INFO
|
|
7
|
-
mangoautomation.egg-info/SOURCES.txt
|
|
8
|
-
mangoautomation.egg-info/dependency_links.txt
|
|
9
|
-
mangoautomation.egg-info/requires.txt
|
|
10
|
-
mangoautomation.egg-info/top_level.txt
|
|
11
|
-
mangoautomation/enums/__init__.py
|
|
12
|
-
mangoautomation/enums/_base_enum.py
|
|
13
|
-
mangoautomation/enums/_ui_enum.py
|
|
14
|
-
mangoautomation/exceptions/__init__.py
|
|
15
|
-
mangoautomation/exceptions/_exceptions.py
|
|
16
|
-
mangoautomation/exceptions/error_msg.py
|
|
17
|
-
mangoautomation/models/__init__.py
|
|
18
|
-
mangoautomation/models/_ui_model.py
|
|
19
|
-
mangoautomation/tools/__init__.py
|
|
20
|
-
mangoautomation/tools/_mate.py
|
|
21
|
-
mangoautomation/tools/_uiautodev.py
|
|
22
|
-
mangoautomation/uidrive/__init__.py
|
|
23
|
-
mangoautomation/uidrive/_async_element.py
|
|
24
|
-
mangoautomation/uidrive/_base_data.py
|
|
25
|
-
mangoautomation/uidrive/_driver_object.py
|
|
26
|
-
mangoautomation/uidrive/_sync_element.py
|
|
27
|
-
mangoautomation/uidrive/android/__init__.py
|
|
28
|
-
mangoautomation/uidrive/android/_application.py
|
|
29
|
-
mangoautomation/uidrive/android/_assertion.py
|
|
30
|
-
mangoautomation/uidrive/android/_customization.py
|
|
31
|
-
mangoautomation/uidrive/android/_element.py
|
|
32
|
-
mangoautomation/uidrive/android/_equipment.py
|
|
33
|
-
mangoautomation/uidrive/android/_new_android.py
|
|
34
|
-
mangoautomation/uidrive/android/_page.py
|
|
35
|
-
mangoautomation/uidrive/ios/__init__.py
|
|
36
|
-
mangoautomation/uidrive/pc/__init__.py
|
|
37
|
-
mangoautomation/uidrive/pc/assertion.py
|
|
38
|
-
mangoautomation/uidrive/pc/customization.py
|
|
39
|
-
mangoautomation/uidrive/pc/element.py
|
|
40
|
-
mangoautomation/uidrive/pc/input_device.py
|
|
41
|
-
mangoautomation/uidrive/pc/new_windows.py
|
|
42
|
-
mangoautomation/uidrive/web/__init__.py
|
|
43
|
-
mangoautomation/uidrive/web/async_web/__init__.py
|
|
44
|
-
mangoautomation/uidrive/web/async_web/_assertion.py
|
|
45
|
-
mangoautomation/uidrive/web/async_web/_browser.py
|
|
46
|
-
mangoautomation/uidrive/web/async_web/_customization.py
|
|
47
|
-
mangoautomation/uidrive/web/async_web/_element.py
|
|
48
|
-
mangoautomation/uidrive/web/async_web/_input_device.py
|
|
49
|
-
mangoautomation/uidrive/web/async_web/_new_browser.py
|
|
50
|
-
mangoautomation/uidrive/web/async_web/_page.py
|
|
51
|
-
mangoautomation/uidrive/web/sync_web/__init__.py
|
|
52
|
-
mangoautomation/uidrive/web/sync_web/_assertion.py
|
|
53
|
-
mangoautomation/uidrive/web/sync_web/_browser.py
|
|
54
|
-
mangoautomation/uidrive/web/sync_web/_customization.py
|
|
55
|
-
mangoautomation/uidrive/web/sync_web/_element.py
|
|
56
|
-
mangoautomation/uidrive/web/sync_web/_input_device.py
|
|
57
|
-
mangoautomation/uidrive/web/sync_web/_new_browser.py
|
|
58
|
-
mangoautomation/uidrive/web/sync_web/_page.py
|
|
59
|
-
tests/__init__.py
|
|
60
|
-
tests/get_ope.py
|
|
61
|
-
tests/test_ui_and.py
|
|
62
|
-
tests/test_ui_web.py
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# @Project: 芒果测试平台
|
|
3
|
-
# @Description:
|
|
4
|
-
# @Time : 2025-04-12 17:31
|
|
5
|
-
# @Author : 毛鹏
|
|
6
|
-
import asyncio
|
|
7
|
-
import unittest
|
|
8
|
-
|
|
9
|
-
from mangoautomation.models import ElementModel
|
|
10
|
-
from mangoautomation.uidrive import AsyncElement, BaseData, DriverObject, SyncElement
|
|
11
|
-
from mangotools.data_processor import DataProcessor
|
|
12
|
-
from mangotools.log_collector import set_log
|
|
13
|
-
|
|
14
|
-
log = set_log('D:\GitCode\mango_automation\logs')
|
|
15
|
-
test_data = DataProcessor()
|
|
16
|
-
element_model_1 = ElementModel(**{
|
|
17
|
-
"id": 9,
|
|
18
|
-
"type": 0,
|
|
19
|
-
"name": "搜索结果",
|
|
20
|
-
"loc": "get_by_role(\"link\", name=\"芒果自动化测试平台: 芒果测试平台是UI和API的自动化测试\")",
|
|
21
|
-
"exp": 2,
|
|
22
|
-
"sleep": None,
|
|
23
|
-
"sub": None,
|
|
24
|
-
"is_iframe": 0,
|
|
25
|
-
"ope_key": "w_open_new_tab_and_switch",
|
|
26
|
-
"ope_value": [
|
|
27
|
-
{
|
|
28
|
-
"f": "locating",
|
|
29
|
-
"p": None,
|
|
30
|
-
"d": False,
|
|
31
|
-
"v": ""
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
"key_list": None,
|
|
35
|
-
"sql": None,
|
|
36
|
-
"key": None,
|
|
37
|
-
"value": None
|
|
38
|
-
})
|
|
39
|
-
element_model_2 = ElementModel(**{
|
|
40
|
-
"id": 10, "type": 2, "name": "结果内容", "loc": "get_by_role(\"heading\", name=\"芒果测试平台是集UI,API\")",
|
|
41
|
-
"exp": 0,
|
|
42
|
-
"sleep": None, "sub": None, "is_iframe": 0, "ope_key": "w_get_text",
|
|
43
|
-
"ope_value": [{"f": "locating", "p": None, "d": False, "v": ""},
|
|
44
|
-
{"f": "set_cache_key", "p": None, "d": True, "v": "结果内容"}]
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
class TestUi(unittest.IsolatedAsyncioTestCase):
|
|
49
|
-
async def test_a(self):
|
|
50
|
-
driver_object = DriverObject(True)
|
|
51
|
-
driver_object.set_web(0, r"C:\Program Files\Google\Chrome\Application\chrome.exe")
|
|
52
|
-
base_data = BaseData(test_data, log)
|
|
53
|
-
base_data.log = log
|
|
54
|
-
base_data.url = 'https://www.baidu.com/'
|
|
55
|
-
|
|
56
|
-
base_data.context, base_data.page = await driver_object.web.new_web_page()
|
|
57
|
-
element = AsyncElement(base_data, element_model_1, 0)
|
|
58
|
-
await element.open_url()
|
|
59
|
-
await asyncio.sleep(5)
|
|
60
|
-
await element.element_main()
|
|
61
|
-
print(element.element_result_model.model_dump())
|
|
62
|
-
element = AsyncElement(base_data, element_model_2, 0)
|
|
63
|
-
await element.element_main()
|
|
64
|
-
print(element.element_result_model.model_dump())
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
class TestUi2(unittest.TestCase):
|
|
68
|
-
|
|
69
|
-
def test_s(self):
|
|
70
|
-
driver_object = DriverObject()
|
|
71
|
-
driver_object.set_web(0, r"C:\Program Files\Google\Chrome\Application\chrome.exe")
|
|
72
|
-
base_data = BaseData(test_data, log)
|
|
73
|
-
base_data.url = 'https://www.baidu.com/'
|
|
74
|
-
base_data.context, base_data.page = driver_object.web.new_web_page()
|
|
75
|
-
element = SyncElement(base_data, element_model_1, 0)
|
|
76
|
-
element.open_url()
|
|
77
|
-
element.element_main()
|
|
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
|
{mangoautomation-1.1.21 → mangoautomation-1.1.22}/mangoautomation.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|