Skip to content

Commit fe088bd

Browse files
committed
update duid
1 parent c55013f commit fe088bd

16 files changed

Lines changed: 56 additions & 52 deletions

‎Base/BaseApk.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def getApkName(self):
6464

6565
if __name__ == '__main__':
6666
pass
67-
apkPath = '../app/VivaVideo_7.3.0.apk'
67+
apkPath = '/Users/zhulixin/Downloads/XiaoYing_lite_google_V1.0.0_2-googleplay-OthersAbroadRelease-2018-09-12_16_55_51.apk'
6868
litePath = '/Users/zhulixin/Downloads/XiaoYing_lite.apk'
6969

7070
info = ApkInfo(apkPath)

‎Base/BaseElements.py‎

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class Element(object):
2222
find_elements_by_xpath = "xpaths"
2323

2424
CLICK = "click"
25+
IGNORE = 'ignore'
26+
REPEAT = 'repeat'
2527
TAP = "tap"
2628
ACCESSIBILITY = "accessibility"
2729
ADB_TAP = "adb_tap"
@@ -61,22 +63,3 @@ class Element(object):
6163
SUM_FILE = "sum.pickle"
6264
DEVICES_FILE = "devices.pickle"
6365
REPORT_FILE = "Report.xlsx"
64-
65-
66-
#启动页
67-
68-
#首页
69-
c_btn = 'com.quvideo.xiaoying:id/img_creation'
70-
el_home_vip = 'com.quvideo.xiaoying:id/btn_vip'
71-
el_home_ad = 'com.quvideo.xiaoying:id/btn_shuffle'
72-
el_home_edit = 'com.quvideo.xiaoying:id/icon1'
73-
el_home_cam = 'com.quvideo.xiaoying:id/icon2'
74-
'com.quvideo.xiaoying:id/xiaoying_alert_dialog_positive'
75-
#Gallery
76-
77-
#Camera
78-
79-
#工作室
80-
el_studio_more = 'com.quvideo.xiaoying:id/btn_more'
81-
82-
#订阅

‎Base/BaseInit.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
os.path.join(os.path.dirname(__file__), p)
1111
)
1212

13-
apkPath = PATH("../app/VivaVideo_7.3.0.apk") # 测试的app路径
13+
apkPath = PATH("../app/VivaVideo_7.3.1.apk") # 测试的app路径
1414
ipaPath = PATH("../app/xiaoying.ipa") # 测试的app路径
1515

1616
def mk_file(platform):

‎Base/BaseIosLog.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
)
1111

1212
class iOSLog:
13-
def __init__(self, udid):
14-
get_phone = get_ios_PhoneInfo(udid)
15-
phone_name = get_phone["device"] + "_" + get_phone["release"] + "_" + "iOS" + "_" + get_phone["udid"]
13+
def __init__(self, duid):
14+
get_phone = get_ios_PhoneInfo(duid)
15+
phone_name = get_phone["device"] + "_" + get_phone["release"] + "_" + "iOS" + "_" + get_phone["duid"]
1616
global logger, resultPath, logPath
1717
resultPath = PATH("../Log/")
1818
logPath = os.path.join(resultPath, (phone_name + "_" + time.strftime('%Y%m%d%H%M%S', time.localtime())))
@@ -36,7 +36,7 @@ def __init__(self, udid):
3636
if not os.path.exists(crashPath):
3737
os.makedirs(crashPath)
3838
syslog_path = os.path.join(crashPath, "syslog.log")
39-
sys_cmd = 'idevicesyslog -u ' + get_phone["udid"] + " |grep 'XiaoYing' > %s" % (syslog_path)
39+
sys_cmd = 'idevicesyslog -u ' + get_phone["duid"] + " |grep 'XiaoYing' > %s" % (syslog_path)
4040
os.popen(sys_cmd)
4141

4242
def getMyLogger(self):
@@ -166,10 +166,10 @@ def __init__(self):
166166
pass
167167

168168
@staticmethod
169-
def getLog(udid):
169+
def getLog(duid):
170170
if myIosLog.log is None:
171171
myIosLog.mutex.acquire()
172-
myIosLog.log = iOSLog(udid)
172+
myIosLog.log = iOSLog(duid)
173173
myIosLog.mutex.release()
174174
return myIosLog.log
175175

‎Base/BaseIosPhone.py‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ def get_ios_devices():
1919
return devices
2020

2121

22-
def get_ios_version(udid):
23-
command = "ideviceinfo -u %s -k ProductVersion" % udid
22+
def get_ios_version(duid):
23+
command = "ideviceinfo -u %s -k ProductVersion" % duid
2424
result = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,
2525
stderr=subprocess.PIPE).stdout.readlines()
2626
for item in result:
@@ -29,26 +29,26 @@ def get_ios_version(udid):
2929
return t[0]
3030

3131

