-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from kaluluosi/ios_connect
Ios connect
- Loading branch information
Showing
19 changed files
with
614 additions
and
372 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,3 +123,4 @@ output.xml | |
report.html | ||
.airtest | ||
log*.js | ||
tests/demo/com.netease.poco.u3d.tutorial_Data/output_log.txt |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "robotframework-airtest" | ||
version = "0.1.2" | ||
version = "0.2.0" | ||
description = "网易Airtest/pocoui的Robotframework测试库" | ||
authors = ["kaluluosi <[email protected]>"] | ||
license = "MIT" | ||
|
@@ -15,7 +15,7 @@ unity = "robotframework_airtest.vmg.generators.unity:generate" | |
android = "robotframework_airtest.device.connects.impl.android:AndroidConnectStrategy" | ||
windows = "robotframework_airtest.device.connects.impl.windows:WindowsConnectStrategy" | ||
unity = "robotframework_airtest.device.connects.impl.unity:UnityConnectStrategy" | ||
|
||
ios = "robotframework_airtest.device.connects.impl.ios:IOSConnectStrategy" | ||
|
||
[tool.poetry.scripts] | ||
ra = "robotframework_airtest.cli:main" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from typing import cast | ||
from airtest.core.device import Device | ||
from airtest.core.ios import IOS | ||
from robot.api import logger | ||
from airtest.core.api import connect_device | ||
from airtest.core.helper import G | ||
from ..connect_strategy import ConnectStrategyBase | ||
|
||
|
||
class IOSConnectStrategy(ConnectStrategyBase): | ||
""" | ||
iOS连接策略 | ||
""" | ||
|
||
def connect(self, auto_start_app: bool = False) -> Device: | ||
self.device = connect_device(self.device_uri) | ||
self.device = cast(IOS, self.device) | ||
logger.console(f"设备<{self.device_uri}>:连接") | ||
|
||
self.device.unlock() | ||
|
||
if auto_start_app: | ||
app_list = self.device.list_app() | ||
if self.pkg_name not in app_list: | ||
logger.error(f"设备<{self.device}>:未安装{self.pkg_name},启动失败") | ||
else: | ||
logger.info(f"设备<{self.device}>:关闭app<{self.pkg_name}>") | ||
self.device.stop_app(self.pkg_name) | ||
logger.info(f"设备<{self.device}>:启动app<{self.pkg_name}>") | ||
self.device.start_app(self.pkg_name) | ||
|
||
return self.device | ||
|
||
def disconnect(self): | ||
if self.is_connected and self.pkg_name: | ||
try: | ||
self.device.stop_app(self.pkg_name) | ||
except Exception as e: | ||
logger.warn(f"APP没有运行,没有停止:{e}") | ||
|
||
G.DEVICE_LIST.remove(self.device) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from poco.drivers.std import StdPoco | ||
from .std import StdPocoLibrary | ||
|
||
from poco.drivers.android.uiautomation import AndroidUiautomationPoco | ||
|
||
|
||
class AndroidUiAutomationPocoLibrary(StdPocoLibrary): | ||
def _create_poco(self) -> StdPoco: | ||
return AndroidUiautomationPoco() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from poco.drivers.std import StdPoco | ||
from .std import StdPocoLibrary | ||
from poco.drivers.cocosjs import CocosJsPoco, CocosJsPocoAgent | ||
|
||
|
||
class CocosJsPocoLibrary(StdPocoLibrary): | ||
def _create_poco(self) -> StdPoco: | ||
agent = CocosJsPocoAgent(self.addr[1]) | ||
poco = CocosJsPoco(agent) | ||
return poco |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from poco.drivers.std import StdPoco | ||
from .std import StdPocoLibrary | ||
|
||
from poco.drivers.ios import iosPoco | ||
|
||
|
||
class IOSPocoLibrary(StdPocoLibrary): | ||
def _create_poco(self) -> StdPoco: | ||
return iosPoco() |
Oops, something went wrong.