32-
def get_ios_product_name(udid):
33-
command = "ideviceinfo -u %s -k DeviceName" % udid
32+
def get_ios_product_name(duid):
33+
command = "ideviceinfo -u %s -k DeviceName" % duid
3434
result = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,
3535
stderr=subprocess.PIPE).stdout.readlines()
3636
for item in result:
3737
t = item.decode().split("\n")
3838
if len(t) >= 2:
3939
return t[0]
4040

41-
def get_ios_product_type(udid):
42-
command = "ideviceinfo -u %s -k ProductType" % udid
41+
def get_ios_product_type(duid):
42+
command = "ideviceinfo -u %s -k ProductType" % duid
4343
result = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,
4444
stderr=subprocess.PIPE).stdout.readlines()
4545
for item in result:
4646
t = item.decode().split("\n")
4747
if len(t) >= 2:
4848
return t[0]
4949

50-
def get_ios_product_os(udid):
51-
command = "ideviceinfo -u %s -k ProductName" % udid
50+
def get_ios_product_os(duid):
51+
command = "ideviceinfo -u %s -k ProductName" % duid
5252
result = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,
5353
stderr=subprocess.PIPE).stdout.readlines()
5454
for item in result:
@@ -57,23 +57,23 @@ def get_ios_product_os(udid):
5757
return t[0]
5858

5959

60-
def get_ios_PhoneInfo(udid):
61-
name = get_ios_product_name(udid)
62-
release = get_ios_version(udid)
63-
# type = get_ios_product_type(udid)
64-
result = {"release": release, "device": name, "udid": udid}
60+
def get_ios_PhoneInfo(duid):
61+
name = get_ios_product_name(duid)
62+
release = get_ios_version(duid)
63+
# type = get_ios_product_type(duid)
64+
result = {"release": release, "device": name, "duid": duid}
6565
# print(result)
6666
return result
6767

6868
#编译facebook的wda到真机
69-
def build_wda_ios(udid):
69+
def build_wda_ios(duid):
7070
os.popen(
71-
"xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=" + udid + " test")
71+
"xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=" + duid + " test")
7272

7373

7474
if __name__ == '__main__':
7575
devices = get_ios_devices()
7676
print(devices)
77-
udid = get_ios_devices()[0]
78-
get_ios_PhoneInfo(udid)
77+
duid = get_ios_devices()[0]
78+
get_ios_PhoneInfo(duid)
7979

‎Base/BaseOperate.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ def operate_by(self, operate, testInfo, logTest, device):
9090
be.SWIPE_RIGHT: lambda: self.swipeToRight(),
9191
be.SWIPE_LEFT: lambda: self.swipeToLeft(operate.get("element_info")),
9292
be.CLICK: lambda: self.click(operate),
93+
be.IGNORE: lambda: self.ignore(operate),
94+
be.REPEAT: lambda: self.repeat(operate),
9395
be.SCREEN_TAP:lambda: self.screen_tap(200,200),
9496
be.GET_VALUE: lambda: self.get_value(operate),
9597
be.SET_VALUE: lambda: self.set_value(operate),
@@ -153,6 +155,24 @@ def click(self, mOperate):
153155
self.elements_by(mOperate)[mOperate["index"]].click()
154156
return {"result": True}
155157

158+
# 忽略不存在的元素
159+
def ignore(self, mOperate):
160+
if self.click(mOperate):
161+
pass
162+
else:
163+
pass
164+
return {"result": True}
165+
166+
# 重复执行多次操作,默认三次
167+
def repeat(self, mOperate):
168+
try:
169+
for i in range(3):
170+
self.click(mOperate)
171+
return {"result": True}
172+
except:
173+
print('操作失败了,请重试该操作')
174+
return {"result": False}
175+
156176
# code 事件
157177
def press_keycode(self, mOperate):
158178
self.driver.press_keycode(mOperate.get("code", 0))

‎Base/BaseReplace.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ def ReplaceYaml(yaml, newyaml, el_lists):
7777

7878

7979
if __name__ == "__main__":
80-
yaml = PATH("../yamls/home/secondOpen.yaml")
81-
newyaml = PATH("../yamls/home/new.yaml")
80+
yaml = PATH("../yamls/test_home/secondOpen.yaml")
81+
newyaml = PATH("../yamls/test_home/new.yaml")
8282
el_lists = PATH("../yamls/el_android.yaml")
8383

8484
ReplaceYaml(yaml, newyaml, el_lists)

‎Base/BaseRunner.py‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,17 @@ def setUpClass(cls):
5959
cls.platformName = 'iOS'
6060
cls.logTest = myIosLog().getLog(cls.udid) # 每个设备实例化一个日志记录器
6161

62-
def setUp(self):
63-
pass
62+
# def setUp(self):
63+
# pass
6464

6565
@classmethod
6666
def tearDownClass(cls):
67-
cls.driver.close_app()
68-
cls.driver.quit()
69-
pass
70-
def tearDown(self):
7167
pass
68+
cls.driver.close_app()
69+
# cls.driver.quit()
70+
71+
# def tearDown(self):
72+
# pass
7273

7374
@staticmethod
7475
def parametrize(testcase_klass, param=None):
84 Bytes
Binary file not shown.
-271 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)