How to use accessibility method in Playwright Python

Best Python code snippet using playwright-python

stg_tc_iPhone7_ios11.py

Source:stg_tc_iPhone7_ios11.py Github

copy

Full Screen

1#coding=utf-82#test purpose : verify the main features on iPhone3#os: iOS4#device: iPhone75#version:iOS11.3.16#author: Sam Wang7#update date: created by Sam [2018-11-22]8import unittest9import time10import os11import random12from time import sleep13from appium import webdriver14from selenium.webdriver.common.desired_capabilities import DesiredCapabilities15from appium.webdriver.common.touch_action import TouchAction16from HTMLTestReportEN import HTMLTestRunner17from common_iPhone7_ios11_stg import fun_myfansui_check18from common_iPhone7_ios11_stg import fun_mywatchui_check19from common_iPhone7_ios11_stg import fun_mypublishui_check20from common_iPhone7_ios11_stg import bp_is_loggedin21from common_iPhone7_ios11_stg import fun_getinfo22from common_iPhone7_ios11_stg import bp_normalloginmp23from common_iPhone7_ios11_stg import bp_is_loginshow24from common_iPhone7_ios11_stg import fun_getloginmenu25from common_iPhone7_ios11_stg import bp_is_plusexist26from common_iPhone7_ios11_stg import bp_is_publishnowexist27from common_iPhone7_ios11_stg import bp_is_openmultichatexist28from common_iPhone7_ios11_stg import fun_findui_check29from common_iPhone7_ios11_stg import fun_personalinfoui_check30from common_iPhone7_ios11_stg import fun_scoredetailui_check31from common_iPhone7_ios11_stg import fun_giftui_check32from common_iPhone7_ios11_stg import fun_articleui_check33from common_iPhone7_ios11_stg import fun_cartui_check34from common_iPhone7_ios11_stg import fun_pgcui_check35#from common_iPhone7_ios11_stg import fun_articledetailui_check36#from common_iPhone7_ios11_stg import fun_giftorderui_check37#from common_iPhone7_ios11_stg import fun_giftorderdetailui_check38from common_iPhone7_ios11_stg import fun_getjingxiloginmenu39# Returns abs path relative to this file and not cwd40PATH = lambda p: os.path.abspath(41 os.path.join(os.path.dirname(__file__), p)42)43class Weilai_test(unittest.TestCase):44 def setUp(self):45 desired_caps = {}46 desired_caps['platformName'] = 'iOS'47 desired_caps['browserName']=''48 desired_caps['automationName'] = 'XCUITest'49 desired_caps['platformVersion'] = '11.3'50 desired_caps['deviceName'] = 'iPhone7B'51 desired_caps['app'] = os.path.abspath('../../test_data/app/ios_package/NextevCarInhouseQA.ipa')52 desired_caps['udid'] = '538a602ef0730186afc7c89cd6b38120409114f2'53 desired_caps['noReset'] = True54 #desired_caps['clearSystemFiles'] = True55 desired_caps['xcodeOrgId'] = 'L8MRL9B64V'56 #desired_caps['xcodeSigning'] = 'iPhone Developer'57 self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)58 self.driver.implicitly_wait(15)59 sleep(2)60 def tearDown(self):61 # end the session62 self.driver.quit()63#*******************************************************64#TC Name:test_wode_fans_tc00165#Purpose:检查我的页面点击粉丝后弹出页面的各项功能66#OS:iOS67#Device:iPhone768#Pre-conditions:用户已正常登录app69#Post-conditions:N/A70#Modify History:created by Sam [2018/08/13]71#*******************************************************72 def test_wode_fans_tc001(self):73 driver=self.driver74 print('TC_检查用户模式打开APP,检查点:我的_粉丝功能----step1检查我的页面点击粉丝后页面各个元素是否存在')75 print('step2取消互相关注/关注;step3检查被取消互相关注/关注的粉丝关系是否变成+关注/互相关注')76 now=time.strftime('%Y-%m-%d %H_%M_%S')77 print('TC_我的_粉丝页面元素检查和取消互相关注/+关注功能检查----开始:'+now)78 sleep(2)79 driver.find_element_by_accessibility_id('返回').click()80 sleep(2)81 #我的82 driver.find_element_by_accessibility_id('我的').click()83 sleep(3)84 #粉丝85 #driver.find_element_by_xpath('//XCUIElementTypeTable/XCUIElementTypeOther/XCUIElementTypeButton[5]').click()86 driver.find_element_by_accessibility_id('粉丝').click()87 sleep(3)88 #检查粉丝面的各个元素是否存在89 c1=fun_myfansui_check(self)90 sleep(2)91 if c1 == True:92 print('粉丝页面上各个被检查元素都检查完毕')93 sleep(1)94 #取消互相关注95 driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"Sam")]')[0].click()96 sleep(3)97 #...98 driver.find_element_by_accessibility_id('icon more white').click()99 sleep(1)100 driver.find_element_by_accessibility_id('取消关注').click()101 sleep(1)102 #check the message of toast103 n1=driver.find_elements_by_accessibility_id('取消成功')104 if len(n1) != 0:105 print('取消关注的功能检查通过--聊天-->关注')106 sleep(1)107 else:108 print('取消关注的功能检查失败,请检查原因')109 sleep(1)110 now=time.strftime('%Y-%m-%d %H_%M_%S')111 sf2='../../test_report/ios/'+now+'_errorCancelWatch_R_stg_tc001.png'112 driver.get_screenshot_as_file(sf2)113 sleep(2)114 driver.find_element_by_accessibility_id('full screen back icon').click()115 sleep(2)116 #+关注117 driver.find_element_by_accessibility_id('关注').click()118 sleep(1)119 #check the message of toast120 n2=driver.find_elements_by_accessibility_id('关注成功')121 if len(n2) != 0:122 print('+关注的功能检查通过--关注-->聊天')123 sleep(1)124 else:125 print('+关注的功能检查失败,请检查原因')126 sleep(1)127 now=time.strftime('%Y-%m-%d %H_%M_%S')128 sf2='../../test_report/ios/'+now+'_errorPlusWatch_R_stg_tc001.png'129 driver.get_screenshot_as_file(sf2)130 sleep(1)131 driver.find_element_by_accessibility_id('all page back black icon').click()132 sleep(1)133 now=time.strftime('%Y-%m-%d %H_%M_%S')134 print('TC_我的_粉丝页面元素检查和取消互相关注/+关注功能检查----结束:'+now)135#*******************************************************136#TC Name:test_wode_watch_tc002137#Purpose:检查我的页面点击关注后弹出页面的各项功能138#OS:iOS139#Device:iPhone7140#Pre-conditions:用户已正常登录app141#Post-conditions:N/A142#Modify History:created by Sam [2018/08/10]143#*******************************************************144 def test_wode_watch_tc002(self):145 driver=self.driver146 print('TC_检查用户模式打开APP,检查点:我的_关注功能----step1检查我的页面点击发布后页面各个元素是否存在')147 print('step2检查取消关注是否成功;step3检查加关注是否成功')148 now=time.strftime('%Y-%m-%d %H_%M_%S')149 print('TC_我的_关注页面元素检查和取消关注和加关注的功能----开始:'+now)150 sleep(2)151 driver.find_element_by_accessibility_id('返回').click()152 sleep(2)153 #我的154 driver.find_element_by_accessibility_id('我的').click()155 sleep(3)156 #关注157 driver.find_element_by_accessibility_id('关注').click()158 #driver.find_element_by_xpath('//XCUIElementTypeTable/XCUIElementTypeOther/XCUIElementTypeButton[4]').click()159 sleep(3)160 #检查发布关注面的各个元素是否存在161 c1=fun_mywatchui_check(self)162 sleep(2)163 if c1==True:164 print('关注页面上各个被检查元素都正常显示.')165 sleep(2)166 #取消关注167 driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"Sam")]')[0].click()168 sleep(3)169 #...170 driver.find_element_by_accessibility_id('icon more white').click()171 sleep(1)172 driver.find_element_by_accessibility_id('取消关注').click()173 sleep(1)174 #check the toast175 n=driver.find_elements_by_accessibility_id('取消成功')176 if len(n) != 0:177 print('取消互相关注的功能检查通过--聊天-->关注')178 sleep(1)179 else:180 print('取消互相关注的功能检查失败,请检查原因')181 sleep(1)182 now=time.strftime('%Y-%m-%d %H_%M_%S')183 sf1='../../test_report/ios/'+now+'_errorCancelMuCare_R_tc002.png'184 driver.get_screenshot_as_file(sf1)185 sleep(2)186 driver.find_element_by_accessibility_id('full screen back icon').click()187 sleep(2)188 #+关注189 driver.find_element_by_accessibility_id('关注').click()190 sleep(1)191 m=driver.find_elements_by_accessibility_id('关注成功')192 if len(m) != 0:193 print('+关注的功能检查通过--关注-->聊天')194 sleep(1)195 else:196 print('+关注的功能检查失败,请检查原因')197 sleep(1)198 now=time.strftime('%Y-%m-%d %H_%M_%S')199 sf1='../../test_report/ios/'+now+'_errorAddCare_R_tc002.png'200 driver.get_screenshot_as_file(sf1)201 sleep(2)202 """203 #-关注204 driver.find_element_by_accessibility_id('已关注').click()205 sleep(1)206 m2=driver.find_elements_by_accessibility_id('取消成功')207 if len(m2) != 0:208 print('取消关注的功能检查通过--已关注-->关注')209 sleep(1)210 else:211 print('取消关注的功能检查失败,请检查原因')212 sleep(1)213 now=time.strftime('%Y-%m-%d %H_%M_%S')214 sf1='../../test_report/ios/'+now+'_errorCancelCare_R_tc002.png'215 driver.get_screenshot_as_file(sf1)216 sleep(1)217 """218 driver.find_element_by_accessibility_id('all page back black icon').click()219 sleep(1)220 now=time.strftime('%Y-%m-%d %H_%M_%S')221 print('TC_我的_关注页面元素检查和取消关注和加关注的功能----结束:'+now)222#*******************************************************223#TC Name:test_wode_publish_tc003224#Purpose:检查我的页面点击发布后弹出页面的各项功能225#OS:iOS226#Device:iPhone7227#Pre-conditions:用户已正常登录app228#Post-conditions:N/A229#Modify History:created by Sam [2018/08/10]230#*******************************************************231 def test_wode_publish_tc003(self):232 driver=self.driver233 print('TC_检查用户模式打开APP,检查点:我的_发布功能----step1检查我的页面点击发布后页面各个元素是否存在')234 print('step2发布功能是否正常;step3检查发布内容里是否可以一次最大上传9张图片;step4检查发布文字是否正确')235 now=time.strftime('%Y-%m-%d %H_%M_%S')236 print('TC_我的_发布页面元素检查和发布功能----开始:'+now)237 sleep(2)238 driver.find_element_by_accessibility_id('返回').click()239 sleep(2)240 #我的241 driver.find_element_by_accessibility_id('我的').click()242 sleep(2)243 #发布244 driver.find_element_by_accessibility_id('发布').click()245 #driver.find_element_by_xpath('//XCUIElementTypeTable/XCUIElementTypeOther/XCUIElementTypeButton[3]').click()246 sleep(2)247 #检查发布页面的各个元素是否存在248 c1=fun_mypublishui_check(self)249 sleep(2)250 if c1==True:251 print('发布页面上各个被检查元素都正常显示.')252 sleep(1)253 #发布254 #driver.find_element_by_ios_predicate('type==XCUIElementTypeButton AND name=="icon camera"').click()255 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="icon camera"]').click()256 sleep(3)257 #+258 driver.execute_script("mobile: tap", {"touchCount":"1", "x":55, "y":264})259 sleep(2)260 #好261 allow=driver.find_elements_by_accessibility_id('好')262 if len(allow) != 0:263 driver.find_element_by_accessibility_id('好').click()264 sleep(2)265 sleep(1)266 try:267 for i in range(9):268 #driver.find_elements_by_xpath('//XCUIElementTypeButton[@name="compose guide check box defaul"]')[i].click()269 driver.find_elements_by_ios_predicate('name=="compose guide check box defaul"')[i].click()270 sleep(1)271 sleep(1)272 driver.find_element_by_accessibility_id('完成(9/9)').click()273 sleep(2)274 word=driver.find_element_by_xpath('//XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeScrollView/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTextView')275 sleep(2)276 word.click()277 sleep(1)278 now0=time.strftime('%Y-%m-%d %H_%M_%S')279 word.send_keys('I love Shanghai_评论_'+now0)280 t0='I love Shanghai_评论_'+now0281 sleep(1)282 driver.find_element_by_accessibility_id('发布').click()283 sleep(9)284 #ios doesn't need to refresh285 #check numbers of pictures and published text here286 title=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,t0)]')287 sleep(2)288 #print(t0)289 if len(title) != 0 :290 print('发布内容的文字检查通过')291 sleep(1)292 else:293 print('发布内容的文字检查失败,请检查原因')294 sleep(1)295 now=time.strftime('%Y-%m-%d %H_%M_%S')296 sf1='../../test_report/ios/'+now+'_errorPublishText_R_stg_tc003.png'297 driver.get_screenshot_as_file(sf1)298 sleep(2)299 number=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="9"]')300 #print(number.text)301 if len(number) != 0:302 print('发布内容的上传9张图片检查通过')303 sleep(1)304 else:305 print('发布内容的上传9张图片检查失败,请检查原因')306 sleep(1)307 now=time.strftime('%Y-%m-%d %H_%M_%S')308 sf2='../../test_report/ios/'+now+'_errorPublishPicture9_R_stg_tc003.png'309 driver.get_screenshot_as_file(sf2)310 sleep(1)311 driver.find_element_by_accessibility_id('all page back black icon').click()312 sleep(1)313 except Exception as e:314 print('发生异常:'+str(e))315 sleep(1)316 pass317 now=time.strftime('%Y-%m-%d %H_%M_%S')318 print('TC_我的_发布页面元素检查和发布功能----结束:'+now)319#*******************************************************320#TC Name:test_wode_loginmp_tc004321#Purpose:检查用户用手机号+验证码重新登录app的功能322#OS:iOS323#Device:iPhone7324#Pre-conditions:用户已正常登录app/未登录325#Post-conditions:N/A326#Modify History:created by Sam [2018/08/13]327#*******************************************************328 def test_wode_loginmp_tc004(self):329 driver=self.driver330 print('TC_检查手机号码登录APP,检查点:我的页面里用手机号码重新登录,如果已登录先退出账号----step1检查用户是否已经登录')331 print('step2如果用户已经登录则退出原来账号;step3选择用手机号+验证码登录;step4检查登录的账号是否正确')332 now=time.strftime('%Y-%m-%d %H_%M_%S')333 print('客户重新登录账号----开始:'+now)334 sleep(1)335 driver.find_element_by_accessibility_id('返回').click()336 sleep(1)337 #f=fun_getinfo(self)338 #sleep(2)339 g=bp_is_loggedin(self)340 sleep(2)341 #登录页面342 driver.execute_script("mobile: tap", {"touchCount":"1", "x":67, "y":100})343 sleep(1)344 mobile_no=driver.find_elements_by_class_name('XCUIElementTypeTextField')[0]345 mobile_no.click()346 sleep(1)347 mobile_no.send_keys('98762396871')348 sleep(1)349 code=driver.find_elements_by_class_name('XCUIElementTypeTextField')[1]350 code.click()351 sleep(1)352 #code.send_keys(f[1])353 code.send_keys('867129')354 #完成355 #driver.find_element_by_accessibility_id('Toolbar Done Button').click()356 sleep(1)357 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="注册/登录"]').click()358 sleep(5)359 driver.find_element_by_accessibility_id('返回').click()360 sleep(2)361 #driver.swipe(50,300,50,700,1000)362 #sleep(2)363 name=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="SamSTG"]')364 if len(name) != 0:365 print('登录成功!')366 sleep(1)367 else:368 print('登录失败!')369 sleep(1)370 now=time.strftime('%Y-%m-%d %H_%M_%S')371 sf='../../test_report/ios/'+now+'_errornormalLogin_R_stg_tc004.png'372 driver.get_screenshot_as_file(sf)373 sleep(1)374 now=time.strftime('%Y-%m-%d %H_%M_%S')375 print('TC_客户重新登录账号----结束:'+now)376#*******************************************************377#TC Name:test_wode_visitor_tc005378#Purpose:检查访客模式点击我的页面各个菜单的预期动作379#OS:iOS380#Device:iPhone7381#Pre-conditions:用户已正常登录app/未登录382#Post-conditions:N/A383#Modify History:created by Sam [2018/08/13]384#*******************************************************385 def test_wode_visitor_tc005(self):386 driver=self.driver387 print('TC_访客模式点击我的页面各个菜单,检查点:点击我的页面各个菜单是否跳转到用户登录页面----step1检查用户是否已经登录')388 print('step2如果用户已经登录则退出原来账号;step3点击我的页面;step4从excel文件读取要检查的各个菜单名称,')389 print('依次点击检查是否会跳转到用户登录界面;step5点击加入蔚来跳转页面是否正常显示;step6点击设置弹出页面是否正常显示;')390 print('step7用原来账号和验证码重新登录app')391 now=time.strftime('%Y-%m-%d %H_%M_%S')392 print('我的_访客模式点击我的页面各个菜单跳转页面----开始:'+now)393 sleep(1)394 ret=driver.find_elements_by_accessibility_id('返回')395 if len(ret) != 0:396 driver.find_element_by_accessibility_id('返回').click()397 sleep(2)398 bp_is_loggedin(self)399 sleep(2)400 #我的401 driver.find_element_by_accessibility_id('我的').click()402 sleep(2)403 menu_name=fun_getloginmenu(self)404 sleep(1)405 driver.execute_script("mobile: dragFromToForDuration",{"fromX":50,"fromY":500,"toX":50,"toY":450,"duration":1.0})406 sleep(2)407 #check the menu by turn408 for j in range(1,9):409 menu=driver.find_element_by_accessibility_id(menu_name[j])410 menu.click()411 sleep(2)412 print('检查的菜单名称:'+menu_name[j])413 bp_is_loginshow(self)414 driver.find_element_by_accessibility_id('all page back black icon').click()415 sleep(2)416 driver.execute_script("mobile: dragFromToForDuration",{"fromX":50,"fromY":550,"toX":50,"toY":250,"duration":1.0})417 sleep(2)418 #加入蔚来419 driver.find_element_by_accessibility_id('加入蔚来').click()420 sleep(9)421 #所有职位422 tl=driver.find_elements_by_xpath('//XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther/XCUIElementTypeOther[4]')423 if len(tl) == 0:424 print('访客模式点击加入蔚来跳转页面不正常,请检查')425 sleep(1)426 now=time.strftime('%Y-%m-%d %H_%M_%S')427 sf0='../../test_report/ios/'+now+'_errorJoinNIO_R_stg_tc005.png'428 driver.get_screenshot_as_file(sf0)429 else:430 print('访客模式点击加入蔚来跳转页面正常显示')431 sleep(2)432 driver.find_element_by_accessibility_id('返回“蔚来Test”').click()433 sleep(2)434 #设置435 driver.find_element_by_accessibility_id('设置').click()436 sleep(2)437 out=driver.find_elements_by_accessibility_id('退出登录')438 if len(out) != 0:439 print('访客模式点击设置跳转页面不正常,请检查')440 sleep(1)441 now=time.strftime('%Y-%m-%d %H_%M_%S')442 sf1='../../test_report/ios/'+now+'_errorSettings_R_stg_tc005.png'443 driver.get_screenshot_as_file(sf1)444 else:445 print('访客模式点击设置跳转页面正常显示')446 sleep(2)447 driver.find_element_by_accessibility_id('all page back black icon').click()448 sleep(2)449 bp_normalloginmp(self)450 sleep(1)451 now=time.strftime('%Y-%m-%d %H_%M_%S')452 print('TC_我的_访客模式点击我的页面各个菜单跳转页面----结束:'+now)453#*******************************************************454#TC Name:test_faxian_publishnow_tc006455#Purpose:检查发现页面的发布功能456#OS:iOS457#Device:iPhone7458#Pre-conditions:用户已正常登录app459#Post-conditions:N/A460#Modify History:created by Sam [2018/08/17]461#*******************************************************462 def test_faxian_publishnow_tc006(self):463 driver=self.driver464 print('TC_检查手机号码登录APP,检查点:发现_发布此刻功能----step1检查发现首页右上角+号是否存在')465 print('step2检查发布此刻按钮是否存在;step3发布功能是否正常;step4检查发布内容里是否可以一次最大上传9张图片')466 print('step5检查发布文字是否正确')467 now=time.strftime('%Y-%m-%d %H_%M_%S')468 print('TC_发现_发布此刻----开始:'+now)469 sleep(1)470 driver.find_element_by_accessibility_id('返回').click()471 sleep(2)472 #发现473 #driver.find_element_by_accessibility_id('发现').click()474 #sleep(2)475 c1=bp_is_plusexist(self)476 if c1 == True:477 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="addPopMenu"]').click()478 sleep(2)479 #发此刻480 c2=bp_is_publishnowexist(self)481 if c2 == True:482 driver.find_element_by_accessibility_id('发此刻').click()483 sleep(2)484 #driver.find_element_by_xpath('//xxxx').click()485 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':55, 'y':264})486 sleep(3)487 #好488 allow=driver.find_elements_by_accessibility_id('好')489 if len(allow) != 0:490 driver.find_element_by_accessibility_id('好').click()491 sleep(2)492 try:493 for i in range(9):494 driver.find_elements_by_ios_predicate('name=="compose guide check box defaul"')[i].click()495 sleep(1)496 sleep(1)497 driver.find_element_by_accessibility_id('完成(9/9)').click()498 sleep(3)499 words=driver.find_elements_by_xpath('//XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeScrollView/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTextView')500 sleep(2)501 if len(words) != 0:502 words[0].click()503 sleep(1)504 now0=time.strftime('%Y-%m-%d %H_%M_%S')505 words[0].send_keys('I love Shanghai:'+now0)506 t0='I love Shanghai:'+now0507 sleep(1)508 print(t0)509 driver.find_element_by_accessibility_id('发布').click()510 sleep(6)511 #check numbers of pictures and published text here512 title=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,t0)]')513 sleep(2)514 if len(title) != 0:515 print('发布内容的文字检查通过')516 sleep(1)517 else:518 print('发布内容的文字检查失败,请检查原因')519 sleep(1)520 now=time.strftime('%Y-%m-%d %H_%M_%S')521 sf1='../../test_report/ios/'+now+'_errorText_R_stg_tc006.png'522 driver.get_screenshot_as_file(sf1)523 sleep(2)524 number=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="9"]')525 if len(number) != 0:526 print('发布内容的上传9张图片检查通过')527 sleep(1)528 else:529 print('发布内容的上传9张图片检查失败,请检查原因')530 sleep(1)531 now=time.strftime('%Y-%m-%d %H_%M_%S')532 sf2='../../test_report/ios/'+now+'_errorPic9_R_stg_tc006.png'533 driver.get_screenshot_as_file(sf2)534 sleep(2)535 else:536 print('发布文字框没有获取,请重新尝试')537 sleep(2)538 except Exception as e:539 print('发生异常:'+str(e))540 sleep(1)541 pass542 now=time.strftime('%Y-%m-%d %H_%M_%S')543 print('TC_发现_发布此刻----结束:'+now)544#*******************************************************545#TC Name:test_wode_deletepublished_tc007546#Purpose:检查我的页面的删除已发布内容的功能547#OS:iOS548#Device:iPhone7549#Pre-conditions:用户已正常登录app550#Post-conditions:N/A551#Modify History:created by Sam [2018/08/17]552#*******************************************************553 def test_wode_deletepublished_tc007(self):554 driver=self.driver555 print('TC_检查手机号码登录APP,检查点:我的——删除已发布的内容---step1点击我的页面发布;step2检查是否有已发布的内容,')556 print('有的话点击它进入详细页面再点击右上角按钮,执行删除动作;step3检查被删除的发布内容是否删除成功')557 now=time.strftime('%Y-%m-%d %H_%M_%S')558 print('我的_删除已发布的内容----开始:'+now)559 sleep(2)560 driver.find_element_by_accessibility_id('返回').click()561 sleep(2)562 #我的563 driver.find_element_by_accessibility_id('我的').click()564 sleep(2)565 driver.find_element_by_accessibility_id('发布').click()566 #driver.find_element_by_xpath('//XCUIElementTypeTable/XCUIElementTypeOther/XCUIElementTypeButton[3]').click()567 sleep(3)568 p=driver.find_elements_by_class_name('XCUIElementTypeCell')569 if len(p) != 0:570 driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="SamSTG"]')[0].click()571 sleep(2)572 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="icon share gray background new"]').click()573 sleep(1)574 #删除575 driver.find_element_by_accessibility_id('删除').click()576 sleep(1)577 #确认578 driver.find_element_by_accessibility_id('确认').click()579 sleep(1)580 ch=driver.find_elements_by_accessibility_id('删除成功')581 if len(ch) == 0:582 print('发布的内容删除失败,请检查原因')583 sleep(1)584 now=time.strftime('%Y-%m-%d %H_%M_%S')585 sf1='../../test_report/ios/'+now+'_errorDeleted_R_stg_tc007.png'586 driver.get_screenshot_as_file(sf1)587 else:588 print('发布的内容删除成功')589 sleep(1)590 else:591 print('没有已发布的内容可以删除!')592 sleep(1)593 driver.find_element_by_accessibility_id('all page back black icon').click()594 sleep(2)595 now=time.strftime('%Y-%m-%d %H_%M_%S')596 print('TC_我的_删除已发布的内容----结束:'+now)597#*******************************************************598#TC Name:test_wode_loginwechat_tc008599#Purpose:检查用户能否用微信账号登录app600#OS:iOS601#Device:iPhone7602#Pre-conditions:用户已正常登录app603#Post-conditions:N/A604#Modify History:created by Sam [2018/08/17]605#*******************************************************606 def test_wode_loginwechat_tc008(self):607 driver=self.driver608 print('TC_检查手机号码登录APP,检查点:我的页面里用微信登录,如果已登录先退出账号----step1检查用户是否已经登录;')609 print('step2如果用户已经登录则退出原来账号;step3选择用微信登录;step4检查微信登录的账号是否正确')610 now=time.strftime('%Y-%m-%d %H_%M_%S')611 print('TC_我的_客户用微信登录账号----开始:'+now)612 sleep(1)613 driver.find_element_by_accessibility_id('返回').click()614 sleep(1)615 g=bp_is_loggedin(self)616 sleep(1)617 #登录页面618 driver.find_element_by_accessibility_id('注册/登录').click()619 sleep(1)620 #微信登录621 btn=driver.find_elements_by_accessibility_id('log in wechat icon')622 if len(btn) != 0:623 print('微信登录按钮存在')624 driver.find_element_by_accessibility_id('log in wechat icon').click()625 sleep(3)626 driver.find_element_by_accessibility_id('返回').click()627 sleep(3)628 #driver.find_element_by_accessibility_id('确认登录').click()629 #sleep(5)630 name=driver.find_elements_by_accessibility_id('SamSTG')631 if len(name) != 0:632 print('微信登录成功!')633 sleep(1)634 else:635 print('微信登录失败!')636 sleep(1)637 now=time.strftime('%Y-%m-%d %H_%M_%S')638 sf0='../../test_report/ios/'+now+'_errorLoginWechat_R_stg_tc008.png'639 driver.get_screenshot_as_file(sf0)640 sleep(1)641 else:642 print('微信登录按钮不存在,请检查原因')643 sleep(1)644 now=time.strftime('%Y-%m-%d %H_%M_%S')645 sf1='../../test_report/ios/'+now+'_errorNoButton_R_stg_tc008.png'646 driver.get_screenshot_as_file(sf1)647 sleep(2)648 now=time.strftime('%Y-%m-%d %H_%M_%S')649 print('TC_我的_客户用微信登录账号----结束:'+now)650#*******************************************************651#TC Name:test_wode_loginwebo_tc009652#Purpose:检查用户能否用微博账号登录app653#OS:iOS654#Device:iPhone7655#Pre-conditions:用户已正常登录app656#Post-conditions:N/A657#Modify History:created by Sam [2018/08/17]658#*******************************************************659 def test_wode_loginwebo_tc009(self):660 driver=self.driver661 print('TC_检查手机号码登录APP,检查点:我的页面里用微博登录,如果已登录先退出账号----step1检查用户是否已经登录;')662 print('step2如果用户已经登录则退出原来账号;step3选择用微博登录;step4检查微博登录的账号是否正确')663 now=time.strftime('%Y-%m-%d %H_%M_%S')664 print('TC_我的_客户用微博登录账号----开始:'+now)665 sleep(1)666 driver.find_element_by_accessibility_id('返回').click()667 sleep(1)668 g=bp_is_loggedin(self)669 sleep(2)670 #登录页面671 driver.find_element_by_accessibility_id('注册/登录').click()672 sleep(1)673 #微博登录674 btn=driver.find_elements_by_accessibility_id('log in microblog icon')675 if len(btn) != 0:676 print('微博登录按钮存在')677 driver.find_element_by_accessibility_id('log in microblog icon').click()678 sleep(5)679 driver.find_element_by_accessibility_id('确认').click()680 sleep(2)681 driver.find_element_by_accessibility_id('返回').click()682 sleep(2)683 name=driver.find_elements_by_accessibility_id('SamSTG')684 if len(name) != 0:685 print('微博登录成功!')686 sleep(1)687 else:688 print('微博登录失败!')689 sleep(1)690 now=time.strftime('%Y-%m-%d %H_%M_%S')691 sf0='../../test_report/ios/'+now+'_errorLoginWebo_R_stg_tc009.png'692 driver.get_screenshot_as_file(sf0)693 else:694 print('微博登录按钮不存在,请检查原因')695 now=time.strftime('%Y-%m-%d %H_%M_%S')696 sf1='../../test_report/ios/'+now+'_errorNoButton_R_stg_tc009.png'697 driver.get_screenshot_as_file(sf1)698 sleep(2)699 now=time.strftime('%Y-%m-%d %H_%M_%S')700 print('TC_我的_客户用微博登录账号----结束:'+now)701#*******************************************************702#TC Name:test_faxian_tabcheck_tc010703#Purpose:检查发现页面tab上元素和推荐、此刻子tab页上元素是否存在704#OS:iOS705#Device:iPhone7706#Pre-conditions:用户已正常登录app707#Post-conditions:N/A708#Modify History:created by Sam [2018/08/16]709#*******************************************************710 def test_faxian_tabcheck_tc010(self):711 driver=self.driver712 print('TC_检查用户模式打开APP,检查点:发现_tabUI检查功能----step1检查发现页面tab上各子tab元素是否存在;')713 print('step2检查推荐子tab页上各元素是否存在;step3检查此刻子tab页上各元素是否存在')714 now=time.strftime('%Y-%m-%d %H_%M_%S')715 print('TC_发现_tab上元素和推荐、此刻子tab页上元素检查----开始:'+now)716 sleep(1)717 driver.find_element_by_accessibility_id('返回').click()718 sleep(2)719 for i in range(6):720 driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':500,'toX':50,'toY':51,'duration':1.0})721 sleep(2)722 driver.execute_script("mobile: scroll", {"direction": "down"})723 sleep(2)724 #检查发现页面的各个元素是否存在725 c1=fun_findui_check(self)726 if c1 == True:727 print('发现页面tab上各子tab元素检查通过')728 else:729 print('发现页面tab上各子tab元素检查失败,请检查原因')730 sleep(2)731 now=time.strftime('%Y-%m-%d %H_%M_%S')732 print('TC_发现_tab上元素和推荐、此刻子tab页上元素检查----结束:'+now)733#*******************************************************734#TC Name:test_wode_personalinfo_tc011735#Purpose:我的个人信息页面上元素UI检查和相关元素的功能检查736#OS:iOS737#Device:iPhone7738#Pre-conditions:用户已正常登录app739#Post-conditions:N/A740#Modify History:created by Sam [2018/08/16]741#*******************************************************742 def test_wode_personalinfo_tc011(self):743 driver=self.driver744 print('TC_检查手机号码登录APP,检查点:个人信息页面上元素UI检查和相关元素的功能检查----step1进入个人信息页面;')745 print('step2个人信息页面上元素UI检查;step3检查点击头像的功能;step4检查昵称和简称是否可以编辑;step5检查性别是否')746 print('可以改变;step6检查常驻地区页面是否可以进入;step7检查地址管理页面是否可以进入;step8检查用户隐私条款页面')747 print('是否可以进入;step9检查修改的个人信息是否可以保存成功')748 now=time.strftime('%Y-%m-%d %H_%M_%S')749 print('TC_我的——个人信息页面上元素UI检查和相关元素的功能检查----开始:'+now)750 sleep(2)751 driver.find_element_by_accessibility_id('返回').click()752 sleep(2)753 #我的754 driver.find_element_by_accessibility_id('我的').click()755 sleep(3)756 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="SamSTG"]').click()757 sleep(4)758 #编辑个人信息759 driver.find_element_by_accessibility_id('编辑个人信息').click()760 sleep(2)761 #检查发布页面的各个元素是否存在762 c1=fun_personalinfoui_check(self)763 sleep(2)764 if c1 == True:765 print('个人信息页面上各个被检查元素都正常显示.')766 sleep(1)767 #点击头像768 head=driver.find_element_by_xpath('//XCUIElementTypeTable/XCUIElementTypeOther[1]/XCUIElementTypeButton')769 head.click()770 sleep(2)771 #拍照772 ph=driver.find_elements_by_accessibility_id('拍照')773 if len(ph) != 0:774 print('拍照按钮存在')775 driver.find_element_by_accessibility_id('拍照').click()776 sleep(1)777 #好778 allow=driver.find_elements_by_accessibility_id('好')779 if len(allow) != 0:780 driver.find_element_by_accessibility_id('好').click()781 sleep(2)782 phbtn=driver.find_elements_by_xpath('//XCUIElementTypeButton[@name="PhotoCapture"]')783 if len(phbtn) != 0:784 print('手机相机已正常弹出')785 sleep(1)786 else:787 print('手机相机没有正常弹出,请检查原因')788 sleep(1)789 driver.find_element_by_accessibility_id('取消').click()790 sleep(1)791 else:792 print('拍照按钮不存在,请检查')793 sleep(2)794 driver.find_element_by_xpath('//XCUIElementTypeTable/XCUIElementTypeOther[1]/XCUIElementTypeButton').click()795 sleep(2)796 #从手机相册选择797 pic=driver.find_elements_by_accessibility_id('从手机相册选择')798 if len(pic) != 0:799 print('从手机相册选择按钮存在')800 driver.find_element_by_accessibility_id('从手机相册选择').click()801 sleep(1)802 #好803 allow=driver.find_elements_by_accessibility_id('好')804 if len(allow) != 0:805 driver.find_element_by_accessibility_id('好').click()806 sleep(2)807 picbtn=driver.find_elements_by_xpath('//XCUIElementTypeOther[@name="照片"]')808 if len(picbtn) != 0:809 print('手机相册可以正常调用')810 sleep(1)811 else:812 print('手机相册不可以正常调用,请检查原因')813 sleep(1)814 driver.find_element_by_accessibility_id('取消').click()815 sleep(1)816 else:817 print('从手机相册选择按钮不存在,请检查')818 sleep(2)819 driver.find_element_by_xpath('//XCUIElementTypeTable/XCUIElementTypeOther[1]/XCUIElementTypeButton').click()820 sleep(2)821 #取消822 can=driver.find_elements_by_accessibility_id('取消')823 if len(can) != 0:824 print('取消按钮存在')825 driver.find_element_by_accessibility_id('取消').click()826 sleep(2)827 else:828 print('取消按钮不存在,请检查')829 sleep(2)830 #昵称831 nick=driver.find_element_by_xpath('//XCUIElementTypeTextField[@value="SamSTG"]')832 nick.click()833 sleep(1)834 #focused=true;835 c1=driver.find_elements_by_accessibility_id('清除文本')836 if len(c1) != 0:837 print('昵称可以被编辑')838 else:839 print('昵称不可以被编辑,请检查原因')840 sleep(2)841 driver.find_element_by_accessibility_id('清除文本').click()842 sleep(1)843 driver.find_element_by_accessibility_id('all page back black icon').click()844 sleep(1)845 driver.find_element_by_accessibility_id('确定').click()846 sleep(2)847 #编辑个人信息848 driver.find_element_by_accessibility_id('编辑个人信息').click()849 sleep(2)850 #简介851 intro=driver.find_element_by_xpath('//XCUIElementTypeTextField[@value="Sam_STG"]')852 intro.click()853 sleep(1)854 c2=driver.find_elements_by_xpath('//XCUIElementTypeButton[@name="清除文本"]')855 if len(c2) != 0:856 print('简介可以被编辑')857 else:858 print('简介不可以被编辑,请检查原因')859 sleep(1)860 #完成861 driver.execute_script("mobile: tap", {"touchCount":"1", "x":331, "y":382})862 sleep(1)863 #性别864 man=driver.find_elements_by_xpath('//XCUIElementTypeButton[@name="default address not choose"]')[0]865 woman=driver.find_elements_by_xpath('//XCUIElementTypeButton[@name="default address not choose"]')[1]866 #checked=true867 c_man=man.get_attribute('value')868 c_woman=woman.get_attribute('value')869 if c_man == '1':870 woman.click()871 sleep(1)872 print('用户性别可以从男改变成女')873 sleep(1)874 else:875 man.click()876 sleep(1)877 print('用户性别可以从女改变成男')878 sleep(2)879 #地区880 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="地区"]').click()881 sleep(3)882 ct=driver.find_elements_by_xpath('//XCUIElementTypeButton[@name="天津市"]')883 if len(ct) != 0:884 print('常驻地区页面可以进入')885 else:886 print('常驻地区页面不可以进入,请检查原因')887 sleep(1)888 driver.find_element_by_accessibility_id('all page back black icon').click()889 sleep(2)890 #我的地址891 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="我的地址"]').click()892 sleep(3)893 addr=driver.find_elements_by_xpath('//XCUIElementTypeButton[@name="默认地址"]')894 if len(addr) != 0:895 print('地址管理页面可以进入')896 else:897 print('地址管理页面没有默认地址,请添加新地址')898 sleep(1)899 driver.find_element_by_accessibility_id('all page back black icon').click()900 sleep(2)901 #保存902 #driver.find_element_by_xpath('//XCUIElementTypeButton[@name="保存"]').click()903 driver.find_element_by_accessibility_id('保存').click()904 sleep(1)905 save=driver.find_elements_by_accessibility_id('保存成功')906 if len(save) != 0:907 print('----修改的个人信息可以保存成功')908 sleep(1)909 else:910 print('----修改的个人信息没有保存成功,请检查')911 sleep(1)912 now=time.strftime('%Y-%m-%d %H_%M_%S')913 sf='../../test_report/ios/'+now+'_errorSaveInfo_R_tc011.png'914 driver.get_screenshot_as_file(sf)915 sleep(2)916 driver.find_element_by_accessibility_id('all page back black icon').click()917 sleep(2)918 now=time.strftime('%Y-%m-%d %H_%M_%S')919 print('TC_我的——个人信息页面上元素UI检查和相关元素的功能检查----结束:'+now)920#*******************************************************921#TC Name:test_jingxi_products_tc013922#Purpose:惊喜页面上元素UI检查和相关元素的功能检查923#OS:iOS924#Device:iPhone7925#Pre-conditions:用户已正常登录app926#Post-conditions:N/A927#Modify History:created by Sam [2018/11/08]928#*******************************************************929 def test_jingxi_products_tc013(self):930 driver=self.driver931 print('TC_检查手机号码登录APP,检查点:惊喜页面上元素UI检查----step1惊喜页面上任意礼品的元素UI检查')932 now=time.strftime('%Y-%m-%d %H_%M_%S')933 print('TC_惊喜——惊喜页面上元素UI检查----开始:'+now)934 sleep(1)935 driver.find_element_by_accessibility_id('返回').click()936 sleep(1)937 #惊喜938 driver.find_element_by_accessibility_id('惊喜').click()939 sleep(8)940 for i in range(1):941 driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':500,'toX':50,'toY':350,'duration':1.0})942 sleep(2)943 #driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':550,'toX':50,'toY':350,'duration':1.0})944 sleep(2)945 #惊喜页面的各个元素是否存在946 c1=fun_giftui_check(self)947 sleep(2)948 if c1 == True:949 print('积分明细页面上各个被检查元素都检查完毕')950 sleep(2)951 now=time.strftime('%Y-%m-%d %H_%M_%S')952 print('TC_惊喜——惊喜页面上元素UI检查----结束:'+now)953#*******************************************************954#TC Name:test_wode_instuninstversioncheck_tc015955#Purpose:我的积分明细页面上元素UI检查和相关元素的功能检查956#OS:iOS957#Device:iPhone7958#Pre-conditions:用户已正常登录app959#Post-conditions:N/A960#Modify History:created by Sam [2018/08/16]961#*******************************************************962 def test_wode_instuninstversioncheck_tc015(self):963 driver=self.driver964 print('TC_检查手机号码登录APP,检查点:兼容性测试:安装和卸载app功能----step1卸载app')965 print('step2检查app是否存在;step3重新安装app;step4检查app是不是最新/所需版本')966 now=time.strftime('%Y-%m-%d %H_%M_%S')967 print('TC_兼容性测试:安装和卸载app功能----开始:'+now)968 sleep(2)969 driver.find_element_by_accessibility_id('返回').click()970 sleep(2)971 #home972 #driver.find_element_by_accessibility_id('我的').click()973 #sleep(2)974 #卸载app975 driver.remove_app('com.do1.WeiLaiApp.inhouse')976 sleep(3)977 #check if app is uninstalled978 c=driver.is_app_installed('com.do1.WeiLaiApp.inhouse')979 sleep(1)980 if c == True:981 print('卸载蔚来app失败,请检查原因')982 else:983 print('卸载蔚来app成功')984 sleep(2)985 #install app986 d=os.path.abspath(os.path.join(os.getcwd(), "../.."))987 driver.install_app(d+'/test_data/app/ios_package/NextevCarInhouseQA.ipa')988 sleep(3)989 driver.launch_app()990 sleep(5)991 #允许992 allow=driver.find_elements_by_accessibility_id('允许')993 if len(allow) != 0:994 driver.find_element_by_accessibility_id('允许').click()995 sleep(2)996 allow=driver.find_elements_by_accessibility_id('允许')997 if len(allow) != 0:998 driver.find_element_by_accessibility_id('允许').click()999 sleep(2)1000 #我的1001 driver.find_element_by_accessibility_id('我的').click()1002 sleep(2)1003 self.driver.execute_script("mobile: scroll", {"direction": "down"})1004 sleep(2)1005 #设置1006 driver.find_element_by_accessibility_id('设置').click()1007 sleep(2)1008 n=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="3.0.5 build:2077"]')1009 if len(n) != 0:1010 print('重新安装app后版本检查通过')1011 sleep(1)1012 else:1013 print('重新安装app后版本检查失败,请检查原因')1014 sleep(1)1015 now=time.strftime('%Y-%m-%d %H_%M_%S')1016 sf='../../test_report/ios/'+now+'_errorVersonCheck_R_tc015.png'1017 driver.get_screenshot_as_file(sf)1018 sleep(2)1019 now=time.strftime('%Y-%m-%d %H_%M_%S')1020 print('TC_兼容性测试:安装和卸载app功能----结束:'+now)1021#*******************************************************1022#TC Name:test_wode_scores_tc0161023#Purpose:我的积分明细页面上元素UI检查和相关元素的功能检查1024#OS:iOS1025#Device:iPhone71026#Pre-conditions:用户已正常登录app1027#Post-conditions:N/A1028#Modify History:created by Sam [2018/08/16]1029#*******************************************************1030 def test_wode_scores_tc016(self):1031 driver=self.driver1032 print('TC_检查手机号码登录APP,检查点:积分明细页面上元素UI检查和相关元素的功能检查----step1进入积分明细页面;')1033 print('step2页面上元素UI检查;step3检查点击积分规则按钮的功能')1034 now=time.strftime('%Y-%m-%d %H_%M_%S')1035 print('TC_我的——积分明细页面上元素UI检查和相关元素的功能检查----开始:'+now)1036 sleep(2)1037 driver.find_element_by_accessibility_id('返回').click()1038 sleep(2)1039 #我的1040 driver.find_element_by_accessibility_id('我的').click()1041 sleep(3)1042 driver.find_element_by_xpath('//XCUIElementTypeTable/XCUIElementTypeOther/XCUIElementTypeButton[2]').click()1043 sleep(3)1044 #检查积分明细页面的各个元素是否存在1045 c1=fun_scoredetailui_check(self)1046 sleep(2)1047 if c1 == True:1048 print('积分明细页面上各个被检查元素都检查完毕')1049 sleep(1)1050 #点击?号1051 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="integration rule"]').click()1052 sleep(3)1053 #拍照1054 t=driver.find_elements_by_xpath('//XCUIElementTypeOther[@name="积分规则"]')1055 if len(t) != 0:1056 print('积分规则页面存在')1057 sleep(1)1058 else:1059 print('积分规则页面不存在,请检查')1060 sleep(1)1061 driver.find_element_by_accessibility_id('all page back black icon').click()1062 sleep(2)1063 driver.find_element_by_accessibility_id('all page back black icon').click()1064 sleep(2)1065 now=time.strftime('%Y-%m-%d %H_%M_%S')1066 print('TC_我的——积分明细页面上元素UI检查和相关元素的功能检查----结束:'+now)1067#*******************************************************1068#TC Name:test_pengyou_remarkfriend_tc0181069#Purpose:朋友页面对好友设置备注并检查备注是否生效1070#OS:iOS1071#Device:iPhone71072#Pre-conditions:用户已正常登录app1073#Post-conditions:N/A1074#Modify History:created by Sam [2018/08/20]1075#*******************************************************1076 def test_pengyou_remarkfriend_tc018(self):1077 driver=self.driver1078 print('TC_检查手机号码登录APP,检查点:对好友设置备注并检查备注是否生效----step1从朋友页面进入朋友列表页面')1079 print('step2选择一个朋友进入朋友详细信息页面;step3检查点击设置备注按钮的功能;step4检查备注是否生效')1080 now=time.strftime('%Y-%m-%d %H_%M_%S')1081 print('TC_朋友——对好友设置备注并检查备注是否生效的功能检查----开始:'+now)1082 sleep(1)1083 driver.find_element_by_accessibility_id('返回').click()1084 sleep(1)1085 #朋友1086 driver.find_element_by_accessibility_id('朋友').click()1087 sleep(5)1088 driver.find_element_by_xpath('//XCUIElementTypeNavigationBar[@name="朋友"]/XCUIElementTypeButton').click()1089 sleep(2)1090 f=driver.find_elements_by_class_name('XCUIElementTypeCell')1091 sleep(2)1092 if len(f) >= 1:1093 driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"Sam")]')[0].click()1094 sleep(3)1095 old=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"Sam")]')[0].text1096 sleep(1)1097 driver.find_element_by_accessibility_id('icon more white').click()1098 sleep(2)1099 combtn=driver.find_elements_by_accessibility_id('设置备注')1100 sleep(1)1101 if len(combtn) != 0:1102 driver.find_element_by_accessibility_id('设置备注').click()1103 sleep(2)1104 edit=driver.find_element_by_class_name('XCUIElementTypeTextField')1105 edit.click()1106 sleep(1)1107 edit.clear()1108 sleep(1)1109 edit.send_keys(old+'的备注')1110 sleep(1)1111 driver.find_element_by_accessibility_id('保存').click()1112 sleep(3)1113 #print(old)1114 #print(old+'的备注')1115 cc=driver.find_elements_by_accessibility_id(old+'的备注')1116 sleep(2)1117 if len(cc) != 0:1118 print('好友的备注设置已经生效')1119 sleep(1)1120 else:1121 print('好友的备注设置没有生效,请检查原因')1122 sleep(1)1123 now=time.strftime('%Y-%m-%d %H_%M_%S')1124 sf1='../../test_report/ios/'+now+'_errorRemark_R_stg_tc018.png'1125 driver.get_screenshot_as_file(sf1)1126 sleep(2) 1127 else:1128 print('设置备注的按钮不存在,请检查原因')1129 sleep(1)1130 now=time.strftime('%Y-%m-%d %H_%M_%S')1131 sf2='../../test_report/ios/'+now+'_errorNoRemark_R_stg_tc018.png'1132 driver.get_screenshot_as_file(sf2)1133 sleep(1)1134 driver.find_element_by_accessibility_id('取消').click()1135 sleep(2)1136 driver.find_element_by_accessibility_id('full screen back icon').click()1137 sleep(2)1138 driver.find_element_by_accessibility_id('all page back black icon').click()1139 sleep(2)1140 else:1141 print('没有好友可以设置备注,请先添加好友')1142 sleep(1)1143 now=time.strftime('%Y-%m-%d %H_%M_%S')1144 sf3='../../test_report/ios/'+now+'_errorNoFriend_R_tc018.png'1145 driver.get_screenshot_as_file(sf3)1146 sleep(2)1147 now=time.strftime('%Y-%m-%d %H_%M_%S')1148 print('TC_朋友——对好友设置备注并检查备注是否生效的功能检查----结束:'+now)1149#*******************************************************1150#TC Name:test_faxian_article_tc0191151#Purpose:发现页面推荐tab里文章元素UI检查和相关元素的功能检查1152#OS:iOS1153#Device:iPhone71154#Pre-conditions:用户已正常登录app1155#Post-conditions:N/A1156#Modify History:created by Sam [2018/08/23]1157#*******************************************************1158 def test_faxian_article_tc019(self):1159 driver=self.driver1160 print('TC_检查手机号码登录APP,检查点:发现页面推荐tab里文章元素UI检查和评论的功能检查----step1从发现页面推荐tab页找到一个文章')1161 print('step2文章详情页面上元素UI检查;step3检查点击评论按钮的功能;step4检查发表评论成功后文章详情顶部的评论内容')1162 now=time.strftime('%Y-%m-%d %H_%M_%S')1163 print('TC_发现——推荐tab里文章元素UI检查和评论的功能检查----开始:'+now)1164 sleep(1)1165 driver.find_element_by_accessibility_id('返回').click()1166 sleep(2)1167 #发现1168 #driver.find_element_by_accessibility_id('发现').click()1169 #sleep(2)1170 for i in range(6):1171 driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':500,'toX':50,'toY':51,'duration':1.0})1172 sleep(2)1173 driver.execute_script("mobile: scroll", {"direction": "down"})1174 sleep(2)1175 #检查文章的各个元素是否存在1176 c1=fun_articleui_check(self)1177 sleep(2)1178 if c1 == True:1179 print('推荐tab里文章各个被检查元素都检查完毕')1180 sleep(2)1181 #点击评论1182 driver.find_element_by_xpath('//XCUIElementTypeScrollView/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeCell[7]/XCUIElementTypeButton[3]').click()1183 sleep(3)1184 #driver.find_element_by_accessibility_id('写评论').click()1185 driver.find_element_by_xpath('//XCUIElementTypeStaticText[contains(@name,"我也来说~")]').click()1186 sleep(2)1187 combtn=driver.find_element_by_xpath('//XCUIElementTypeWindow[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTextView')1188 combtn.click()1189 sleep(1)1190 now0=time.strftime('%Y-%m-%d %H_%M_%S')1191 combtn.send_keys('我用Python评论文章:'+now0)1192 sleep(1)1193 t0='我用Python评论文章:'+now01194 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="Send"]').click()1195 sleep(3)1196 #check published text here1197 title=driver.find_elements_by_xpath('//XCUIElementTypeTextView[contains(@value,t0)]')1198 #print(len(title))1199 if len(title) != 0:1200 print('评论的文字检查通过')1201 sleep(1)1202 else:1203 print('评论的文字检查失败,请检查原因')1204 sleep(1)1205 now=time.strftime('%Y-%m-%d %H_%M_%S')1206 sf1='../../test_report/ios/'+now+'_errorComment_R_stg_tc019.png'1207 driver.get_screenshot_as_file(sf1)1208 sleep(2)1209 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="all page back grey icon"]').click()1210 sleep(2)1211 now=time.strftime('%Y-%m-%d %H_%M_%S')1212 print('TC_发现——推荐tab里文章元素UI检查和评论的功能检查----结束:'+now)1213#*******************************************************1214#TC Name:test_faxian_openmultichat_tc0201215#Purpose:发现页面发起群聊功能的功能检查1216#OS:iOS1217#Device:iPhone71218#Pre-conditions:用户已正常登录app1219#Post-conditions:N/A1220#Modify History:created by Sam [2018/08/20]1221#*******************************************************1222 def test_faxian_openmultichat_tc020(self):1223 driver=self.driver1224 print('TC_检查手机号码登录APP,检查点:已登录账号发现首页_发起群聊功能---step1检查发现首页右上角+号是否存在;')1225 print('step2检查点击+号后发起群聊按钮是否存在;step3发起群聊并发送内容功能是否正常;step4检查发布内容里文字是否正确')1226 now=time.strftime('%Y-%m-%d %H_%M_%S')1227 print('发现_发起群聊功能----开始:'+now)1228 sleep(1)1229 driver.find_element_by_accessibility_id('返回').click()1230 sleep(1)1231 #我的1232 #driver.find_element_by_accessibility_id('我的').click()1233 #sleep(2)1234 #+1235 c1=bp_is_plusexist(self)1236 if c1 == True:1237 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="addPopMenu"]').click()1238 sleep(2)1239 #建群聊1240 c2=bp_is_openmultichatexist(self)1241 if c2 == True:1242 driver.find_element_by_accessibility_id('建群聊').click()1243 sleep(3)1244 #cb=driver.find_elements_by_xpath('//XCUIElementTypeImage[@name="chat_unslected_icon"]')1245 cb=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"Sam")]')1246 sleep(2)1247 for i in range(3):1248 driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"Sam")]')[i].click()1249 sleep(1)1250 #确定 1251 driver.find_element_by_xpath('//XCUIElementTypeButton[contains(@name,"确定")]').click()1252 sleep(2)1253 msg=driver.find_element_by_id('chat_input_textView')1254 msg.click()1255 sleep(1)1256 now0=time.strftime('%Y-%m-%d %H_%M_%S')1257 msg.send_keys('我用Python群聊:'+now0)1258 sleep(1)1259 #发送1260 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="Send"]').click()1261 sleep(1)1262 driver.find_element_by_accessibility_id('all page back black icon').click()1263 sleep(1)1264 #朋友1265 driver.find_element_by_accessibility_id('朋友').click()1266 sleep(2)1267 #检查群聊的发送内容是否正确1268 t=driver.find_elements_by_accessibility_id('我用Python群聊:'+now0)1269 sleep(2)1270 #print(len(t))1271 if len(t) != 0:1272 print('群聊的发送内容正确')1273 sleep(1)1274 else:1275 print('群聊的发送内容不正确,请检查')1276 sleep(1)1277 now=time.strftime('%Y-%m-%d %H_%M_%S')1278 sf2='../../test_report/ios/'+now+'_errorMultiChatText_R_stg_tc020.png'1279 driver.get_screenshot_as_file(sf2)1280 sleep(2)1281 now=time.strftime('%Y-%m-%d %H_%M_%S')1282 print('发现_发起群聊功能----结束:'+now)1283#*******************************************************************1284#TC Name:test_pengyou_dismissmultichat_tc0211285#Purpose:朋友页面群聊发起人踢人出群聊、邀请朋友加入群聊和解散并退出群聊的功能检查1286#OS:iOS1287#Device:iPhone71288#Pre-conditions:用户已正常登录app1289#Post-conditions:N/A1290#Modify History:created by Sam [2018/08/20]1291#*******************************************************************1292 def test_pengyou_dismissmultichat_tc021(self):1293 driver=self.driver1294 print('TC_检查手机号码登录APP,检查点:朋友_群聊发起人踢人出群聊、邀请朋友加入群聊和解散并退出群聊功能')1295 print('step1进入已发起的群聊,检查踢人出群聊的功能是否正常;step2检查邀请朋友加入群聊的功能是否正常')1296 print('step3检查解散并退出群聊的功能是否正常')1297 now=time.strftime('%Y-%m-%d %H_%M_%S')1298 print('朋友_群聊发起人踢人出群聊、邀请朋友加入群聊和解散并退出群聊----开始:'+now)1299 sleep(1)1300 driver.find_element_by_accessibility_id('返回').click()1301 sleep(1)1302 #朋友1303 driver.find_element_by_accessibility_id('朋友').click()1304 sleep(5)1305 #群聊1306 mul=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"群聊")]')1307 if len(mul) != 0:1308 driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"群聊")]')[0].click()1309 sleep(2)1310 #...1311 driver.find_element_by_accessibility_id('im btn more').click()1312 sleep(4)1313 #-1314 #driver.find_element_by_xpath('//XCUIElementTypeImage[@value="chat_delete_icon"]').click()1315 driver.execute_script("mobile: tap", {"touchCount":"1", "x":143, "y":235})1316 sleep(2)1317 name1=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"Sam")]')[0].text1318 driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"Sam")]')[0].click()1319 sleep(1)1320 driver.find_element_by_xpath('//XCUIElementTypeButton[contains(@name,"确定")]').click()1321 sleep(3)1322 driver.find_element_by_accessibility_id('all page back black icon').click()1323 sleep(2)1324 #检查是否已被移出群组1325 r_msg=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"被踢出群组")]')1326 sleep(1)1327 #'你将'+name1+'移出群组'1328 if len(r_msg) != 0:1329 print('踢人出群聊的功能检查通过')1330 sleep(1)1331 else:1332 print('踢人出群聊的功能检查没有通过,请检查原因')1333 sleep(1)1334 now=time.strftime('%Y-%m-%d %H_%M_%S')1335 sf1='../../test_report/ios/'+now+'_errorKickoff_R_stg_tc021.png'1336 driver.get_screenshot_as_file(sf1)1337 sleep(1)1338 #...1339 driver.find_element_by_accessibility_id('im btn more').click()1340 sleep(2)1341 #+1342 #driver.find_element_by_xpath('//XCUIElementTypeImage[@value="chat_add_icon"]').click()1343 driver.execute_script("mobile: tap", {"touchCount":"1", "x":322, "y":160})1344 sleep(2)1345 name2=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"Sam")]')[0].text1346 sleep(1)1347 driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"Sam")]')[0].click()1348 sleep(1)1349 driver.find_element_by_xpath('//XCUIElementTypeButton[contains(@name,"确定")]').click()1350 sleep(4)1351 driver.find_element_by_accessibility_id('all page back black icon').click()1352 sleep(3)1353 #检查是否已被邀请加入群组1354 #'你邀请'+name2+'加入了群组':if notes added, it could be wrong1355 a_msg=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"加入了群组")]')1356 sleep(1)1357 #print(name2)1358 if len(a_msg) != 0:1359 print('邀请朋友加入群聊的功能检查通过')1360 sleep(1)1361 else:1362 print('邀请朋友加入群聊的功能检查没有通过,请检查原因')1363 sleep(1)1364 now=time.strftime('%Y-%m-%d %H_%M_%S')1365 sf2='../../test_report/ios/'+now+'_errorJoin_R_stg_tc021.png'1366 driver.get_screenshot_as_file(sf2)1367 sleep(2)1368 driver.find_element_by_accessibility_id('im btn more').click()1369 sleep(2)1370 driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':500,'toX':50,'toY':200,'duration':1.0})1371 sleep(2)1372 #解散并删除1373 driver.find_element_by_accessibility_id('解散并删除').click()1374 sleep(1)1375 driver.find_element_by_accessibility_id('确定').click()1376 sleep(4)1377 #检查解散的群聊是否还存在1378 title1=driver.find_elements_by_accessibility_id('群聊')1379 if len(title1) == 0:1380 print('解散并退出群聊的功能检查通过')1381 sleep(1)1382 else:1383 print('解散并退出群聊的功能检查没有通过,请检查原因')1384 sleep(1)1385 now=time.strftime('%Y-%m-%d %H_%M_%S')1386 sf3='../../test_report/ios/'+now+'_errorDismissMultiChat_R_stg_tc021.png'1387 driver.get_screenshot_as_file(sf3)1388 sleep(2)1389 else:1390 print('没有群聊可以操作,请先发起群聊')1391 sleep(1)1392 now=time.strftime('%Y-%m-%d %H_%M_%S')1393 sf4='../../test_report/ios/'+now+'_errorNoMultiChat_R_stg_tc021.png'1394 driver.get_screenshot_as_file(sf4)1395 sleep(2)1396 now=time.strftime('%Y-%m-%d %H_%M_%S')1397 print('朋友_群聊发起人踢人出群聊、邀请朋友加入群聊和解散并退出群----结束:'+now)1398#*********************************************************************************************1399#TC Name:test_jingxi_add2basket_tc0221400#Purpose:检查惊喜页面用户添加商品到购物车的功能测试1401#OS:iOS1402#Device:iPhone71403#Pre-conditions:用户已正常登录app1404#Post-conditions:N/A1405#Modify History:created by Sam [2018/11/08]1406#*********************************************************************************************1407 def test_jingxi_add2basket_tc022(self):1408 driver=self.driver1409 print('TC_检查手机号码登录APP,检查点:惊喜_惊喜页面用户添加商品到购物车的功能----step1进入惊喜页面')1410 print('step2翻页找到所需兑换的商品;step3把商品加入购物车;step4点击购物车图标进入购物车页面')1411 print('step5购物车页面UI检查')1412 now=time.strftime('%Y-%m-%d %H_%M_%S')1413 print('TC_惊喜_惊喜页面用户添加商品到购物车的功能----开始:'+now)1414 sleep(1)1415 driver.find_element_by_accessibility_id('返回').click()1416 sleep(1)1417 #惊喜1418 driver.find_element_by_accessibility_id('惊喜').click()1419 sleep(8)1420 for i in range(1):1421 driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':500,'toX':50,'toY':350,'duration':1.0})1422 sleep(2)1423 #driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':550,'toX':50,'toY':350,'duration':1.0})1424 sleep(2)1425 u1=driver.find_elements_by_xpath('//XCUIElementTypeOther[@name="真皮iPhone手机壳 真皮iPhone手机壳 1"]')1426 if len(u1) != 0:1427 print('需要兑换的商品存在,检查通过')1428 sleep(2)1429 driver.find_element_by_xpath('//XCUIElementTypeOther[@name="真皮iPhone手机壳 真皮iPhone手机壳 1"]').click()1430 sleep(9)1431 page=driver.page_source1432 sleep(2)1433 #加入购物车1434 add2b=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="加入购物车"]')1435 sleep(2)1436 if len(add2b) != 0:1437 print('加入购物车按钮存在,检查通过')1438 sleep(2)1439 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="加入购物车"]').click()1440 sleep(3)1441 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="加入购物车"]').click()1442 sleep(3)1443 #点击购物车图标1444 ###driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="1"])').click()1445 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':76, 'y':632})1446 sleep(6)1447 #检查购物车页面ui1448 chk=fun_cartui_check(self)1449 if chk == True:1450 print('购物车页面UI检查成功')1451 sleep(1)1452 else:1453 print('购物车页面UI检查失败,请检查原因')1454 sleep(1)1455 now=time.strftime('%Y-%m-%d %H_%M_%S')1456 sf1='../../test_report/ios/'+now+'_errorCartUI_R_stg_tc022.png'1457 driver.get_screenshot_as_file(sf1)1458 sleep(2)1459 #37,411460 ###driver.find_element_by_xpath('//XCUIElementTypeOther[1]/XCUIElementTypeOther').click()1461 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':37, 'y':41})1462 sleep(2)1463 else:1464 print('加入购物车按钮不存在,请检查原因')1465 sleep(2)1466 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':34, 'y':40})1467 sleep(2)1468 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':34, 'y':40})1469 sleep(2)1470 else:1471 print('需要兑换的商品不存在,请重新挑选')1472 sleep(2)1473 now=time.strftime('%Y-%m-%d %H_%M_%S')1474 print('TC_惊喜_惊喜页面用户添加商品到购物车的功能----结束:'+now)1475#*********************************************************************************************1476#TC Name:test_jingxi_basket2exchange_tc0231477#Purpose:检查惊喜页面从购物车下单兑换商品的功能1478#Pre-c#OS:iOS1479#Device:iPhone71480#Post-conditions:N/A1481#Modify History:created by Sam [2018/11/08]1482#*********************************************************************************************1483 def test_jingxi_basket2exchange_tc023(self):1484 driver=self.driver1485 print('TC_检查手机号码登录APP,检查点:惊喜_用户从购物车下单兑换商品的功能----step1进入惊喜页面')1486 print('step2点击购物车图标进入购物车页面;step3点击编辑按钮进入编辑页面;step4改变所选商品的规格:颜色')1487 print('step5改变所选商品的数量;step6改变收货地址;step7立即下单检查订单是否已提交')1488 print('step8查看订单检查商品状态是否为未发货')1489 now=time.strftime('%Y-%m-%d %H_%M_%S')1490 print('TC_惊喜_惊喜页面用户添加商品到购物车的功能----开始:'+now)1491 sleep(2)1492 driver.find_element_by_accessibility_id('返回').click()1493 sleep(2)1494 #此刻1495 driver.find_element_by_accessibility_id('惊喜').click()1496 sleep(8)1497 #点击购物车图标1498 #driver.find_element_by_xpath('//XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther').click()1499 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':335, 'y':41})1500 sleep(6)1501 #refresh1502 #driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':100,'toX':50,'toY':500,'duration':1.0})1503 #sleep(2)1504 chk0=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"去添加点什么吧")]')1505 sleep(2)1506 if len(chk0) != 0:1507 print('购物车里没有商品,请先去惊喜页面添加')1508 sleep(1)1509 else:1510 #print('Yes')1511 sleep(1)1512 #检查购物车页面ui1513 chk=fun_cartui_check(self)1514 if chk == True:1515 print('购物车页面UI检查成功')1516 sleep(2)1517 #285,431518 driver.find_elements_by_xpath('//XCUIElementTypeOther[@name="编辑"]')[4].click()1519 sleep(6)1520 try:1521 #改变商品数量1522 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':334, 'y':275})1523 sleep(3)1524 #完成1525 driver.find_elements_by_xpath('//XCUIElementTypeOther[@name="完成"]')[4].click()1526 sleep(2)1527 driver.find_element_by_accessibility_id('立即购买').click()1528 sleep(3)1529 #改变收货地址1530 ###driver.find_element_by_xpath('//XCUIElementTypeOther[contains(@name,"赵子龙")]').click()1531 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':289, 'y':139})1532 sleep(2)1533 #第二个地址1534 driver.find_element_by_xpath('//XCUIElementTypeScrollView/XCUIElementTypeOther/XCUIElementTypeOther[2]').click()1535 sleep(2)1536 driver.find_element_by_accessibility_id('立即下单').click()1537 sleep(1)1538 driver.find_element_by_accessibility_id('确定').click()1539 sleep(3)1540 chk=driver.find_elements_by_xpath('//XCUIElementTypeOther[@name="订单已提交"]')1541 sleep(1)1542 if len(chk) == 0:1543 print('订单已提交检查失败,请检查原因')1544 sleep(1)1545 now=time.strftime('%Y-%m-%d %H_%M_%S')1546 sf1='../../test_report/ios/'+now+'_errorGiftOrder_R_stg_tc023.png'1547 driver.get_screenshot_as_file(sf1)1548 sleep(2)1549 else:1550 print('订单已提交检查通过')1551 sleep(2)1552 #查看订单1553 driver.find_element_by_accessibility_id('查看订单').click()1554 sleep(6)1555 #检查商品状态1556 chk1=driver.find_elements_by_xpath('//XCUIElementTypeOther[contains(@name,"真皮iPhone手机壳")]')1557 chk2=driver.find_elements_by_xpath('//XCUIElementTypeOther[contains(@name,"已付款")]')1558 sleep(1)1559 if len(chk1) != 0 and len(chk2) != 0:1560 print('订单里商品状态检查通过')1561 sleep(1)1562 else:1563 print('订单里商品状态检查失败,请检查原因')1564 sleep(1)1565 now=time.strftime('%Y-%m-%d %H_%M_%S')1566 sf1='../../test_report/ios/'+now+'_errorGiftStatus_R_stg_tc023.png'1567 driver.get_screenshot_as_file(sf1)1568 sleep(2)1569 except Exception as e:1570 print('发生异常:'+str(e))1571 sleep(2)1572 pass1573 else:1574 print('购物车页面UI检查失败,请检查原因')1575 sleep(1)1576 now=time.strftime('%Y-%m-%d %H_%M_%S')1577 sf1='../../test_report/ios/'+now+'_errorCartUI_R_stg_tc023.png'1578 driver.get_screenshot_as_file(sf1)1579 sleep(2)1580 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':34, 'y':41})1581 sleep(2)1582 now=time.strftime('%Y-%m-%d %H_%M_%S')1583 print('TC_惊喜_用户从购物车下单兑换商品的功能----结束:'+now)1584#*******************************************************1585#TC Name:test_wode_checkin_tc0251586#Purpose:我的页面点击签到及检查当日签到积分是否能正常获得的功能1587#OS:iOS1588#Device:iPhone71589#Pre-conditions:用户已正常登录app1590#Post-conditions:N/A1591#Modify History:created by Sam [2018/08/20]1592#*******************************************************1593 def test_wode_checkin_tc025(self):1594 driver=self.driver1595 print('TC_检查手机号码登录APP,检查点:已登录账号发现首页_发起群聊功能---step1检查我的页面右上角点击签到是否存在;')1596 print('step2检查点击签到功能是否正常;step3到积分明细页面检查当日签到的积分是否已经获得')1597 now=time.strftime('%Y-%m-%d %H_%M_%S')1598 print('我的_点击签到及检查当日签到积分是否能正常获得的功能----开始:'+now)1599 sleep(1)1600 driver.find_element_by_accessibility_id('返回').click()1601 sleep(1)1602 #我的1603 driver.find_element_by_accessibility_id('我的').click()1604 sleep(2)1605 #点击签到accessibility_id('点击签到')1606 chk=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="点击签到"]')1607 if len(chk) != 0:1608 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="点击签到"]').click()1609 sleep(2)1610 else:1611 print('今日已经签到过,请明日再来')1612 sleep(1)1613 #检查积分1614 driver.find_element_by_xpath('//XCUIElementTypeTable/XCUIElementTypeOther/XCUIElementTypeButton[2]').click()1615 sleep(2)1616 cb=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="每日签到"]')1617 #print(len(cb))1618 nowtm=time.strftime('%Y.%m.%d')1619 tm=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name, nowtm)]')1620 sleep(1)1621 if len(cb) != 0 and len(tm) != 0:1622 print('每日签到获取积分功能检查通过')1623 sleep(1)1624 else:1625 print('每日签到获取积分功能检查失败,请检查原因')1626 sleep(1)1627 now=time.strftime('%Y-%m-%d %H_%M_%S')1628 sf2='../../test_report/ios/'+now+'_errorCheckinScore_R_stg_tc025.png'1629 driver.get_screenshot_as_file(sf2)1630 sleep(1)1631 driver.find_element_by_accessibility_id('all page back black icon').click()1632 sleep(2)1633 now=time.strftime('%Y-%m-%d %H_%M_%S')1634 print('我的_点击签到及检查当日签到积分是否能正常获得的功能----结束:'+now)1635#*******************************************************1636#TC Name:test_pengyou_nicknameheadicon_tc0281637#Purpose:朋友页面修改群聊昵称和头像功能1638#OS:iOS1639#Device:iPhone71640#Pre-conditions:用户已正常登录app1641#Post-conditions:N/A1642#Modify History:created by Sam [2018/08/22]1643#*******************************************************1644 def test_pengyou_nicknameheadicon_tc028(self):1645 driver=self.driver1646 print('TC_检查手机号码登录APP,检查点:已登录账号朋友页面_修改群聊昵称和头像功能---step1检查朋友页面群聊是否存在;')1647 print('step2进入群聊修改群组名称;step3检查群组名称是否修改成功')1648 #;step4检查修改群组头像功能是否正常1649 now=time.strftime('%Y-%m-%d %H_%M_%S')1650 print('TC_朋友_修改群聊名称和头像功能----开始:'+now)1651 sleep(1)1652 driver.find_element_by_accessibility_id('返回').click()1653 sleep(1)1654 #朋友1655 try:1656 driver.find_element_by_accessibility_id('朋友').click()1657 sleep(6)1658 t=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"群聊")]')1659 sleep(1)1660 if len(t) != 0:1661 driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"群聊")]')[0].click()1662 sleep(2)1663 driver.find_element_by_xpath('//XCUIElementTypeNavigationBar[contains(@name,"群聊")]/XCUIElementTypeButton[2]').click()1664 sleep(2)1665 #修改群组名称1666 driver.find_element_by_xpath('//XCUIElementTypeStaticText[contains(@name,"群聊")]').click()1667 sleep(1)1668 edit=driver.find_element_by_class_name('XCUIElementTypeTextField')1669 edit.click()1670 sleep(1)1671 edit.clear()1672 sleep(1)1673 edit.send_keys('群聊new')1674 sleep(1)1675 driver.find_element_by_accessibility_id('保存').click()1676 sleep(2)1677 nk=driver.find_elements_by_accessibility_id('群聊new')1678 if len(nk) != 0:1679 print('群组的名称已经修改成功')1680 else:1681 print('群组的名称没有修改成功,请检查原因')1682 now=time.strftime('%Y-%m-%d %H_%M_%S')1683 sf1='../../test_report/ios/'+now+'_errorName_R.png'1684 driver.get_screenshot_as_file(sf1)1685 sleep(1)1686 """1687 #修改头像1688 driver.find_element_by_accessibility_id('群组头像').click()1689 sleep(1)1690 #拍照1691 driver.find_element_by_accessibility_id('拍照').click()1692 sleep(3)1693 ok=driver.find_elements_by_accessibility_id('好')1694 if len(ok) != 0:1695 driver.find_element_by_accessibility_id('好').click()1696 sleep(2)1697 driver.find_element_by_accessibility_id('FrontBackFacingCameraChooser').click()1698 sleep(2)1699 driver.find_element_by_accessibility_id('PhotoCapture').click()1700 sleep(2)1701 driver.find_element_by_accessibility_id('使用照片').click()1702 sleep(10)1703 #修改头像1704 driver.find_element_by_accessibility_id('群组头像').click()1705 sleep(1)1706 #从手机相册选择1707 driver.find_element_by_accessibility_id('从手机相册选择').click()1708 sleep(2)1709 #屏幕快照1710 driver.find_element_by_accessibility_id('屏幕快照').click()1711 sleep(2)1712 for i in range(2):1713 self.driver.execute_script("mobile: scroll", {"direction": "up"})1714 sleep(2)1715 driver.find_elements_by_class_name('XCUIElementTypeCell')[0].click()1716 sleep(2)1717 #选取1718 driver.find_element_by_accessibility_id('选取').click()1719 sleep(10)1720 """1721 driver.find_element_by_accessibility_id('all page back black icon').click()1722 sleep(1)1723 driver.find_element_by_accessibility_id('all page back black icon').click()1724 sleep(1)1725 else:1726 print('没有群聊可以操作,请先发起群聊')1727 sleep(1)1728 now=time.strftime('%Y-%m-%d %H_%M_%S')1729 sf3='../../test_report/ios/'+now+'_errorNoMultichat_R_stg_tc028.png'1730 driver.get_screenshot_as_file(sf3)1731 sleep(2)1732 except Exception as e:1733 print('发生异常:'+str(e))1734 sleep(1)1735 pass1736 now=time.strftime('%Y-%m-%d %H_%M_%S')1737 print('TC_朋友_修改群聊名称和头像功能----结束:'+now)1738#*******************************************************1739#TC Name:test_pengyou_searchwatch_tc0291740#Purpose:朋友页面搜索好友并打开个人主页进行关注1741#OS:iOS1742#Device:iPhone71743#Pre-conditions:用户已正常登录app1744#Post-conditions:N/A1745#Modify History:created by Sam [2018/08/21]1746#*******************************************************1747 def test_pengyou_searchwatch_tc029(self):1748 driver=self.driver1749 print('TC_检查手机号码登录APP,检查点:已登录账号朋友页面_朋友页面搜索好友并打开个人主页进行关注---')1750 print('step1朋友页面点+号,检查添加朋友按钮是否存在;step2输入好友名称进行搜索;')1751 print('step3点击搜索出的朋友打开他的个人主页;step4检查关注功能是否正常')1752 now=time.strftime('%Y-%m-%d %H_%M_%S')1753 print('TC_朋友_搜索好友并打开个人主页进行关注----开始:'+now)1754 sleep(2)1755 driver.find_element_by_accessibility_id('返回').click()1756 sleep(2)1757 #朋友1758 driver.find_element_by_accessibility_id('朋友').click()1759 sleep(5)1760 driver.find_element_by_xpath('//XCUIElementTypeNavigationBar[@name="朋友"]/XCUIElementTypeButton').click()1761 sleep(2)1762 #点+号1763 driver.find_element_by_xpath('//XCUIElementTypeNavigationBar[@name="朋友列表"]/XCUIElementTypeButton[2]').click()1764 sleep(1)1765 add=driver.find_elements_by_accessibility_id('添加朋友')1766 if len(add) != 0:1767 driver.find_element_by_accessibility_id('添加朋友').click()1768 sleep(2)1769 edit=driver.find_element_by_xpath('//XCUIElementTypeSearchField[@name="昵称/手机号"]')1770 edit.click()1771 sleep(0.5)1772 driver.find_element_by_xpath('//XCUIElementTypeSearchField[@name="昵称/手机号"]').set_value('张三')1773 sleep(1)1774 #search1775 driver.find_element_by_accessibility_id('Search').click() 1776 sleep(3)1777 ff=driver.find_elements_by_class_name('XCUIElementTypeCell')1778 sleep(2)1779 #print(len(ff))1780 if len(ff) != 0:1781 print('搜索好友功能检查通过')1782 sleep(1)1783 driver.find_elements_by_class_name('XCUIElementTypeCell')[1].click()1784 sleep(4)1785 #关注1786 t=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="关注"]')1787 if len(t) == 2:1788 driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="关注"]')[1].click()1789 sleep(3)1790 tt=driver.find_elements_by_accessibility_id('已关注')1791 if len(tt) != 0:1792 print('好友已经关注成功')1793 sleep(1)1794 else:1795 print('好友没有关注成功,请检查原因')1796 now=time.strftime('%Y-%m-%d %H_%M_%S')1797 sf1='../../test_report/ios/'+now+'_errorWatch_R_stg_tc029.png'1798 driver.get_screenshot_as_file(sf1)1799 sleep(1)1800 else:1801 print('该好友你以前已经关注过了,无需再操作')1802 sleep(1)1803 driver.find_element_by_accessibility_id('full screen back icon').click()1804 sleep(2)1805 #driver.find_element_by_accessibility_id('all page back black icon').click()1806 #sleep(2)1807 else:1808 print('搜索好友功能检查失败,请检查原因')1809 sleep(1)1810 #取消1811 driver.find_element_by_accessibility_id('取消').click() 1812 sleep(2)1813 driver.find_element_by_accessibility_id('all page back black icon').click()1814 sleep(2)1815 else:1816 print('没有添加朋友按钮,请检查原因')1817 sleep(1)1818 now=time.strftime('%Y-%m-%d %H_%M_%S')1819 sf3='../../test_report/ios/'+now+'_errorNoAddFriend_R_stg_tc029.png'1820 driver.get_screenshot_as_file(sf3)1821 sleep(2)1822 driver.find_element_by_accessibility_id('all page back black icon').click() 1823 sleep(2)1824 now=time.strftime('%Y-%m-%d %H_%M_%S')1825 print('TC_朋友_搜索好友并打开个人主页进行关注----结束:'+now)1826#*******************************************************1827#TC Name:test_wode_resetsecupwd_tc0301828#Purpose:我的页面设置里重置服务安全密码的功能1829#OS:iOS1830#Device:iPhone71831#Pre-conditions:用户已正常登录app1832#Post-conditions:N/A1833#Modify History:created by Sam [2018/08/22]1834#*******************************************************1835 def test_wode_resetsecupwd_tc030(self):1836 driver=self.driver1837 print('TC_检查手机号码登录APP,检查点:已登录账号发现首页_发起群聊功能---step1我的页面里点设置;')1838 print('step2点击服务安全密码;step3检查重置服务安全密码的功能是否正常')1839 now=time.strftime('%Y-%m-%d %H_%M_%S')1840 print('我的_设置里重置服务安全密码的功能----开始:'+now)1841 sleep(4)1842 #我的1843 driver.find_element_by_accessibility_id('我的').click()1844 sleep(2)1845 #self.driver.execute_script("mobile: scroll", {"direction": "down"})1846 driver.execute_script("mobile: dragFromToForDuration",{"fromX":50,"fromY":500,"toX":50,"toY":200,"duration":1.0})1847 sleep(2)1848 driver.find_element_by_accessibility_id('设置').click()1849 sleep(2)1850 #服务安全密码1851 driver.find_element_by_accessibility_id('服务安全密码').click()1852 sleep(3)1853 code=driver.find_element_by_class_name('XCUIElementTypeTextField')1854 code.click()1855 code.send_keys('112233')1856 sleep(1)1857 driver.find_element_by_accessibility_id('下一步').click()1858 sleep(2)1859 #身份类型1860 driver.find_elements_by_class_name('XCUIElementTypeTextField')[0].click()1861 sleep(1)1862 driver.find_element_by_accessibility_id('确定').click()1863 sleep(2)1864 idnum=driver.find_elements_by_class_name('XCUIElementTypeTextField')[1]1865 idnum.click()1866 idnum.send_keys('340103197301142518')1867 sleep(1)1868 #完成1869 driver.find_element_by_accessibility_id('Toolbar Done Button').click()1870 sleep(1)1871 #下一步1872 driver.find_element_by_accessibility_id('下一步').click()1873 sleep(2)1874 p=[]1875 for i in range(6):1876 r=random.randint(0,9)1877 p.append(str(r))1878 print('重置的密码是:'+str(p))1879 sleep(1)1880 for j in range(6):1881 driver.find_element_by_accessibility_id(p[j]).click()1882 sleep(1)1883 for j in range(6):1884 driver.find_element_by_accessibility_id(p[j]).click()1885 sleep(1)1886 sleep(2)1887 chk=driver.find_elements_by_accessibility_id('重置成功')1888 if len(chk) != 0:1889 print('服务安全密码重置成功')1890 sleep(1)1891 else:1892 print('服务安全密码重置失败,请检查原因')1893 sleep(1)1894 now=time.strftime('%Y-%m-%d %H_%M_%S')1895 sf2='../../test_report/ios/'+now+'_errorResetSecupwd_R_tc030.png'1896 driver.get_screenshot_as_file(sf2)1897 sleep(1)1898 driver.find_element_by_accessibility_id('all page back black icon').click()1899 sleep(2)1900 now=time.strftime('%Y-%m-%d %H_%M_%S')1901 print('我的_设置里重置服务安全密码的功能----结束:'+now)1902#*******************************************************1903#TC Name:test_wode_addeditaddress_tc0311904#Purpose:我的页面里地址管理页面新增和编辑一个收货地址的功能1905#OS:iOS1906#Device:iPhone71907#Pre-conditions:用户已正常登录app1908#Post-conditions:N/A1909#Modify History:created by Sam [2018/08/22]1910#*******************************************************1911 def test_wode_addeditaddress_tc031(self):1912 driver=self.driver1913 print('TC_检查手机号码登录APP,检查点:已登录账号发现首页_发起群聊功能---step1我的页面里点击头像')1914 print('step2点击编辑个人信息;step3点击我的地址进入地址管理页面;step4检查添加新地址的功能是否正常')1915 print('step5检查编辑地址的功能是否正常')1916 now=time.strftime('%Y-%m-%d %H_%M_%S')1917 print('TC_我的_新增和编辑一个收货地址的功能----开始:'+now)1918 sleep(2)1919 driver.find_element_by_accessibility_id('返回').click()1920 sleep(2)1921 #我的1922 driver.find_element_by_accessibility_id('我的').click()1923 sleep(3)1924 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="SamSTG"]').click()1925 sleep(2)1926 #编辑个人信息1927 driver.find_element_by_accessibility_id('编辑个人信息').click()1928 sleep(2)1929 #我的地址1930 driver.find_element_by_accessibility_id('我的地址').click()1931 sleep(2)1932 #添加新地址1933 add=driver.find_elements_by_accessibility_id('添加新地址')1934 if len(add) != 0:1935 print('添加新地址按钮存在,检查通过')1936 sleep(1)1937 driver.find_element_by_accessibility_id('添加新地址').click()1938 sleep(1)1939 name=driver.find_elements_by_class_name('XCUIElementTypeTextField')[0]1940 name.click()1941 r=random.randint(10,99)1942 sleep(1)1943 name.send_keys('测试'+str(r))1944 sleep(1)1945 pnum=driver.find_elements_by_class_name('XCUIElementTypeTextField')[1]1946 pnum.click()1947 r2=random.randint(10,99)1948 sleep(1)1949 pnum.send_keys('138160328'+str(r2))1950 sleep(1)1951 #完成1952 driver.find_element_by_accessibility_id('Toolbar Done Button').click()1953 sleep(1)1954 #选择所在地区1955 driver.find_element_by_accessibility_id('选择所在地区').click()1956 sleep(2)1957 #确定1958 driver.find_element_by_accessibility_id('确定').click()1959 sleep(1)1960 #街道/楼牌号等1961 addr=driver.find_element_by_class_name('XCUIElementTypeTextView')1962 addr.click()1963 r3=random.randint(100,999)1964 sleep(1)1965 addr.send_keys('中山北路'+str(r3)+'号')1966 sleep(1)1967 #完成1968 driver.find_element_by_accessibility_id('Toolbar Done Button').click()1969 sleep(1)1970 #保存1971 driver.find_element_by_accessibility_id('保存').click()1972 sleep(1)1973 #检查toast1974 save1=driver.find_elements_by_accessibility_id('保存成功')1975 if len(save1) != 0:1976 print('新增地址成功')1977 else:1978 print('新增地址失败,请检查原因')1979 now=time.strftime('%Y-%m-%d %H_%M_%S')1980 sf2='../../test_report/ios/'+now+'_errorAddnewaddr_R_stg_tc031.png'1981 driver.get_screenshot_as_file(sf2)1982 else:1983 print('添加新地址按钮不存在,请检查原因')1984 sleep(1)1985 #编辑1986 edi=driver.find_elements_by_xpath('//XCUIElementTypeButton[@name="编辑"]')1987 if len(edi) != 0:1988 print('编辑按钮存在,检查通过')1989 sleep(1)1990 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="编辑"]').click()1991 sleep(1)1992 name=driver.find_elements_by_class_name('XCUIElementTypeTextField')[0]1993 name.click()1994 #old=name.get_attribute('value')1995 r4=random.randint(10,99)1996 sleep(1)1997 name.send_keys(str(r4))1998 sleep(1)1999 #保存2000 driver.find_element_by_accessibility_id('保存').click()2001 sleep(1)2002 #检查toast2003 save2=driver.find_elements_by_accessibility_id('修改成功')2004 if len(save2) != 0:2005 print('编辑地址成功')2006 else:2007 print('编辑地址失败,请检查原因')2008 now=time.strftime('%Y-%m-%d %H_%M_%S')2009 sf1='../../test_report/ios/'+now+'_errorEditaddr_R_stg_tc031.png'2010 driver.get_screenshot_as_file(sf1)2011 else:2012 print('编辑按钮不存在,请检查原因')2013 sleep(1)2014 driver.find_element_by_accessibility_id('all page back black icon').click()2015 sleep(2)2016 driver.find_element_by_accessibility_id('all page back black icon').click()2017 sleep(2)2018 driver.find_element_by_accessibility_id('full screen back icon').click()2019 sleep(2)2020 now=time.strftime('%Y-%m-%d %H_%M_%S')2021 print('TC_我的_新增和编辑一个收货地址的功能----结束:'+now)2022#*******************************************************2023#TC Name:test_faxian_expershowpic_tc0322024#Purpose:发现页面体验tab活动的晒图功能2025#OS:iOS2026#Device:iPhone72027#Pre-conditions:用户已正常登录app2028#Post-conditions:N/A2029#Modify History:created by Sam [2018/08/23]2030#*******************************************************2031 def test_faxian_expershowpic_tc032(self):2032 driver=self.driver2033 print('TC_检查手机号码登录APP,检查点:已登录账号发现——体验tab活动的晒图功能---step1发现页面里点击体验tab')2034 print('step2切换地点找到一个同城活动;step3检查晒图功能是否正常;step4检查晒图的文字是否正确')2035 print('step5检查晒图的9张图片数量是否正确')2036 now=time.strftime('%Y-%m-%d %H_%M_%S')2037 print('TC_发现——体验tab活动的晒图功能----开始:'+now)2038 sleep(1)2039 driver.find_element_by_accessibility_id('返回').click()2040 sleep(1)2041 #体验2042 driver.find_element_by_accessibility_id('体验').click()2043 sleep(2)2044 driver.find_element_by_xpath('//XCUIElementTypeCell/XCUIElementTypeButton[2]').click()2045 sleep(2)2046 #driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':550,'toX':50,'toY':150,'duration':1.0})2047 #sleep(2)2048 driver.find_element_by_accessibility_id('蔚来中心丨上海太古汇店1112121312').click()2049 sleep(2)2050 driver.find_element_by_accessibility_id('新活动_9.7stg1').click()2051 sleep(4)2052 #晒图2053 #river.execute_script("mobile: tap", {"touchCount":"1", "x":330, "y":620})2054 show=driver.find_elements_by_xpath('//XCUIElementTypeLink[@name="晒图"]')2055 sleep(2)2056 if len(show) != 0:2057 print('晒图按钮存在,检查通过')2058 sleep(1)2059 driver.find_element_by_xpath('//*[@name="晒图"]').click()2060 sleep(2)2061 #+2062 driver.execute_script("mobile: tap", {"touchCount":"1", "x":65, "y":264})2063 sleep(2)2064 #好2065 allow=driver.find_elements_by_accessibility_id('好')2066 if len(allow) != 0:2067 driver.find_element_by_accessibility_id('好').click()2068 sleep(2)2069 for i in range(1,10):2070 driver.find_elements_by_ios_predicate('name=="compose guide check box defaul"')[i].click()2071 sleep(1)2072 driver.find_element_by_accessibility_id('完成(9/9)').click()2073 sleep(1)2074 word=driver.find_element_by_xpath('//XCUIElementTypeScrollView/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTextView')2075 word.click()2076 sleep(1)2077 now0=time.strftime('%Y-%m-%d %H_%M_%S')2078 word.send_keys('人生苦短体验晒图:'+now0)2079 sleep(1)2080 driver.find_element_by_accessibility_id('发布').click()2081 sleep(13)2082 #check numbers of pictures and published text here2083 title=driver.find_elements_by_xpath('//XCUIElementTypeTextView[contains(@value,"人生苦短体验晒图:")]')2084 sleep(2)2085 if len(title) != 0:2086 print('体验晒图的文字检查通过')2087 sleep(1)2088 else:2089 print('体验晒图的文字检查失败,请检查原因')2090 sleep(1)2091 now=time.strftime('%Y-%m-%d %H_%M_%S')2092 sf1='../../test_report/ios/'+now+'_errorShowpicText_R_stg_tc032.png'2093 driver.get_screenshot_as_file(sf1)2094 sleep(2)2095 number=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="9"]')2096 #print(number.text)2097 if len(number) != 0:2098 print('体验晒图的上传9张图片检查通过')2099 sleep(1)2100 else:2101 print('体验晒图的上传9张图片检查失败,请检查原因')2102 sleep(1)2103 now=time.strftime('%Y-%m-%d %H_%M_%S')2104 sf2='../../test_report/ios/'+now+'_errorPic9_R_stg_tc032.png'2105 driver.get_screenshot_as_file(sf2)2106 sleep(2)2107 driver.find_element_by_accessibility_id('all page back black icon').click()2108 sleep(4)2109 else:2110 print('晒图按钮不存在/找不到,请检查原因')2111 sleep(2)2112 driver.execute_script("mobile: tap", {"touchCount":"1", "x":32, "y":42})2113 #driver.find_element_by_xpath('//XCUIElementTypeOther[@name="蔚来"]/XCUIElementTypeOther[1]').click()2114 sleep(2)2115 now=time.strftime('%Y-%m-%d %H_%M_%S')2116 print('TC_发现——体验tab活动的晒图功能----结束:'+now)2117#*******************************************************2118#TC Name:test_faxian_publishnowatfriend_tc0332119#Purpose:检查发现页面的发布此刻并@好友的功能2120#OS:iOS2121#Device:iPhone72122#Pre-conditions:用户已正常登录app2123#Post-conditions:N/A2124#Modify History:created by Sam [2018/08/24]2125#*******************************************************2126 def test_faxian_publishnowatfriend_tc033(self):2127 driver=self.driver2128 print('TC_检查手机号码登录APP,检查点:发现_发布此刻并@好友的功能----step1检查发现首页右上角+号是否存在;')2129 print('step2检查发布此刻按钮是否存在;step3发布并@好友功能是否正常;step4检查发布内容里是否可以一次最大上传9张图片;')2130 print('step5检查发布文字是否正确;step6退出当前账号并已@的好友账号登录app;step7检查朋友页面里是否收到@通知')2131 now=time.strftime('%Y-%m-%d %H_%M_%S')2132 print('TC_发现_发布此刻并@好友----开始:'+now)2133 sleep(1)2134 driver.find_element_by_accessibility_id('返回').click()2135 sleep(1)2136 #发现2137 #driver.find_element_by_accessibility_id('//*[@text="发现"]').click()2138 #sleep(2)2139 c1=bp_is_plusexist(self)2140 if c1 == True:2141 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="addPopMenu"]').click()2142 sleep(2)2143 #发此刻2144 c2=bp_is_publishnowexist(self)2145 if c2 == True:2146 print('发此刻按钮存在,检查通过')2147 sleep(1)2148 driver.find_element_by_accessibility_id('发此刻').click()2149 sleep(2)2150 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':55, 'y':264})2151 sleep(2)2152 #好2153 allow=driver.find_elements_by_accessibility_id('好')2154 if len(allow) != 0:2155 driver.find_element_by_accessibility_id('好').click()2156 sleep(2)2157 sleep(1)2158 for i in range(1,10):2159 driver.find_elements_by_ios_predicate('name=="compose guide check box defaul"')[i].click()2160 sleep(1)2161 driver.find_element_by_accessibility_id('完成(9/9)').click()2162 sleep(1)2163 word=driver.find_element_by_xpath('//XCUIElementTypeScrollView/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTextView')2164 sleep(2)2165 word.click()2166 now0=time.strftime('%Y-%m-%d %H_%M_%S')2167 word.send_keys('I love China:'+now0)2168 sleep(1)2169 #@2170 driver.find_element_by_accessibility_id('atSome btn').click()2171 sleep(1)2172 #driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':550,'toX':50,'toY':200,'duration':1.0})2173 #sleep(2)2174 driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"Sam")]')[0].click()2175 sleep(1)2176 driver.find_element_by_accessibility_id('发布').click()2177 sleep(2)2178 #check numbers of pictures and published text here2179 title=driver.find_elements_by_xpath('//XCUIElementTypeTextView[contains(@value,"I love China:")]')2180 if len(title) != 0:2181 print('发布内容的文字检查通过')2182 else:2183 print('发布内容的文字检查失败,请检查原因')2184 now=time.strftime('%Y-%m-%d %H_%M_%S')2185 sf1='../../test_report/ios/'+now+'_errorText_R_stg_tc033.png'2186 driver.get_screenshot_as_file(sf1)2187 sleep(2)2188 number=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="9"]')2189 if len(number) != 0:2190 print('发布内容的上传9张图片检查通过')2191 else:2192 print('发布内容的上传9张图片检查失败,请检查原因')2193 now=time.strftime('%Y-%m-%d %H_%M_%S')2194 sf2='../../test_report/ios/'+now+'_errorPic9_R_stg_tc033.png'2195 driver.get_screenshot_as_file(sf2)2196 sleep(2)2197 """2198 #logout2199 #我的2200 driver.find_element_by_accessibility_id('我的').click()2201 sleep(3)2202 driver.execute_script('mobile: dragFromToForDuration',{'fromX':250,'fromY':550,'toX':250,'toY':200,'duration':1.0})2203 sleep(2)2204 #设置2205 driver.find_element_by_accessibility_id('设置').click()2206 sleep(1)2207 driver.find_element_by_accessibility_id('退出登录').click()2208 sleep(1)2209 driver.find_element_by_accessibility_id('确认').click()2210 sleep(2)2211 driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':200,'toX':50,'toY':550,'duration':1.0})2212 sleep(3)2213 #relogin as 'Sam8198'2214 #not working now2215 #driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="注册/登录"]').click()2216 driver.execute_script("mobile: tap", {"touchCount":"1", "x":67, "y":100})2217 sleep(2)2218 #登录页面2219 mobile_no=driver.find_elements_by_class_name('XCUIElementTypeTextField')[0]2220 mobile_no.click()2221 sleep(1)2222 mobile_no.send_keys('98762648198')2223 sleep(1)2224 code=driver.find_elements_by_class_name('XCUIElementTypeTextField')[1]2225 code.click()2226 sleep(1)2227 code.send_keys('112233')2228 sleep(1)2229 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="注册/登录"]').click()2230 sleep(7)2231 #朋友2232 driver.find_element_by_accessibility_id('朋友').click()2233 sleep(5)2234 #检查好友'Sam8198'是否收到@通知2235 fb=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"@了你")]')2236 if len(fb) != 0:2237 print('好友收到@通知检查通过')2238 else:2239 print('好友收到@通知检查失败,请检查原因')2240 now=time.strftime('%Y-%m-%d %H_%M_%S')2241 sf2='../../test_report/ios/'+now+'_error#friend_R_tc033.png'2242 driver.get_screenshot_as_file(sf2)2243 sleep(2)2244 #relogin2245 bp_is_loggedin(self)2246 sleep(1)2247 bp_normalloginmp(self)2248 sleep(2)2249 """2250 else:2251 print('发此刻按钮不存在,请检查原因')2252 sleep(1)2253 now=time.strftime('%Y-%m-%d %H_%M_%S')2254 print('TC_发现_发布此刻并@好友----结束:'+now)2255#*******************************************************2256#TC Name:test_faxian_ugcshare_tc0342257#Purpose:检查发现页面此刻tab下的ugc的分享功能2258#OS:iOS2259#Device:iPhone72260#Pre-conditions:用户已正常登录app2261#Post-conditions:N/A2262#Modify History:created by Sam [2018/08/24]2263#*******************************************************2264 def test_faxian_ugcshare_tc034(self):2265 driver=self.driver2266 print('TC_检查手机号码登录APP,检查点:发现_发现页面此刻tab下的ugc的分享功能----step1进入发现页面此刻tab')2267 print('step2检查ugc是否存在;step3进入ugc页面点右上角的分享按钮;step4检查分享微信好友功能是否正常')2268 print('step5检查分享朋友圈功能是否正常;step6检查分享新浪微博功能是否正常;step7检查分享我的朋友功能是否正常')2269 now=time.strftime('%Y-%m-%d %H_%M_%S')2270 print('TC_发现_此刻tab下的ugc的分享功能----开始:'+now)2271 sleep(2)2272 driver.find_element_by_accessibility_id('返回').click()2273 sleep(2)2274 #此刻2275 driver.find_element_by_accessibility_id('此刻').click()2276 sleep(3)2277 u=driver.find_elements_by_class_name('XCUIElementTypeCell')2278 if len(u) != 0:2279 print('UGC存在,检查通过')2280 sleep(2)2281 #driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':500,'toX':50,'toY':200,'duration':1.0})2282 #sleep(2)2283 driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"Sam")]')[0].click()2284 sleep(2)2285 #...more icon 原来2286 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="icon share gray background new"]').click()2287 sleep(2)2288 #微信2289 wh=driver.find_elements_by_accessibility_id('微信')2290 if len(wh) != 0:2291 print('分享到微信按钮存在,检查通过')2292 sleep(2)2293 driver.find_element_by_accessibility_id('微信').click()2294 sleep(8)2295 driver.find_element_by_accessibility_id('王小龙').click()2296 sleep(3)2297 words=driver.find_elements_by_xpath('//XCUIElementTypeWindow[4]/XCUIElementTypeImage[1]/XCUIElementTypeOther[5]/XCUIElementTypeTextView')2298 sleep(2)2299 if len(words) != 0:2300 words[0].click()2301 sleep(1)2302 now0=time.strftime('%Y-%m-%d %H_%M_%S')2303 words[0].send_keys('我用Python_UGC微信好友:'+now0)2304 sleep(1)2305 #发送2306 driver.find_element_by_accessibility_id('发送').click()2307 sleep(1)2308 driver.find_element_by_accessibility_id('返回蔚来').click()2309 sleep(1)2310 #检查toast2311 save1=driver.find_elements_by_accessibility_id('分享成功')2312 if len(save1) != 0:2313 print('分享微信成功')2314 else:2315 print('分享微信失败,请检查原因')2316 sleep(1)2317 now=time.strftime('%Y-%m-%d %H_%M_%S')2318 sf1='../../test_report/ios/'+now+'_errorsharewechat_R_stg_tc034.png'2319 driver.get_screenshot_as_file(sf1)2320 sleep(1)2321 else:2322 print('分享到微信按钮不存在,请检查原因')2323 sleep(2)2324 #...2325 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="icon share gray background new"]').click()2326 sleep(2)2327 #朋友圈2328 pyq=driver.find_elements_by_accessibility_id('朋友圈')2329 if len(pyq) != 0:2330 print('分享到朋友圈按钮存在,检查通过')2331 sleep(2)2332 driver.find_element_by_accessibility_id('朋友圈').click()2333 sleep(8)2334 word2=driver.find_element_by_xpath('//XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeOther[1]/XCUIElementTypeTextView')2335 word2.click()2336 sleep(1)2337 now2=time.strftime('%Y-%m-%d %H_%M_%S')2338 word2.send_keys('我用Python_UGC朋友圈:'+now2)2339 sleep(1)2340 driver.find_element_by_accessibility_id('表情').click()2341 sleep(1)2342 driver.find_element_by_accessibility_id('完成').click()2343 sleep(2)2344 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="公开"]').click()2345 sleep(1)2346 #私密, 仅自己可见2347 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="私密"]').click()2348 sleep(1)2349 driver.find_element_by_accessibility_id('完成').click()2350 sleep(2)2351 #发表2352 driver.find_element_by_accessibility_id('发表').click()2353 sleep(1)2354 #检查toast2355 save2=driver.find_elements_by_accessibility_id('分享成功')2356 if len(save2) != 0:2357 print('分享朋友圈成功')2358 else:2359 print('分享朋友圈失败,请检查原因')2360 sleep(1)2361 now=time.strftime('%Y-%m-%d %H_%M_%S')2362 sf2='../../test_report/ios/'+now+'_errorsharewechatpyq_R_tc034.png'2363 driver.get_screenshot_as_file(sf2)2364 sleep(2)2365 else:2366 print('分享到朋友圈按钮不存在,请检查原因')2367 sleep(1)2368 #...2369 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="icon share gray background new"]').click()2370 sleep(2)2371 #微博2372 wb=driver.find_elements_by_accessibility_id('微博')2373 if len(wb) != 0:2374 print('分享到微博按钮存在,检查通过')2375 sleep(2)2376 driver.find_element_by_accessibility_id('微博').click()2377 sleep(8)2378 driver.find_element_by_accessibility_id('发送到分组').click()2379 sleep(2)2380 #仅自己可见2381 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="仅自己可见"]').click()2382 sleep(2)2383 #发送2384 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="转发到微博"]').click()2385 sleep(0.2)2386 #检查toast2387 save3=driver.find_elements_by_accessibility_id('分享成功')2388 if len(save3) != 0:2389 print('分享微博成功')2390 else:2391 print('分享微博失败,请检查原因')2392 sleep(1)2393 now=time.strftime('%Y-%m-%d %H_%M_%S')2394 sf3='../../test_report/ios/'+now+'_errorsharewebo_R_stg_tc034.png'2395 driver.get_screenshot_as_file(sf3)2396 sleep(2)2397 else:2398 print('分享到微博按钮不存在,请检查原因')2399 sleep(2)2400 #...2401 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="icon share gray background new"]').click()2402 sleep(2)2403 #我的朋友2404 mf=driver.find_elements_by_accessibility_id('我的朋友')2405 if len(mf) != 0:2406 print('分享到我的朋友按钮存在,检查通过')2407 sleep(2)2408 driver.find_element_by_accessibility_id('我的朋友').click()2409 sleep(2)2410 driver.find_element_by_accessibility_id('朋友').click()2411 sleep(2)2412 #Sam82012413 driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"Sam8")]')[0].click()2414 sleep(1)2415 #发送2416 #检查toast2417 save4=driver.find_elements_by_accessibility_id('分享成功')2418 if len(save4) != 0:2419 print('分享我的朋友成功')2420 else:2421 print('分享我的朋友失败,请检查原因')2422 sleep(1)2423 now=time.strftime('%Y-%m-%d %H_%M_%S')2424 sf4='../../test_report/ios'+now+'_errorsharemyfriend_R_stg_tc034.png'2425 driver.get_screenshot_as_file(sf4)2426 sleep(2)2427 else:2428 print('分享到我的朋友按钮不存在,请检查原因')2429 sleep(2)2430 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="all page back grey icon"]').click()2431 sleep(2)2432 now=time.strftime('%Y-%m-%d %H_%M_%S')2433 print('TC_发现_此刻tab下的ugc的分享功能----结束:'+now)2434#*******************************************************2435#TC Name:test_faxian_ugcdel_tc0352436#Purpose:检查发现页面此刻tab下的ugc的删除功能2437#OS:iOS2438#Device:iPhone72439#Pre-conditions:用户已正常登录app2440#Post-conditions:N/A2441#Modify History:created by Sam [2018/08/27]2442#*******************************************************2443 def test_faxian_ugcdel_tc035(self):2444 driver=self.driver2445 print('TC_检查手机号码登录APP,检查点:发现_发现页面此刻tab下的ugc的分享功能----step1进入发现页面此刻tab')2446 print('step2检查ugc是否存在;step3进入ugc页面点右上角的...按钮;step4检查删除按钮是否存在')2447 print('step5检查删除ugc功能是否正常')2448 now=time.strftime('%Y-%m-%d %H_%M_%S')2449 print('TC_发现_此刻tab下的ugc的删除功能----开始:'+now)2450 sleep(2)2451 driver.find_element_by_accessibility_id('返回').click()2452 sleep(2)2453 #此刻2454 driver.find_element_by_accessibility_id('此刻').click()2455 sleep(3)2456 u=driver.find_elements_by_class_name('XCUIElementTypeCell')2457 if len(u) != 0:2458 print('UGC存在,检查通过')2459 sleep(2)2460 my=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="SamSTG"]')2461 sleep(2)2462 #print(len(my))2463 if len(my) != 0:2464 driver.find_element_by_accessibility_id('SamSTG').click()2465 sleep(2)2466 #和分享按钮合并2467 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="icon share gray background new"]').click()2468 sleep(2)2469 #删除2470 d=driver.find_elements_by_accessibility_id('删除')2471 if len(d) != 0:2472 print('删除按钮存在,检查通过')2473 sleep(2)2474 driver.find_element_by_accessibility_id('删除').click()2475 sleep(1)2476 driver.find_element_by_accessibility_id('确认').click()2477 sleep(1)2478 #检查toast2479 save1=driver.find_elements_by_accessibility_id('删除成功')2480 if len(save1) != 0:2481 print('删除ugc成功')2482 else:2483 print('删除ugc失败,请检查原因')2484 now=time.strftime('%Y-%m-%d %H_%M_%S')2485 sf1='../../test_report/ios/'+now+'_errorDelUgc_R_stg_tc035.png'2486 driver.get_screenshot_as_file(sf1)2487 sleep(2)2488 else:2489 print('删除按钮不存在,请检查原因')2490 sleep(2)2491 else:2492 print('不是本人发布的ugc,没有删除的权限')2493 sleep(2)2494 else:2495 print('UGC不存在,无法执行删除操作')2496 sleep(2)2497 now=time.strftime('%Y-%m-%d %H_%M_%S')2498 print('TC_发现_此刻tab下的ugc的删除功能----结束:'+now)2499#*******************************************************2500#TC Name:test_pengyou_im_tc0362501#Purpose:检查朋友页面IM聊天信息复制、删除、撤回、转发2502#OS:iOS2503#Device:iPhone72504#Pre-conditions:用户已正常登录app2505#Post-conditions:N/A2506#Modify History:created by Sam [2018/08/30]2507#*******************************************************2508 def test_pengyou_im_tc036(self):2509 driver=self.driver2510 print('TC_检查手机号码登录APP,检查点:朋友_IM聊天信息复制、删除、撤回、转发功能----step1朋友页面找到一个朋友发起聊天')2511 print('step2发送一条消息;step3检查复制消息功能;step4检查删除消息功能')2512 print('step5检查转发消息功能;step6检查撤回消息功能')2513 now=time.strftime('%Y-%m-%d %H_%M_%S')2514 print('TC_朋友_IM聊天信息复制、删除、撤回、转发功能----开始:'+now)2515 sleep(2)2516 driver.find_element_by_accessibility_id('返回').click()2517 sleep(2)2518 #朋友2519 driver.find_element_by_accessibility_id('朋友').click()2520 sleep(5)2521 driver.find_element_by_xpath('//XCUIElementTypeNavigationBar[@name="朋友"]/XCUIElementTypeButton').click()2522 sleep(2)2523 u=driver.find_elements_by_class_name('XCUIElementTypeCell')2524 if len(u) != 0:2525 driver.find_elements_by_class_name('XCUIElementTypeCell')[0].click()2526 sleep(3)2527 #聊天2528 driver.find_element_by_accessibility_id('聊天').click()2529 sleep(2)2530 #发送文本信息2531 word=driver.find_element_by_accessibility_id('chat_input_textView')2532 word.click()2533 sleep(1)2534 word.send_keys('测试im')2535 sleep(1)2536 #发送2537 driver.find_element_by_accessibility_id('Send').click()2538 sleep(2)2539 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':100, 'y':200})2540 sleep(1)2541 #长按im2542 d=driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="测试im"]')2543 driver.execute_script('mobile: touchAndHold',{'element':d,'duration':1.0})2544 sleep(1)2545 #复制2546 cp=driver.find_elements_by_accessibility_id('复制')2547 if len(cp) != 0:2548 print('复制消息按钮存在,检查通过')2549 sleep(2)2550 driver.find_element_by_accessibility_id('复制').click()2551 sleep(1)2552 word.click()2553 sleep(1)2554 driver.execute_script('mobile: touchAndHold',{'element':word,'duration':1.0})2555 sleep(1)2556 #粘贴2557 driver.find_element_by_accessibility_id('粘贴').click()2558 sleep(1)2559 driver.find_element_by_accessibility_id('Send').click()2560 sleep(1)2561 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':100, 'y':200})2562 sleep(1)2563 #检查2564 c=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="测试im"]')2565 #print(len(c))2566 if len(c) != 1:2567 print('复制消息成功')2568 else:2569 print('复制消息失败,请检查原因')2570 sleep(2)2571 else:2572 print('复制消息按钮不存在,请检查原因')2573 sleep(2)2574 #长按im2575 d=driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="测试im"]')2576 driver.execute_script('mobile: touchAndHold',{'element':d,'duration':1.0})2577 sleep(1)2578 #删除消息2579 de=driver.find_elements_by_accessibility_id('删除')2580 if len(de) != 0:2581 print('删除消息按钮存在,检查通过')2582 sleep(2)2583 driver.find_element_by_accessibility_id('删除').click()2584 sleep(1)2585 #检查2586 c2=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="测试im"]')2587 #print(len(c2))2588 if len(c2) == 1:2589 print('删除消息成功')2590 else:2591 print('删除消息失败,请检查原因')2592 sleep(2)2593 else:2594 print('删除消息按钮不存在,请检查原因')2595 sleep(2)2596 #长按im2597 d=driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="测试im"]')2598 driver.execute_script('mobile: touchAndHold',{'element':d,'duration':1.0})2599 sleep(1)2600 #转发消息2601 de=driver.find_elements_by_accessibility_id('转发')2602 if len(de) != 0:2603 print('转发消息按钮存在,检查通过')2604 sleep(2)2605 driver.find_element_by_accessibility_id('转发').click()2606 sleep(1)2607 driver.find_element_by_accessibility_id('朋友').click()2608 sleep(1)2609 fri=driver.find_elements_by_class_name('XCUIElementTypeCell')2610 if len(fri) != 0:2611 #1nd friend2612 driver.find_elements_by_class_name('XCUIElementTypeCell')[1].click()2613 else:2614 print('没有其他朋友可以转发消息')2615 sleep(1)2616 driver.find_element_by_accessibility_id('all page back black icon').click()2617 sleep(2)2618 driver.find_element_by_accessibility_id('all page back black icon').click()2619 sleep(2)2620 else:2621 print('转发消息按钮不存在,请检查原因')2622 sleep(2)2623 #新发一条im2624 word.click()2625 sleep(1)2626 word.send_keys('测试撤回im')2627 sleep(1)2628 #发送2629 driver.find_element_by_accessibility_id('Send').click()2630 sleep(1)2631 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':100, 'y':200})2632 sleep(1)2633 #长按im2634 d=driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="测试撤回im"]')2635 driver.execute_script('mobile: touchAndHold',{'element':d,'duration':1.0})2636 sleep(1)2637 #撤回消息2638 wd=driver.find_elements_by_accessibility_id('撤回')2639 if len(wd) != 0:2640 print('撤回消息按钮存在,检查通过')2641 sleep(2)2642 driver.find_element_by_accessibility_id('撤回').click()2643 sleep(1)2644 #检查2645 w=driver.find_elements_by_accessibility_id('你撤回了一条消息')2646 if len(w) != 0:2647 print('撤回消息成功')2648 else:2649 print('撤回消息失败,请检查原因')2650 sleep(2)2651 else:2652 print('撤回消息按钮不存在,请检查原因')2653 sleep(2)2654 driver.find_element_by_accessibility_id('all page back black icon').click()2655 sleep(1)2656 else:2657 print('朋友不存在,无法执行聊天相关操作')2658 sleep(2)2659 now=time.strftime('%Y-%m-%d %H_%M_%S')2660 print('TC_朋友_IM聊天信息复制、删除、撤回、转发功能----结束:'+now)2661 2662#*******************************************************2663#TC Name:test_faxian_infopgcshare_tc0372664#Purpose:检查发现页面资讯tab下的pgc的分享功能2665#OS:iOS2666#Device:iPhone72667#Pre-conditions:用户已正常登录app2668#Post-conditions:N/A2669#Modify History:created by Sam [2018/08/29]2670#*******************************************************2671 def test_faxian_infopgcshare_tc037(self):2672 driver=self.driver2673 print('TC_检查手机号码登录APP,检查点:发现_发现页面资讯tab下的pgc的分享功能----step1进入发现页面资讯tab')2674 print('step2PGC的UI检查;step3进入pgc文章页面点右下角的分享按钮;step4检查分享微信好友功能是否正常')2675 print('step5检查分享朋友圈功能是否正常;step6检查分享新浪微博功能是否正常;step7检查分享我的朋友功能是否正常')2676 now=time.strftime('%Y-%m-%d %H_%M_%S')2677 print('TC_发现_发现页面资讯tab下的PGC的分享功能----开始:'+now)2678 sleep(2)2679 driver.find_element_by_accessibility_id('返回').click()2680 sleep(2)2681 driver.find_element_by_accessibility_id('资讯').click()2682 sleep(3)2683 """2684 for i in range(4):2685 driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':500,'toX':50,'toY':45,'duration':1.0})2686 sleep(2)2687 #driver.execute_script("mobile: scroll", {"direction": "down"})2688 sleep(2)2689 """2690 #检查发现页面资讯tab下的pgc的的各个元素是否存在2691 c=fun_pgcui_check(self)2692 if c == True:2693 print('发现页面资讯tab下的pgc的各个被检查元素都检查完毕')2694 sleep(1)2695 u=driver.find_elements_by_class_name('XCUIElementTypeCell')2696 if len(u) != 0:2697 print('PGC存在,检查通过')2698 sleep(2)2699 driver.find_element_by_accessibility_id('小龙投票stg').click()2700 sleep(6)2701 #左上角按钮2702 sh=driver.find_elements_by_xpath('(//XCUIElementTypeOther[@name="小龙投票stg"])[1]/XCUIElementTypeOther[2]')2703 if len(sh) != 0:2704 print('分享按钮存在,检查通过')2705 sleep(2)2706 #driver.find_element_by_xpath('(//XCUIElementTypeOther[@name="测试文章改版 - 1"])[1]/XCUIElementTypeOther[2]').click()2707 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':343, 'y':42})2708 sleep(2)2709 #微信2710 wh=driver.find_elements_by_accessibility_id('微信')2711 if len(wh) != 0:2712 print('分享到微信按钮存在,检查通过')2713 sleep(2)2714 driver.find_element_by_accessibility_id('微信').click()2715 sleep(6)2716 driver.find_element_by_accessibility_id('王小龙').click()2717 sleep(3)2718 words=driver.find_elements_by_xpath('//XCUIElementTypeWindow[4]/XCUIElementTypeImage[1]/XCUIElementTypeOther[5]/XCUIElementTypeTextView')2719 sleep(2)2720 if len(words) != 0:2721 words[0].click()2722 sleep(1)2723 now0=time.strftime('%Y-%m-%d %H_%M_%S')2724 words[0].send_keys('人生苦短PGC微信好友:'+now0)2725 sleep(1)2726 #发送2727 driver.find_element_by_accessibility_id('发送').click()2728 sleep(2)2729 driver.find_element_by_accessibility_id('返回蔚来').click()2730 sleep(1)2731 #检查toast2732 save1=driver.find_elements_by_accessibility_id('分享成功')2733 if len(save1) != 0:2734 print('分享微信好友成功')2735 sleep(1)2736 else:2737 print('分享微信好友失败,请检查原因')2738 sleep(1)2739 now=time.strftime('%Y-%m-%d %H_%M_%S')2740 sf1='../../test_report/ios/'+now+'_errorPGCsharewechat_R_stg_tc037.png'2741 driver.get_screenshot_as_file(sf1)2742 sleep(2)2743 else:2744 print('分享到微信好友按钮不存在,请检查原因')2745 sleep(2)2746 #share2747 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':343, 'y':42})2748 sleep(2)2749 #朋友圈2750 pyq=driver.find_elements_by_accessibility_id('朋友圈')2751 if len(pyq) != 0:2752 print('分享到朋友圈按钮存在,检查通过')2753 sleep(1)2754 driver.find_element_by_accessibility_id('朋友圈').click()2755 sleep(8)2756 word2=driver.find_element_by_xpath('//XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeOther[1]/XCUIElementTypeTextView')2757 word2.click()2758 sleep(1)2759 now2=time.strftime('%Y-%m-%d %H_%M_%S')2760 word2.send_keys('人生苦短PGC朋友圈:'+now2)2761 sleep(1)2762 driver.find_element_by_accessibility_id('表情').click()2763 sleep(1)2764 driver.find_element_by_accessibility_id('完成').click()2765 sleep(2)2766 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="公开"]').click()2767 sleep(1)2768 #私密, 仅自己可见2769 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="私密"]').click()2770 sleep(1)2771 driver.find_element_by_accessibility_id('完成').click()2772 sleep(2)2773 #发表2774 driver.find_element_by_accessibility_id('发表').click()2775 sleep(1)2776 #检查toast2777 save2=driver.find_elements_by_accessibility_id('分享成功')2778 if len(save2) != 0:2779 print('分享朋友圈成功')2780 sleep(1)2781 else:2782 print('分享朋友圈失败,请检查原因')2783 sleep(1)2784 now=time.strftime('%Y-%m-%d %H_%M_%S')2785 sf2='../../test_report/ios/'+now+'_errorPGCsharewechatpyq_R_stg_tc037.png'2786 driver.get_screenshot_as_file(sf2)2787 sleep(1)2788 else:2789 print('分享到朋友圈按钮不存在,请检查原因')2790 sleep(2)2791 #share2792 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':343, 'y':42})2793 sleep(2)2794 #微博2795 wb=driver.find_elements_by_accessibility_id('微博')2796 if len(wb) != 0:2797 print('分享到微博按钮存在,检查通过')2798 sleep(2)2799 driver.find_element_by_accessibility_id('微博').click()2800 sleep(8)2801 driver.find_element_by_accessibility_id('发送到分组').click()2802 sleep(2)2803 #仅自己可见2804 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="仅自己可见"]').click()2805 sleep(2)2806 #发送2807 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="转发到微博"]').click()2808 sleep(1)2809 #检查toast2810 save3=driver.find_elements_by_accessibility_id('分享成功')2811 if len(save3) != 0:2812 print('分享微博成功')2813 sleep(1)2814 else:2815 print('分享微博失败,请检查原因')2816 sleep(1)2817 now=time.strftime('%Y-%m-%d %H_%M_%S')2818 sf3='../../test_report/ios/'+now+'_errorPGCsharewebo_R_stg_tc037.png'2819 driver.get_screenshot_as_file(sf3)2820 sleep(1)2821 else:2822 print('分享到新浪微博按钮不存在,请检查原因')2823 sleep(2)2824 #share2825 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':343, 'y':42})2826 sleep(2)2827 #我的朋友2828 mf=driver.find_elements_by_accessibility_id('我的朋友')2829 if len(mf) != 0:2830 print('分享到我的朋友按钮存在,检查通过')2831 sleep(2)2832 driver.find_element_by_accessibility_id('我的朋友').click()2833 sleep(2)2834 driver.find_element_by_accessibility_id('朋友').click()2835 sleep(2)2836 driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"Sam")]')[0].click()2837 sleep(1)2838 #检查toast2839 save4=driver.find_elements_by_accessibility_id('分享成功')2840 if len(save4) != 0:2841 print('分享我的朋友成功')2842 sleep(1)2843 else:2844 print('分享我的朋友失败,请检查原因')2845 sleep(1)2846 now=time.strftime('%Y-%m-%d %H_%M_%S')2847 sf4='../../test_report/ios/'+now+'_errorPGCsharemyfriend_R_stg_tc037.png'2848 driver.get_screenshot_as_file(sf4)2849 sleep(1)2850 else:2851 print('分享到我的朋友按钮不存在,请检查原因')2852 sleep(2)2853 else:2854 print('分享按钮不存在,请检查原因')2855 sleep(2)2856 #driver.find_element_by_xpath('(//XCUIElementTypeOther[@name="小龙投票stg"])[1]/XCUIElementTypeOther[1]').click()2857 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':32, 'y':42})2858 sleep(2)2859 else:2860 print('PGC不存在,无法执行分享操作')2861 sleep(2)2862 now=time.strftime('%Y-%m-%d %H_%M_%S')2863 print('TC_发现_发现页面资讯tab下的PGC的分享功能----结束:'+now)2864#*******************************************************2865#TC Name:test_faxian_experjoin_tc0382866#Purpose:发现页面体验tab活动的报名功能2867#OS:iOS2868#Device:iPhone72869#Pre-conditions:用户已正常登录app2870#Post-conditions:N/A2871#Modify History:created by Sam [2018/09/30]2872#*******************************************************2873 def test_faxian_experjoin_tc038(self):2874 driver=self.driver2875 print('TC_检查手机号码登录APP,检查点:已登录账号发现——体验tab活动的报名功能---step1发现页面里点击体验tab')2876 print('step2切换地点找到一个同城活动;step3检查报名功能是否正常;step4进入我的->我的活动页面')2877 print('step5点击查看行程单;step6检查活动订单里活动的时间是否正确')2878 now=time.strftime('%Y-%m-%d %H_%M_%S')2879 print('TC_发现——体验tab活动的报名功能----开始:'+now)2880 sleep(1)2881 driver.find_element_by_accessibility_id('返回').click()2882 sleep(1)2883 #体验2884 driver.find_element_by_accessibility_id('体验').click()2885 sleep(5)2886 driver.find_element_by_xpath('//XCUIElementTypeTable/XCUIElementTypeCell[1]/XCUIElementTypeButton[2]').click()2887 sleep(2)2888 #driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':550,'toX':50,'toY':150,'duration':1.0})2889 #sleep(2)2890 driver.find_element_by_accessibility_id('蔚来中心丨上海太古汇店1112121312').click()2891 sleep(2)2892 for i in range(2):2893 driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':550,'toX':50,'toY':50,'duration':1.0})2894 sleep(2)2895 sleep(2)2896 #page=driver.page_source2897 #sleep(2)2898 #自动化测试活动12899 driver.find_element_by_accessibility_id('小龙自动化2').click()2900 sleep(8)2901 page=driver.page_source2902 sleep(2)2903 #报名2904 joins=driver.find_elements_by_xpath('//XCUIElementTypeLink[@name="报名"]')2905 sleep(2)2906 if len(joins) != 0:2907 print('报名按钮存在,检查通过')2908 sleep(2)2909 driver.find_element_by_xpath('//XCUIElementTypeLink[@name="报名"]').click()2910 sleep(4)2911 #场次2912 #driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="10.28 / 00:00"]').click()2913 #sleep(1)2914 #driver.find_element_by_xpath('//XCUIElementTypeStaticText[contains(@name,"稍等哈活动")]').click()2915 #sleep(2)2916 #+限购1张2917 #driver.find_element_by_xpath('//XCUIElementTypeButton[@name="+"]').click()2918 #sleep(1)2919 driver.execute_script('mobile: dragFromToForDuration',{'fromX':350,'fromY':550,'toX':350,'toY':50,'duration':1.0})2920 sleep(2)2921 #姓名2922 name=driver.find_elements_by_class_name('XCUIElementTypeTextField')[0]2923 name.click()2924 name.send_keys('王银泉')2925 sleep(1)2926 driver.find_element_by_accessibility_id('完成').click()2927 sleep(1)2928 driver.find_element_by_xpath('//XCUIElementTypeOther[@name="性别"]').click()2929 sleep(1)2930 #确定2931 driver.find_element_by_xpath('//XCUIElementTypeButton[contains(@name,"确定")]').click()2932 sleep(2)2933 #mobile2934 mb=driver.find_elements_by_class_name('XCUIElementTypeTextField')[1]2935 mb.click()2936 sleep(1)2937 mb.send_keys('18930018802')2938 sleep(1)2939 driver.find_element_by_accessibility_id('完成').click()2940 sleep(1)2941 #证件类别2942 driver.find_element_by_xpath('//XCUIElementTypeOther[@name="证件类别"]').click()2943 sleep(1)2944 #确定2945 driver.find_element_by_xpath('//XCUIElementTypeButton[contains(@name,"确定")]').click()2946 sleep(2)2947 #证件号码2948 em=driver.find_elements_by_class_name('XCUIElementTypeTextField')[2]2949 em.click()2950 sleep(1)2951 em.send_keys('340103197301142518')2952 sleep(1)2953 driver.find_element_by_accessibility_id('完成').click()2954 sleep(2)2955 #购买2956 driver.find_element_by_accessibility_id('购买').click()2957 sleep(1)2958 #确认2959 driver.find_element_by_accessibility_id('确认').click()2960 sleep(3)2961 #checking2962 ch=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="预约成功"]')2963 if len(ch) == 0:2964 print('报名失败,请检查原因')2965 now=time.strftime('%Y-%m-%d %H_%M_%S')2966 sf1='../../test_report/ios/'+now+'_errorJoin_R_tc038.png'2967 driver.get_screenshot_as_file(sf1)2968 sleep(2)2969 else:2970 print('报名成功')2971 sleep(1)2972 driver.find_element_by_accessibility_id('完成').click()2973 sleep(5)2974 #driver.find_element_by_xpath('//XCUIElementTypeOther[@name="蔚来"]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]').click()2975 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':30, 'y':22})2976 sleep(3)2977 #driver.find_element_by_xpath('//XCUIElementTypeOther[@name="蔚来"]/XCUIElementTypeOther[1]').click()2978 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':32, 'y':42})2979 sleep(2)2980 #driver.find_element_by_accessibility_id('all page back black icon').click()2981 #driver.execute_script('mobile: tap', {'touchCount':'1', 'x':27, 'y':42})2982 #sleep(2)2983 #我的2984 driver.find_element_by_accessibility_id('我的').click()2985 sleep(3)2986 driver.find_element_by_accessibility_id('我的活动').click()2987 sleep(3)2988 ch2=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@value,"2月4日")]')2989 if len(ch2) != 0:2990 print('活动订单里活动时间检查通过')2991 sleep(1)2992 else:2993 print('活动订单里活动时间检查失败,请检查原因')2994 sleep(1)2995 now=time.strftime('%Y-%m-%d %H_%M_%S')2996 sf2='../../test_report/ios/'+now+'_errorMyActivity_R_stg_tc038.png'2997 driver.get_screenshot_as_file(sf2)2998 sleep(2)2999 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="all page back black icon"]').click()3000 sleep(2)3001 else:3002 print('报名按钮不存在,请检查原因')3003 sleep(2)3004 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':32, 'y':42})3005 sleep(2)3006 now=time.strftime('%Y-%m-%d %H_%M_%S')3007 print('TC_发现——体验tab活动的报名功能----结束:'+now)3008#*******************************************************3009#TC Name:test_wode_canceljoin_tc0393010#Purpose:我的页面我的活动里取消报名的功能3011#OS:iOS3012#Device:iPhone73013#Post-conditions:N/A3014#Modify History:created by Sam [2018/09/30]3015#*******************************************************3016 def test_wode_canceljoin_tc039(self):3017 driver=self.driver3018 print('TC_检查手机号码登录APP,检查点:已登录账号发现——我的页面我的活动里取消报名的功能---step1进入我的->我的活动页面')3019 print('step2点击查看行程单;step3检查取消报名按钮是否存在;step4检查取消报名功能是否正常')3020 print('step5检查活动订单里是否暂无活动预约')3021 now=time.strftime('%Y-%m-%d %H_%M_%S')3022 print('TC_我的——我的活动里取消报名的功能----开始:'+now)3023 sleep(2)3024 driver.find_element_by_accessibility_id('返回').click()3025 sleep(2)3026 #我的3027 driver.find_element_by_accessibility_id('我的').click()3028 sleep(4)3029 #我的活动3030 driver.find_element_by_accessibility_id('我的活动').click()3031 sleep(3)3032 ch=driver.find_elements_by_xpath('//XCUIElementTypeButton[@name="取消报名"]')3033 if len(ch) != 0:3034 print('取消报名按钮存在,检查通过')3035 sleep(1)3036 driver.find_element_by_accessibility_id('取消报名').click()3037 sleep(1)3038 #是3039 driver.find_element_by_accessibility_id('是').click()3040 sleep(1)3041 #checking3042 ch1=driver.find_elements_by_accessibility_id('取消成功')3043 if len(ch1) != 0:3044 print('取消报名成功')3045 sleep(4)3046 driver.find_element_by_accessibility_id('all page back black icon').click()3047 sleep(2)3048 #我的活动3049 driver.find_element_by_accessibility_id('我的活动').click()3050 sleep(4)3051 #暂无活动预约3052 ch2=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="小龙自动化2"]')3053 if len(ch2) == 0:3054 print('我的预约活动已取消报名,检查通过')3055 sleep(1)3056 else:3057 print('我的预约活动取消报名失败,请检查原因')3058 sleep(1)3059 now=time.strftime('%Y-%m-%d %H_%M_%S')3060 sf0='../../test_report/ios/'+now+'_errorActivityList_R.png'3061 driver.get_screenshot_as_file(sf0)3062 sleep(2)3063 driver.find_element_by_accessibility_id('all page back black icon').click()3064 sleep(2)3065 else:3066 print('取消报名失败,请检查原因')3067 sleep(1)3068 now=time.strftime('%Y-%m-%d %H_%M_%S')3069 sf1='../../test_report/ios/'+now+'_errorCancel_R_stg_tc039.png'3070 driver.get_screenshot_as_file(sf1)3071 sleep(2)3072 else:3073 print('取消报名按钮不存在,请检查原因')3074 sleep(1)3075 now=time.strftime('%Y-%m-%d %H_%M_%S')3076 sf2='../../test_report/ios/'+now+'_errorNoCancelJoin_R_stg_tc039.png'3077 driver.get_screenshot_as_file(sf2)3078 sleep(2)3079 driver.find_element_by_accessibility_id('all page back black icon').click()3080 sleep(2)3081 now=time.strftime('%Y-%m-%d %H_%M_%S')3082 print('TC_我的——我的活动里取消报名的功能----结束:'+now)3083#*******************************************************3084#TC Name:test_faxian_expershare_tc0403085#Purpose:检查发现页面资讯tab下的pgc的分享功能3086#OS:iOS3087#Device:iPhone73088#Pre-conditions:用户已正常登录app3089#Post-conditions:N/A3090#Modify History:created by Sam [2018/09/30]3091#*******************************************************3092 def test_faxian_expershare_tc040(self):3093 driver=self.driver3094 print('TC_检查手机号码登录APP,检查点:发现_发现页面体验tab下的活动的分享功能----step1进入发现页面体验tab')3095 print('step2找到活动进入;step3检查并点右上角的分享按钮;step4检查分享微信好友功能是否正常')3096 print('step5检查分享朋友圈功能是否正常;step6检查分享新浪微博功能是否正常;step7检查分享我的朋友功能是否正常')3097 now=time.strftime('%Y-%m-%d %H_%M_%S')3098 print('TC_发现_发现页面体验tab下的活动的分享功能----开始:'+now)3099 sleep(1)3100 driver.find_element_by_accessibility_id('返回').click()3101 sleep(1)3102 #体验3103 driver.find_element_by_accessibility_id('体验').click()3104 sleep(4)3105 driver.find_element_by_xpath('//XCUIElementTypeTable/XCUIElementTypeCell[1]/XCUIElementTypeButton[2]').click()3106 sleep(2)3107 #driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':550,'toX':50,'toY':150,'duration':1.0})3108 #sleep(2)3109 driver.find_element_by_accessibility_id('蔚来中心丨上海太古汇店1112121312').click()3110 sleep(2)3111 driver.find_element_by_accessibility_id('新活动_9.7stg1').click()3112 sleep(6)3113 page=driver.page_source3114 sleep(2)3115 #分享图标3116 share=driver.find_elements_by_xpath('//XCUIElementTypeOther[@name="蔚来"]/XCUIElementTypeOther[3]')3117 sleep(2)3118 if len(share) != 0:3119 print('分享按钮存在,检查通过')3120 sleep(2)3121 #share3122 #driver.find_element_by_ios_class_chain('*/XCUIElementTypeOther[2]').click()3123 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':345, 'y':42})3124 sleep(2)3125 #微信3126 wh=driver.find_elements_by_accessibility_id('微信')3127 if len(wh) != 0:3128 print('分享到微信按钮存在,检查通过')3129 sleep(2)3130 driver.find_element_by_accessibility_id('微信').click()3131 sleep(6)3132 driver.find_element_by_accessibility_id('王小龙').click()3133 sleep(3)3134 words=driver.find_elements_by_xpath('//XCUIElementTypeWindow[4]/XCUIElementTypeImage[1]/XCUIElementTypeOther[5]/XCUIElementTypeTextView')3135 sleep(2)3136 if len(words) != 0:3137 words[0].click()3138 sleep(1)3139 now0=time.strftime('%Y-%m-%d %H_%M_%S')3140 words[0].send_keys('我用Python_PGC微信好友:'+now0)3141 sleep(1)3142 #发送3143 driver.find_element_by_accessibility_id('发送').click()3144 sleep(2)3145 driver.find_element_by_accessibility_id('返回蔚来').click()3146 sleep(0.2)3147 #检查toast3148 save1=driver.find_elements_by_accessibility_id('分享成功')3149 if len(save1) != 0:3150 print('分享微信好友成功')3151 sleep(1)3152 else:3153 print('分享微信好友失败,请检查原因')3154 sleep(1)3155 now=time.strftime('%Y-%m-%d %H_%M_%S')3156 sf1='../../test_report/ios/'+now+'_errorPGCsharewechat_R_stg_tc040.png'3157 driver.get_screenshot_as_file(sf1)3158 sleep(2)3159 else:3160 print('分享到微信好友按钮不存在,请检查原因')3161 sleep(2)3162 #share3163 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':345, 'y':42})3164 sleep(2)3165 #朋友圈3166 pyq=driver.find_elements_by_accessibility_id('朋友圈')3167 if len(pyq) != 0:3168 print('分享到朋友圈按钮存在,检查通过')3169 sleep(1)3170 driver.find_element_by_accessibility_id('朋友圈').click()3171 sleep(8)3172 word2=driver.find_element_by_xpath('//XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeOther[1]/XCUIElementTypeTextView')3173 word2.click()3174 sleep(1)3175 now2=time.strftime('%Y-%m-%d %H_%M_%S')3176 word2.send_keys('我用Python_PGC朋友圈:'+now2)3177 sleep(1)3178 driver.find_element_by_accessibility_id('表情').click()3179 sleep(1)3180 driver.find_element_by_accessibility_id('完成').click()3181 sleep(2)3182 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="公开"]').click()3183 sleep(1)3184 #私密, 仅自己可见3185 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="私密"]').click()3186 sleep(1)3187 driver.find_element_by_accessibility_id('完成').click()3188 sleep(2)3189 #发表3190 driver.find_element_by_accessibility_id('发表').click()3191 sleep(1)3192 #检查toast3193 save2=driver.find_elements_by_accessibility_id('分享成功')3194 if len(save2) != 0:3195 print('分享朋友圈成功')3196 sleep(1)3197 else:3198 print('分享朋友圈失败,请检查原因')3199 sleep(1)3200 now=time.strftime('%Y-%m-%d %H_%M_%S')3201 sf2='../../test_report/ios/'+now+'_errorPGCsharewechatpyq_R_stg_tc040.png'3202 driver.get_screenshot_as_file(sf2)3203 sleep(1)3204 else:3205 print('分享到朋友圈按钮不存在,请检查原因')3206 sleep(2)3207 #share3208 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':345, 'y':42})3209 sleep(2)3210 #微博3211 wb=driver.find_elements_by_accessibility_id('微博')3212 if len(wb) != 0:3213 print('分享到微博按钮存在,检查通过')3214 sleep(2)3215 driver.find_element_by_accessibility_id('微博').click()3216 sleep(8)3217 driver.find_element_by_accessibility_id('发送到分组').click()3218 sleep(2)3219 #仅自己可见3220 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="仅自己可见"]').click()3221 sleep(2)3222 #发送3223 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="转发到微博"]').click()3224 #sleep(0.2)3225 #检查toast3226 save3=driver.find_elements_by_accessibility_id('分享成功')3227 if len(save3) != 0:3228 print('分享微博成功')3229 sleep(1)3230 else:3231 print('分享微博失败,请检查原因')3232 sleep(1)3233 now=time.strftime('%Y-%m-%d %H_%M_%S')3234 sf3='../../test_report/ios/'+now+'_errorPGCsharewebo_R_stg_tc040.png'3235 driver.get_screenshot_as_file(sf3)3236 sleep(1)3237 else:3238 print('分享到新浪微博按钮不存在,请检查原因')3239 sleep(2)3240 #share3241 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':345, 'y':42})3242 sleep(2)3243 #我的朋友3244 mf=driver.find_elements_by_accessibility_id('我的朋友')3245 if len(mf) != 0:3246 print('分享到我的朋友按钮存在,检查通过')3247 sleep(1)3248 driver.find_element_by_accessibility_id('我的朋友').click()3249 sleep(2)3250 driver.find_element_by_accessibility_id('朋友').click()3251 sleep(2)3252 driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"Sam")]')[0].click()3253 sleep(1)3254 #检查toast3255 save4=driver.find_elements_by_accessibility_id('分享成功')3256 if len(save4) != 0:3257 print('分享我的朋友成功')3258 sleep(1)3259 else:3260 print('分享我的朋友失败,请检查原因')3261 sleep(1)3262 now=time.strftime('%Y-%m-%d %H_%M_%S')3263 sf4='../../test_report/ios/'+now+'_errorPGCsharemyfriend_R_stg_tc040.png'3264 driver.get_screenshot_as_file(sf4)3265 sleep(1)3266 else:3267 print('分享到我的朋友按钮不存在,请检查原因')3268 sleep(2)3269 else:3270 print('分享按钮不存在/未找到,请检查原因')3271 sleep(2)3272 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':30, 'y':42})3273 sleep(2)3274 now=time.strftime('%Y-%m-%d %H_%M_%S')3275 print('TC_发现_发现页面体验tab下的活动的分享功能----结束:'+now)3276#*******************************************************3277#TC Name:test_jingxi_giftshare_tc0413278#Purpose:检查发现页面资讯tab下的pgc的分享功能3279#OS:iOS3280#Device:iPhone73281#Pre-conditions:用户已正常登录app3282#Post-conditions:N/A3283#Modify History:created by Sam [2018/09/30]3284#*******************************************************3285 def test_jingxi_giftshare_tc041(self):3286 driver=self.driver3287 print('TC_检查手机号码登录APP,检查点:惊喜_惊喜页面的商品的分享功能----step1进入惊喜页面')3288 print('step2选择一款商品点击进入商品详细页面;step3点右上角的分享按钮(先检查是否存在;step4检查分享微信好友功能是否正常')3289 print('step5检查分享朋友圈功能是否正常;step6检查分享新浪微博功能是否正常;step7检查分享我的朋友功能是否正常')3290 now=time.strftime('%Y-%m-%d %H_%M_%S')3291 print('TC_惊喜_惊喜页面的商品的分享功能----开始:'+now)3292 sleep(1)3293 driver.find_element_by_accessibility_id('返回').click()3294 sleep(1)3295 #惊喜3296 driver.find_element_by_accessibility_id('惊喜').click()3297 sleep(8)3298 for i in range(1):3299 driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':500,'toX':50,'toY':350,'duration':1.0})3300 sleep(2)3301 #driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':550,'toX':50,'toY':350,'duration':1.0})3302 sleep(2)3303 u=driver.find_elements_by_xpath('//XCUIElementTypeOther[@name="真皮iPhone手机壳 真皮iPhone手机壳 1 车主专享"]')3304 if len(u) != 0:3305 print('需要兑换的商品存在,检查通过')3306 sleep(2)3307 driver.find_element_by_xpath('//XCUIElementTypeOther[@name="真皮iPhone手机壳 真皮iPhone手机壳 1 车主专享"]').click()3308 sleep(8)3309 #分享图标3310 share=driver.find_elements_by_xpath('//XCUIElementTypeOther[@name="横幅"]/XCUIElementTypeOther[2]')3311 sleep(2)3312 if len(share) != 0:3313 print('分享按钮存在,检查通过')3314 sleep(3)3315 #share3316 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':338, 'y':58})3317 sleep(2)3318 #微信3319 wh=driver.find_elements_by_accessibility_id('微信')3320 if len(wh) != 0:3321 print('分享到微信好友按钮存在,检查通过')3322 sleep(2)3323 driver.find_element_by_accessibility_id('微信').click()3324 sleep(9)3325 driver.find_element_by_accessibility_id('王小龙').click()3326 sleep(3)3327 words=driver.find_elements_by_xpath('//XCUIElementTypeWindow[4]/XCUIElementTypeImage[1]/XCUIElementTypeOther[5]/XCUIElementTypeTextView')3328 sleep(2)3329 if len(words) != 0:3330 words[0].click()3331 sleep(1)3332 now0=time.strftime('%Y-%m-%d %H_%M_%S')3333 words[0].send_keys('我用Python_Gift微信好友:'+now0)3334 sleep(1)3335 #发送3336 driver.find_element_by_accessibility_id('发送').click()3337 sleep(2)3338 driver.find_element_by_accessibility_id('返回蔚来').click()3339 sleep(1)3340 #检查toast3341 save1=driver.find_elements_by_accessibility_id('分享成功')3342 if len(save1) != 0:3343 print('分享微信好友成功')3344 sleep(1)3345 else:3346 print('分享微信好友失败,请检查原因')3347 sleep(1)3348 now=time.strftime('%Y-%m-%d %H_%M_%S')3349 sf1='../../test_report/ios/'+now+'_errorGiftsharewechat_R_stg_tc041.png'3350 driver.get_screenshot_as_file(sf1)3351 sleep(2)3352 else:3353 print('分享到微信好友按钮不存在,请检查原因')3354 sleep(2)3355 #share3356 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':338, 'y':58})3357 sleep(2)3358 #朋友圈3359 pyq=driver.find_elements_by_accessibility_id('朋友圈')3360 if len(pyq) != 0:3361 print('分享到朋友圈按钮存在,检查通过')3362 sleep(1)3363 driver.find_element_by_accessibility_id('朋友圈').click()3364 sleep(8)3365 word2=driver.find_element_by_xpath('//XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeOther[1]/XCUIElementTypeTextView')3366 word2.click()3367 sleep(1)3368 now2=time.strftime('%Y-%m-%d %H_%M_%S')3369 word2.send_keys('我用Python_Gift朋友圈:'+now2)3370 sleep(1)3371 driver.find_element_by_accessibility_id('表情').click()3372 sleep(1)3373 driver.find_element_by_accessibility_id('完成').click()3374 sleep(2)3375 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="公开"]').click()3376 sleep(1)3377 #私密, 仅自己可见3378 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="私密"]').click()3379 sleep(1)3380 driver.find_element_by_accessibility_id('完成').click()3381 sleep(2)3382 #发表3383 driver.find_element_by_accessibility_id('发表').click()3384 sleep(1)3385 #检查toast3386 save2=driver.find_elements_by_accessibility_id('分享成功')3387 if len(save2) != 0:3388 print('分享朋友圈成功')3389 sleep(1)3390 else:3391 print('分享朋友圈失败,请检查原因')3392 sleep(1)3393 now=time.strftime('%Y-%m-%d %H_%M_%S')3394 sf2='../../test_report/ios/'+now+'_errorGiftsharewechatpyq_R_stg_tc041.png'3395 driver.get_screenshot_as_file(sf2)3396 sleep(1)3397 else:3398 print('分享到朋友圈按钮不存在,请检查原因')3399 sleep(2)3400 #share3401 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':338, 'y':58})3402 sleep(2)3403 #微博3404 wb=driver.find_elements_by_accessibility_id('微博')3405 if len(wb) != 0:3406 print('分享到微博按钮存在,检查通过')3407 sleep(2)3408 driver.find_element_by_accessibility_id('微博').click()3409 sleep(8)3410 driver.find_element_by_accessibility_id('发送到分组').click()3411 sleep(2)3412 #仅自己可见3413 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="仅自己可见"]').click()3414 sleep(2)3415 #发送3416 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="转发到微博"]').click()3417 sleep(1)3418 #检查toast3419 save3=driver.find_elements_by_accessibility_id('分享成功')3420 if len(save3) != 0:3421 print('分享微博成功')3422 sleep(1)3423 else:3424 print('分享微博失败,请检查原因')3425 sleep(1)3426 now=time.strftime('%Y-%m-%d %H_%M_%S')3427 sf3='../../test_report/ios/'+now+'_errorGiftsharewebo_R_stg_tc041.png'3428 driver.get_screenshot_as_file(sf3)3429 sleep(1)3430 else:3431 print('分享到新浪微博按钮不存在,请检查原因')3432 sleep(2)3433 #share3434 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':338, 'y':58})3435 sleep(2)3436 #我的朋友3437 mf=driver.find_elements_by_accessibility_id('我的朋友')3438 if len(mf) != 0:3439 print('分享到我的朋友按钮存在,检查通过')3440 sleep(1)3441 driver.find_element_by_accessibility_id('我的朋友').click()3442 sleep(2)3443 driver.find_element_by_accessibility_id('朋友').click()3444 sleep(2)3445 driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"Sam")]')[0].click()3446 sleep(1)3447 #检查toast3448 save4=driver.find_elements_by_accessibility_id('分享成功')3449 if len(save4) != 0:3450 print('分享我的朋友成功')3451 sleep(1)3452 else:3453 print('分享我的朋友失败,请检查原因')3454 sleep(1)3455 now=time.strftime('%Y-%m-%d %H_%M_%S')3456 sf4='../../test_report/ios/'+now+'_errorGiftsharemyfriend_R_stg_tc041.png'3457 driver.get_screenshot_as_file(sf4)3458 sleep(1)3459 else:3460 print('分享到我的朋友按钮不存在,请检查原因')3461 sleep(2)3462 else:3463 print('分享按钮不存在/未找到,请检查原因')3464 sleep(2)3465 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':24, 'y':58})3466 sleep(2)3467 else:3468 print('需要兑换的商品不存在/未找到,请检查原因')3469 sleep(2)3470 now=time.strftime('%Y-%m-%d %H_%M_%S')3471 print('TC_惊喜_惊喜页面的商品的分享功能----结束:'+now)3472#*******************************************************3473#TC Name:test_jingxi_visitor_tc0423474#Purpose:检查访客模式点击我的页面各个菜单的预期动作3475#OS:android3476#Device:iPhone73477#Pre-conditions:用户已正常登录app/未登录3478#Post-conditions:N/A3479#Modify History:created by Sam [2018/10/10]3480#*******************************************************3481 def test_jingxi_visitor_tc042(self):3482 driver=self.driver3483 print('TC_访客模式点击我的页面各个菜单,检查点:惊喜_惊喜页面的商品详细页面的访客模式检查----step1检查用户是否已经登录')3484 print('step2如果用户已经登录则退出原来账号;step3选择一款商品点击进入商品详细页面;step4从excel文件读取要检查的各个菜单名称,')3485 print('依次点击检查是否会跳转到用户登录界面')3486 now=time.strftime('%Y-%m-%d %H_%M_%S')3487 print('惊喜_惊喜页面的商品详细页面的访客模式检查----开始:'+now)3488 sleep(1)3489 driver.find_element_by_accessibility_id('返回').click()3490 sleep(1)3491 g=bp_is_loggedin(self)3492 sleep(2)3493 #惊喜3494 driver.find_element_by_accessibility_id('惊喜').click()3495 sleep(8)3496 for i in range(1):3497 driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':500,'toX':50,'toY':350,'duration':1.0})3498 sleep(2)3499 #driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':550,'toX':50,'toY':350,'duration':1.0})3500 sleep(2)3501 u=driver.find_elements_by_xpath('//XCUIElementTypeOther[@name="真皮iPhone手机壳 真皮iPhone手机壳 1"]')3502 if len(u) != 0:3503 print('需要兑换的商品存在,检查通过')3504 sleep(2)3505 driver.find_element_by_xpath('//XCUIElementTypeOther[@name="真皮iPhone手机壳 真皮iPhone手机壳 1"]').click()3506 sleep(8)3507 page=driver.page_source3508 sleep(2)3509 f=fun_getjingxiloginmenu(self)3510 sleep(2)3511 #check the menu by turn3512 for j in range(0,2):3513 driver.find_element_by_xpath(f[0][j]).click()3514 sleep(2)3515 print('检查的元素名称:'+f[1][j])3516 sleep(1)3517 bp_is_loginshow(self)3518 sleep(2)3519 driver.find_element_by_accessibility_id('all page back black icon').click()3520 sleep(2)3521 #机器人图标3522 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':32, 'y':632})3523 sleep(2)3524 bp_is_loginshow(self)3525 sleep(2)3526 driver.find_element_by_accessibility_id('all page back black icon').click()3527 sleep(2)3528 #购物车图标3529 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':76, 'y':632})3530 sleep(2)3531 bp_is_loginshow(self)3532 sleep(2)3533 driver.find_element_by_accessibility_id('all page back black icon').click()3534 sleep(2)3535 #driver.find_element_by_xpath('//XCUIElementTypeOther[@name="横幅"]/XCUIElementTypeOther[1]').click()3536 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':34, 'y':58})3537 sleep(2)3538 driver.find_element_by_accessibility_id('我的').click()3539 sleep(3)3540 bp_normalloginmp(self)3541 sleep(2)3542 else:3543 print('需要兑换的商品不存在/未找到,请重新挑选')3544 sleep(2)3545 now=time.strftime('%Y-%m-%d %H_%M_%S')3546 print('TC_惊喜_惊喜页面的商品详细页面的访客模式检查----结束:'+now)3547#************************************************************************************************************3548#TC Name:test_jingxi_cartcheck_tc0433549#Purpose:检查用户模式选择多款商品加入购物车后购物车图标角标的变化检查3550#OS:android3551#Device:iPhone73552#Pre-conditions:用户已正常登录app/未登录3553#Post-conditions:N/A3554#Modify History:created by Sam [2018/10/10]3555#************************************************************************************************************3556 def test_jingxi_cartcheck_tc043(self):3557 driver=self.driver3558 print('TC_用户模式进入惊喜页面,检查点:惊喜_选择多款商品加入购物车后购物车图标角标的变化----step1用户模式进入惊喜页面')3559 print('step2选择一款商品点击进入商品详细页面;step3点击加入购物车按钮检查购物车图标角标数字是否为1')3560 print('step4点击购物车图标进入购物车详细页面,检查左下角是否显示已选(1)')3561 print('step5选择第二款商品点击进入商品详细页面;step6点击加入购物车按钮检查购物车图标角标数字是否为2')3562 print('step7点击购物车图标进入购物车详细页面,检查左下角是否显示已选(2)')3563 now=time.strftime('%Y-%m-%d %H_%M_%S')3564 print('惊喜_选择多款商品加入购物车后购物车图标角标的变化检查----开始:'+now)3565 sleep(1)3566 driver.find_element_by_accessibility_id('返回').click()3567 sleep(1)3568 #惊喜3569 driver.find_element_by_accessibility_id('惊喜').click()3570 sleep(8)3571 for i in range(1):3572 driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':500,'toX':50,'toY':350,'duration':1.0})3573 sleep(2)3574 #driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':550,'toX':50,'toY':350,'duration':1.0})3575 sleep(2)3576 u1=driver.find_elements_by_xpath('//XCUIElementTypeOther[@name="真皮iPhone手机壳 真皮iPhone手机壳 1"]')3577 if len(u1) != 0:3578 print('需要兑换的商品1存在,检查通过')3579 sleep(2)3580 driver.find_element_by_xpath('//XCUIElementTypeOther[@name="真皮iPhone手机壳 真皮iPhone手机壳 1"]').click()3581 sleep(6)3582 #page=driver.page_source3583 #sleep(2)3584 add2b=driver.find_elements_by_accessibility_id('加入购物车')3585 sleep(2)3586 if len(add2b) != 0:3587 print('加入购物车按钮存在,检查通过')3588 sleep(2)3589 driver.find_element_by_accessibility_id('加入购物车').click()3590 sleep(3)3591 driver.find_element_by_accessibility_id('加入购物车').click()3592 sleep(3)3593 #购物车角标3594 ch1=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="1"]')3595 if len(ch1) != 0:3596 print('购物车图标角标数字为1检查成功')3597 sleep(2)3598 #点击购物车图标3599 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="1"]').click()3600 sleep(4)3601 ch1a=driver.find_elements_by_xpath('//XCUIElementTypeOther[contains(@name,"已选(1)")]')3602 if len(ch1a) != 0:3603 print('购物车详细页面左下角显示已选(1)检查通过')3604 sleep(1)3605 else:3606 print('购物车详细页面左下角显示已选(1)检查失败,请检查原因')3607 sleep(1)3608 now=time.strftime('%Y-%m-%d %H_%M_%S')3609 sf1a='../../test_report/ios/'+now+'_errorCartGift1a_R_tc043.png'3610 driver.get_screenshot_as_file(sf1a)3611 sleep(2)3612 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':37, 'y':42})3613 sleep(2)3614 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':34, 'y':58})3615 sleep(2)3616 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':34, 'y':58})3617 sleep(2)3618 u2=driver.find_elements_by_xpath('//XCUIElementTypeOther[@name="百利甜情人蛋糕 21 Cake · 百利甜情人蛋糕 5"]')3619 if len(u2) != 0:3620 print('需要兑换的商品2存在,检查通过')3621 sleep(2)3622 driver.find_element_by_xpath('//XCUIElementTypeOther[@name="百利甜情人蛋糕 21 Cake · 百利甜情人蛋糕 5"]').click()3623 sleep(8)3624 #page=driver.page_source3625 #sleep(2)3626 #add2b=driver.find_element_by_accessibility_id('加入购物车')3627 #sleep(2)3628 driver.find_element_by_accessibility_id('加入购物车').click()3629 sleep(3)3630 driver.find_element_by_accessibility_id('加入购物车').click()3631 sleep(5)3632 #购物车角标3633 ch1=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="2"]')3634 if len(ch1) != 0:3635 print('购物车图标角标数字为2检查成功')3636 sleep(2)3637 #点击购物车图标3638 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="2"]').click()3639 sleep(4)3640 ch2a=driver.find_elements_by_xpath('//XCUIElementTypeOther[contains(@name,"已选(2)")]')3641 if len(ch2a) != 0:3642 print('购物车详细页面左下角显示已选(2)检查通过')3643 sleep(1)3644 else:3645 print('购物车详细页面左下角显示已选(2)检查失败,请检查原因')3646 sleep(1)3647 now=time.strftime('%Y-%m-%d %H_%M_%S')3648 sf2a='../../test_report/ios/'+now+'_errorCartGift2a_R_stg_tc043.png'3649 driver.get_screenshot_as_file(sf2a)3650 sleep(2)3651 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':37, 'y':42})3652 sleep(2)3653 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':34, 'y':58})3654 sleep(2)3655 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':34, 'y':58})3656 sleep(2)3657 else:3658 print('购物车图标角标数字为2检查失败,请检查原因')3659 now=time.strftime('%Y-%m-%d %H_%M_%S')3660 sf2='../../test_report/ios/'+now+'_errorCartGift2_R_stg_tc043.png'3661 driver.get_screenshot_as_file(sf2)3662 sleep(2)3663 else:3664 print('需要兑换的商品2不存在/未找到,请重新挑选')3665 sleep(2)3666 else:3667 print('购物车图标角标数字为1检查失败,请检查原因')3668 sleep(1)3669 now=time.strftime('%Y-%m-%d %H_%M_%S')3670 sf1='../../test_report/ios/'+now+'_errorCartGift1_R_stg_tc043.png'3671 driver.get_screenshot_as_file(sf1)3672 sleep(2)3673 else:3674 print('加入购物车按钮不存在,请检查原因')3675 sleep(2)3676 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':34, 'y':58})3677 sleep(2)3678 else:3679 print('需要兑换的商品1不存在/未找到,请重新挑选')3680 sleep(2)3681 now=time.strftime('%Y-%m-%d %H_%M_%S')3682 print('TC_惊喜_选择多款商品加入购物车后购物车图标角标的变化检查----结束:'+now)3683#*******************************************************3684#TC Name:test_jingxi_clearcart_tc0443685#Purpose:检查用户模式惊喜选择多款商品加入购物车后清空购物车的功能检查3686#OS:android3687#Device:iPhone73688#Pre-conditions:用户已正常登录app/未登录3689#Post-conditions:N/A3690#Modify History:created by Sam [2018/10/10]3691#*******************************************************3692 def test_jingxi_clearcart_tc044(self):3693 driver=self.driver3694 print('TC_用户模式进入惊喜页面,检查点:惊喜_选择多款商品加入购物车后清空购物车的功能检查----step1用户模式进入惊喜页面')3695 print('step2选择一款商品点击进入商品详细页面点击加入购物车按钮')3696 print('step3选择第二款商品点击进入商品详细页面点击加入购物车按钮')3697 print('step4点击购物车图标进入购物车详细页面,点击编辑,点击全选,再点击删除所选,确定')3698 print('step5检查此时购物车是否没有任何商品')3699 now=time.strftime('%Y-%m-%d %H_%M_%S')3700 print('惊喜_选择多款商品加入购物车后清空购物车的功能检查----开始:'+now)3701 sleep(1)3702 driver.find_element_by_accessibility_id('返回').click()3703 sleep(1)3704 #惊喜3705 driver.find_element_by_accessibility_id('惊喜').click()3706 sleep(6)3707 for i in range(4):3708 driver.execute_script("mobile: scroll", {"direction": "down"})3709 sleep(1)3710 sleep(2)3711 u1=driver.find_elements_by_xpath('//XCUIElementTypeOther[@name="真皮iPhone手机壳 真皮iPhone手机壳 1"]')3712 if len(u1) != 0:3713 print('需要兑换的商品1存在,检查通过')3714 sleep(2)3715 driver.find_element_by_xpath('//XCUIElementTypeOther[@name="真皮iPhone手机壳 真皮iPhone手机壳 1"]').click()3716 sleep(6)3717 #page=driver.page_source3718 #sleep(2)3719 add2b=driver.find_elements_by_accessibility_id('加入购物车')3720 sleep(2)3721 if len(add2b) != 0:3722 print('加入购物车按钮存在,检查通过')3723 sleep(2)3724 driver.find_element_by_accessibility_id('加入购物车').click()3725 sleep(3)3726 driver.find_element_by_accessibility_id('加入购物车').click()3727 sleep(3)3728 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':34, 'y':58})3729 sleep(2)3730 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':34, 'y':58})3731 sleep(2)3732 u2=driver.find_elements_by_xpath('//XCUIElementTypeOther[@name="百利甜情人蛋糕 21 Cake · 百利甜情人蛋糕 5"]')3733 if len(u2) != 0:3734 print('需要兑换的商品2存在,检查通过')3735 sleep(2)3736 driver.find_element_by_xpath('//XCUIElementTypeOther[@name="百利甜情人蛋糕 21 Cake · 百利甜情人蛋糕 5"]').click()3737 sleep(6)3738 #page=driver.page_source3739 #sleep(2)3740 #add2b=driver.find_element_by_accessibility_id('加入购物车')3741 #sleep(2)3742 driver.find_element_by_accessibility_id('加入购物车').click()3743 sleep(3)3744 driver.find_element_by_accessibility_id('加入购物车').click()3745 sleep(3)3746 #点击购物车图标3747 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="2"]').click()3748 sleep(4)3749 ch2a=driver.find_elements_by_xpath('//XCUIElementTypeOther[@name="编辑"]')3750 if len(ch2a) != 0:3751 print('编辑按钮存在,检查通过')3752 sleep(2)3753 driver.find_elements_by_xpath('//XCUIElementTypeOther[@name="编辑"]')[4].click()3754 sleep(2)3755 #driver.find_element_by_xpath('//XCUIElementTypeOther[contains(@name,"全选")]').click()3756 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':28, 'y':630})3757 sleep(2)3758 #删除所选3759 driver.find_element_by_accessibility_id('删除所选').click()3760 sleep(1)3761 driver.find_element_by_accessibility_id('确定').click()3762 sleep(3)3763 chk0=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"去添加点什么吧")]')3764 sleep(2)3765 if len(chk0) != 0:3766 print('购物车已清空')3767 sleep(1)3768 else:3769 print('购物车未被清空,请检查原因')3770 sleep(1)3771 now=time.strftime('%Y-%m-%d %H_%M_%S')3772 sf3='../../test_report/ios/'+now+'_errorCartNoEdit_R_stg_tc044.png'3773 driver.get_screenshot_as_file(sf3)3774 sleep(2)3775 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':37, 'y':42})3776 sleep(2)3777 else:3778 print('编辑按钮不存在,检查失败,请检查原因')3779 sleep(1)3780 now=time.strftime('%Y-%m-%d %H_%M_%S')3781 sf2a='../../test_report/ios/'+now+'_errorCartNoEdit_R_stg_tc044.png'3782 driver.get_screenshot_as_file(sf2a)3783 sleep(2)3784 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':37, 'y':42})3785 sleep(2)3786 else:3787 print('需要兑换的商品2不存在/未找到,请重新挑选')3788 sleep(2)3789 else:3790 print('加入购物车按钮不存在,请检查原因')3791 sleep(2)3792 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':34, 'y':58})3793 sleep(2)3794 else:3795 print('需要兑换的商品1不存在/未找到,请重新挑选')3796 sleep(2)3797 now=time.strftime('%Y-%m-%d %H_%M_%S')3798 print('TC_惊喜_选择多款商品加入购物车后清空购物车的功能检查----结束:'+now)3799#*******************************************************3800#TC Name:test_wode_activityshow_tc0463801#Purpose:检查用户模式点击我的页面各个菜单的预期动作3802#OS:android3803#Device:iPhone73804#Pre-conditions:用户已正常登录app/未登录3805#Post-conditions:N/A3806#Modify History:created by Sam [2018/10/15]3807#*******************************************************3808 def test_wode_activityshow_tc046(self):3809 driver=self.driver3810 print('TC_用户模式点击我的我的活动菜单,检查点:我的_我的活动晒图功能检查----')3811 print('step1进入我的活动页面;step2检查是否有晒图按钮;step3检查晒图功能是否正常')3812 print('step4检查晒图的文字是否正确;step5检查晒图的9张图片数量是否正确')3813 now=time.strftime('%Y-%m-%d %H_%M_%S')3814 print('TC_我的_我的活动晒图功检查----开始:'+now)3815 sleep(2)3816 driver.find_element_by_accessibility_id('返回').click()3817 sleep(2)3818 #我的3819 driver.find_element_by_accessibility_id('我的').click()3820 sleep(4)3821 driver.find_element_by_accessibility_id('我的活动').click()3822 sleep(3)3823 u=driver.find_elements_by_accessibility_id('晒图')3824 if len(u) != 0:3825 print('晒图按钮存在,检查通过')3826 sleep(2)3827 driver.find_element_by_accessibility_id('晒图').click()3828 sleep(2)3829 #+3830 driver.execute_script("mobile: tap", {"touchCount":"1", "x":55, "y":264})3831 sleep(2)3832 #好3833 allow=driver.find_elements_by_accessibility_id('好')3834 if len(allow) != 0:3835 driver.find_element_by_accessibility_id('好').click()3836 sleep(2)3837 sleep(1)3838 try:3839 for i in range(9):3840 #driver.find_elements_by_xpath('//XCUIElementTypeButton[@name="compose guide check box defaul"]')[i].click()3841 driver.find_elements_by_ios_predicate('name=="compose guide check box defaul"')[i].click()3842 sleep(1)3843 sleep(1)3844 driver.find_element_by_accessibility_id('完成(9/9)').click()3845 sleep(2)3846 word=driver.find_element_by_xpath('//XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeScrollView/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTextView')3847 sleep(2)3848 word.click()3849 sleep(1)3850 now0=time.strftime('%Y-%m-%d %H_%M_%S')3851 word.send_keys('我用Python_晒图'+now0)3852 t0='我用Python_晒图_'+now03853 sleep(1)3854 driver.find_element_by_accessibility_id('发布').click()3855 sleep(9)3856 driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':550,'toX':50,'toY':50,'duration':1.0})3857 sleep(2)3858 #check numbers of pictures and published text here3859 title=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,t0)]')3860 sleep(2)3861 if len(title) != 0 :3862 print('晒图的文字检查通过')3863 sleep(1)3864 else:3865 print('晒图的文字检查失败,请检查原因')3866 sleep(1)3867 now=time.strftime('%Y-%m-%d %H_%M_%S')3868 sf1='../../test_report/ios/'+now+'_errorPublishText_R_tc046.png'3869 driver.get_screenshot_as_file(sf1)3870 sleep(2)3871 number=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="9"]')3872 if len(number) != 0:3873 print('晒图的上传9张图片检查通过')3874 sleep(1)3875 else:3876 print('晒图的上传9张图片检查失败,请检查原因')3877 sleep(1)3878 now=time.strftime('%Y-%m-%d %H_%M_%S')3879 sf2='../../test_report/ios/'+now+'_errorPublishPicture9_R_tc046.png'3880 driver.get_screenshot_as_file(sf2)3881 sleep(2)3882 driver.find_element_by_accessibility_id('all page back black icon').click()3883 sleep(2)3884 except Exception as e:3885 print('发生异常:'+str(e))3886 sleep(2)3887 pass3888 else:3889 print('晒图按钮不存在,请检查原因')3890 sleep(2)3891 driver.find_element_by_accessibility_id('all page back black icon').click()3892 sleep(2)3893 now=time.strftime('%Y-%m-%d %H_%M_%S')3894 print('TC_我的_我的活动晒图功检查----结束:'+now)3895#*******************************************************3896#TC Name:test_wode_es8ordershare_tc0473897#Purpose:检查我的ES8订单的分享功能3898#OS:iOS3899#Device:iPhone73900#Pre-conditions:用户已正常登录app3901#Post-conditions:N/A3902#Modify History:created by Sam [2018/10/25]3903#*******************************************************3904 def test_wode_es8ordershare_tc047(self):3905 driver=self.driver3906 print('TC_检查手机号码登录APP,检查点:我的_我的ES8订单的分享功能----step1进入我的页面')3907 print('step2进入我的es8订单点击进入订单详细页面;step3点右上角的分享按钮(先检查是否存在;step4检查分享微信好友功能是否正常')3908 print('step5检查分享朋友圈功能是否正常;step6检查分享新浪微博功能是否正常;step7检查分享NIO好友功能是否正常')3909 now=time.strftime('%Y-%m-%d %H_%M_%S')3910 print('TC_我的_我的ES8订单的分享功能----开始:'+now)3911 sleep(2)3912 driver.find_element_by_accessibility_id('返回').click()3913 sleep(2)3914 #我的3915 driver.find_element_by_accessibility_id('我的').click()3916 sleep(4)3917 driver.find_element_by_accessibility_id('我的车辆订单').click()3918 sleep(8)3919 car=driver.find_elements_by_accessibility_id('ES8基准版')3920 if len(car) != 0:3921 driver.find_element_by_accessibility_id('ES8基准版').click()3922 sleep(4)3923 #分享图标3924 share=driver.find_elements_by_accessibility_id('navigationbar btn share')3925 sleep(2)3926 if len(share) != 0:3927 print('分享按钮存在,检查通过')3928 sleep(3)3929 #share3930 driver.find_element_by_accessibility_id('navigationbar btn share').click()3931 sleep(2)3932 #微信好友3933 wh=driver.find_elements_by_accessibility_id('微信好友')3934 if len(wh) != 0:3935 print('分享到微信好友按钮存在,检查通过')3936 sleep(2)3937 driver.find_element_by_accessibility_id('微信好友').click()3938 sleep(6)3939 driver.find_element_by_accessibility_id('王小龙').click()3940 sleep(3)3941 words=driver.find_elements_by_xpath('//XCUIElementTypeWindow[4]/XCUIElementTypeImage[1]/XCUIElementTypeOther[5]/XCUIElementTypeTextView')3942 sleep(2)3943 if len(words) != 0:3944 words[0].click()3945 sleep(1)3946 now0=time.strftime('%Y-%m-%d %H_%M_%S')3947 words[0].send_keys('人生苦短我的ES8订单微信好友:'+now0)3948 sleep(1)3949 #发送3950 driver.find_element_by_accessibility_id('发送').click()3951 sleep(2)3952 driver.find_element_by_accessibility_id('返回蔚来').click()3953 sleep(1)3954 #检查toast3955 save1=driver.find_elements_by_accessibility_id('分享成功')3956 if len(save1) != 0:3957 print('分享微信好友成功')3958 sleep(1)3959 else:3960 print('分享微信好友失败,请检查原因')3961 sleep(1)3962 now=time.strftime('%Y-%m-%d %H_%M_%S')3963 sf1='../../test_report/ios/'+now+'_errorGiftsharewechat_R_tc047.png'3964 driver.get_screenshot_as_file(sf1)3965 sleep(2)3966 else:3967 print('分享到微信好友按钮不存在,请检查原因')3968 sleep(2)3969 #share3970 driver.find_element_by_accessibility_id('navigationbar btn share').click()3971 sleep(2)3972 #微信朋友圈3973 pyq=driver.find_elements_by_accessibility_id('微信朋友圈')3974 if len(pyq) != 0:3975 print('分享到微信朋友圈按钮存在,检查通过')3976 sleep(1)3977 driver.find_element_by_accessibility_id('微信朋友圈').click()3978 sleep(8)3979 word2=driver.find_element_by_xpath('//XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeOther[1]/XCUIElementTypeTextView')3980 word2.click()3981 sleep(1)3982 now2=time.strftime('%Y-%m-%d %H_%M_%S')3983 word2.send_keys('人生苦短我的ES8订单微信朋友圈:'+now2)3984 sleep(1)3985 driver.find_element_by_accessibility_id('表情').click()3986 sleep(1)3987 driver.find_element_by_accessibility_id('完成').click()3988 sleep(2)3989 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="公开"]').click()3990 sleep(1)3991 #私密, 仅自己可见3992 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="私密"]').click()3993 sleep(1)3994 driver.find_element_by_accessibility_id('完成').click()3995 sleep(2)3996 #发表3997 driver.find_element_by_accessibility_id('发表').click()3998 sleep(1)3999 #检查toast4000 save2=driver.find_elements_by_accessibility_id('分享成功')4001 if len(save2) != 0:4002 print('分享微信朋友圈成功')4003 sleep(1)4004 else:4005 print('分享微信朋友圈失败,请检查原因')4006 sleep(1)4007 now=time.strftime('%Y-%m-%d %H_%M_%S')4008 sf2='../../test_report/ios/'+now+'_errorGiftsharewechatpyq_R_tc047.png'4009 driver.get_screenshot_as_file(sf2)4010 sleep(1)4011 else:4012 print('分享到微信朋友圈按钮不存在,请检查原因')4013 sleep(2)4014 """4015 #share4016 driver.find_element_by_accessibility_id('navigationbar btn share').click()4017 sleep(2)4018 #微博no such menu now4019 wb=driver.find_elements_by_accessibility_id('微博')4020 if len(wb) != 0:4021 print('分享到微博按钮存在,检查通过')4022 sleep(2)4023 driver.find_element_by_accessibility_id('微博').click()4024 sleep(8)4025 driver.find_element_by_accessibility_id('发送到分组').click()4026 sleep(2)4027 #仅自己可见4028 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="仅自己可见"]').click()4029 sleep(2)4030 #发送4031 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="转发到微博"]').click()4032 sleep(1)4033 #检查toast4034 save3=driver.find_elements_by_accessibility_id('分享成功')4035 if len(save3) != 0:4036 print('分享微博成功')4037 sleep(1)4038 else:4039 print('分享微博失败,请检查原因')4040 sleep(1)4041 now=time.strftime('%Y-%m-%d %H_%M_%S')4042 sf3='../../test_report/ios/'+now+'_errorGiftsharewebo_R_tc047.png'4043 driver.get_screenshot_as_file(sf3)4044 sleep(1)4045 else:4046 print('分享到新浪微博按钮不存在,请检查原因')4047 sleep(2)4048 """4049 #share4050 driver.find_element_by_accessibility_id('navigationbar btn share').click()4051 sleep(2)4052 #NIO好友4053 mf=driver.find_elements_by_xpath('//XCUIElementTypeStaticText[@name="NIO好友"]')4054 if len(mf) != 0:4055 print('分享到NIO好友按钮存在,检查通过')4056 sleep(2)4057 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="NIO好友"]').click()4058 sleep(2)4059 driver.find_element_by_accessibility_id('朋友').click()4060 sleep(1)4061 driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"Sam8")]')[0].click()4062 sleep(1)4063 #检查toast4064 save4=driver.find_elements_by_accessibility_id('分享成功')4065 if len(save4) != 0:4066 print('分享NIO好友成功')4067 sleep(1)4068 else:4069 print('分享NIO好友失败,请检查原因')4070 sleep(1)4071 now=time.strftime('%Y-%m-%d %H_%M_%S')4072 sf4='../../test_report/ios/'+now+'_errorGiftsharemyfriend_R_tc047.png'4073 driver.get_screenshot_as_file(sf4)4074 sleep(1)4075 else:4076 print('分享到NIO好友按钮不存在,请检查原因')4077 sleep(2)4078 else:4079 print('分享按钮不存在/未找到,请检查原因')4080 sleep(2)4081 #driver.execute_script('mobile: tap', {'touchCount':'1', 'x':24, 'y':58})4082 driver.find_element_by_accessibility_id('navigationbar btn back black1').click() 4083 sleep(2)4084 else:4085 print('暂无订单,无法执行该脚本')4086 sleep(2)4087 driver.find_element_by_accessibility_id('navigationbar btn back black1').click() 4088 sleep(2)4089 now=time.strftime('%Y-%m-%d %H_%M_%S')4090 print('TC_我的_我的ES8订单的分享功能----结束:'+now)4091#*******************************************************4092#TC Name:test_wode_joinnio_tc0484093#Purpose:检查我的页面加入蔚来功能4094#OS:iOS4095#Device:iPhone74096#Pre-conditions:用户已正常登录app4097#Post-conditions:N/A4098#Modify History:created by Sam [2018/10/25]4099#*******************************************************4100 def test_wode_joinnio_tc048(self):4101 driver=self.driver4102 print('TC_检查手机号码登录APP,检查点:我的_我的_加入蔚来----step1进入我的页面')4103 print('step2进入加入蔚来页面;step3点击蔚来总部;step4点击软件开发')4104 now=time.strftime('%Y-%m-%d %H_%M_%S')4105 print('TC_我的_加入蔚来----开始:'+now)4106 sleep(2)4107 driver.find_element_by_accessibility_id('返回').click()4108 sleep(2)4109 #我的4110 driver.find_element_by_accessibility_id('我的').click()4111 sleep(3)4112 driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':500,'toX':50,'toY':200,'duration':1.0})4113 sleep(2)4114 driver.find_element_by_accessibility_id('加入蔚来').click()4115 sleep(6)4116 page=driver.page_source4117 sleep(2)4118 #蔚来总部4119 driver.execute_script("mobile: tap", {"touchCount":"1", "x":388, "y":249})4120 ###driver.find_element_by_xpath('//XCUIElementTypeOther[@name="NIO"]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther/XCUIElementTypeOther[1]').click()4121 sleep(5)4122 #软件开发4123 driver.execute_script("mobile: tap", {"touchCount":"1", "x":388, "y":347})4124 ###driver.find_element_by_xpath('//XCUIElementTypeOther[@name="NIO"]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[1]/XCUIElementTypeOther/XCUIElementTypeOther[3]').click()4125 sleep(4)4126 #允许4127 allow=driver.find_elements_by_accessibility_id('允许')4128 if len(allow) != 0:4129 driver.find_element_by_accessibility_id('允许').click()4130 sleep(2)4131 #好4132 allow2=driver.find_elements_by_accessibility_id('好')4133 if len(allow2) != 0:4134 driver.find_element_by_accessibility_id('好').click()4135 sleep(2) 4136 now=time.strftime('%Y-%m-%d %H_%M_%S')4137 sf1='../../test_report/ios/'+now+'_devJobs_R_tc048.png'4138 driver.get_screenshot_as_file(sf1)4139 sleep(3)4140 driver.find_element_by_accessibility_id('返回').click()4141 sleep(2)4142 driver.find_element_by_accessibility_id('返回“蔚来Test”').click()4143 sleep(2)4144 now=time.strftime('%Y-%m-%d %H_%M_%S')4145 print('TC_我的_加入蔚来----结束:'+now)4146#*******************************************************4147#TC Name:test_aiche_cityplan_tc0494148#Purpose:检查爱车页面里查询上海市城市服务规划4149#OS:iOS4150#Device:iPhone74151#Pre-conditions:用户已正常登录app4152#Post-conditions:N/A4153#Modify History:created by Sam [2018/10/25]4154#*******************************************************4155 def test_aiche_cityplan_tc049(self):4156 driver=self.driver4157 print('TC_检查手机号码登录APP,检查点:爱车_查询上海市城市服务规划----step1进入爱车页面')4158 print('step2点击城市服务查询页面;step3选择山西省->太原市;step4检查太原市城市服务规划是否显示正常')4159 now=time.strftime('%Y-%m-%d %H_%M_%S')4160 print('TC_爱车_查询太原市城市服务规划----开始:'+now)4161 sleep(1)4162 driver.find_element_by_accessibility_id('返回').click()4163 sleep(1)4164 #爱车4165 driver.find_element_by_accessibility_id('爱车').click()4166 sleep(4)4167 #driver.execute_script("mobile: tap", {"touchCount":"1", "x":188, "y":613})4168 #sleep(2)4169 for i in range(5):4170 driver.execute_script("mobile: scroll", {"direction": "down"})4171 sleep(1)4172 sleep(2)4173 city=driver.find_elements_by_accessibility_id('城市服务查询')4174 if len(city) != 0:4175 print('城市服务查询按钮找到')4176 sleep(2)4177 driver.find_element_by_accessibility_id('城市服务查询').click()4178 sleep(4)4179 driver.find_element_by_accessibility_id('上海市').click()4180 sleep(2)4181 driver.find_element_by_accessibility_id('山西省').click()4182 sleep(2)4183 driver.find_element_by_accessibility_id('太原市').click()4184 sleep(4)4185 #代客上牌4186 ch1=driver.find_elements_by_accessibility_id('NIO城市服务规划')4187 ch2=driver.find_elements_by_accessibility_id('太原市')4188 ch3=driver.find_elements_by_accessibility_id('代客上牌')4189 if len(ch1) != 0 and len(ch2) != 0 and len(ch3) != 0:4190 print('太原市城市服务规划显示正常')4191 sleep(1)4192 else:4193 print('太原市城市服务规划显示不正常,请检查原因')4194 sleep(1)4195 now=time.strftime('%Y-%m-%d %H_%M_%S')4196 sf1='../../test_report/ios/'+now+'_errSHcityplan_R_tc049.png'4197 driver.get_screenshot_as_file(sf1)4198 sleep(2)4199 driver.find_element_by_accessibility_id('nav back btn').click()4200 sleep(2)4201 else:4202 print('城市服务查询按钮未找到/不存在,请检查原因')4203 sleep(2)4204 now=time.strftime('%Y-%m-%d %H_%M_%S')4205 print('TC_爱车_查询太原市城市服务规划----结束:'+now)4206#*******************************************************4207#TC Name:test_aiche_rechargemap_tc0504208#Purpose:检查爱车页面里查询充电地图及查看充电桩信息4209#OS:iOS4210#Device:iPhone74211#Pre-conditions:用户已正常登录app4212#Post-conditions:N/A4213#Modify History:created by Sam [2018/10/25]4214#*******************************************************4215 def test_aiche_rechargemap_tc050(self):4216 driver=self.driver4217 print('TC_检查手机号码登录APP,检查点:爱车_充电地图及查看充电桩信息----step1进入爱车页面')4218 print('step2点击充电地图;step3点击一个充电桩;step4检查充电桩信息是否显示正常')4219 now=time.strftime('%Y-%m-%d %H_%M_%S')4220 print('TC_爱车_充电地图及查看充电桩信息----开始:'+now)4221 sleep(1)4222 driver.find_element_by_accessibility_id('返回').click()4223 sleep(1)4224 #爱车4225 driver.find_element_by_accessibility_id('爱车').click()4226 sleep(4)4227 #driver.execute_script("mobile: tap", {"touchCount":"1", "x":188, "y":613})4228 #sleep(2)4229 for i in range(5):4230 driver.execute_script("mobile: scroll", {"direction": "down"})4231 sleep(1)4232 sleep(2)4233 cmap=driver.find_elements_by_accessibility_id('充电地图')4234 if len(cmap) != 0:4235 print('充电地图按钮找到')4236 sleep(2)4237 driver.find_element_by_accessibility_id('充电地图').click()4238 sleep(4)4239 page=driver.page_source4240 sleep(2)4241 #driver.find_element_by_id('cn.com.weilaihui3:id/charging_pile_drag_view').click()4242 driver.execute_script("mobile: tap", {"touchCount":"1", "x":268, "y":239})4243 sleep(4)4244 ch1=driver.find_elements_by_accessibility_id('上海曹安景林苑充电站')4245 if len(ch1) != 0:4246 print('充电桩信息显示正常')4247 sleep(1)4248 else:4249 print('充电桩信息显示不正常,请检查原因')4250 now=time.strftime('%Y-%m-%d %H_%M_%S')4251 sf1='../../test_report/ios/'+now+'_errPileStatus_R_tc050.png'4252 driver.get_screenshot_as_file(sf1)4253 sleep(2)4254 driver.find_element_by_accessibility_id('routPlanBack').click()4255 sleep(2)4256 else:4257 print('充电地图按钮未找到/不存在,请检查原因')4258 sleep(2)4259 now=time.strftime('%Y-%m-%d %H_%M_%S')4260 print('TC_爱车_充电地图及查看充电桩信息----结束:'+now)4261#*******************************************************4262#TC Name:test_aiche_milecalculator_tc0514263#Purpose:检查爱车页面里ES8里程计算器4264#OS:iOS4265#Device:iPhone74266#Pre-conditions:用户已正常登录app4267#Post-conditions:N/A4268#Modify History:created by Sam [2018/10/25]4269#*******************************************************4270 def test_aiche_milecalculator_tc051(self):4271 driver=self.driver4272 print('TC_检查手机号码登录APP,检查点:爱车_ES8里程计算器----step1进入爱车页面')4273 print('step2点击ES8里程计算器;step3改变行驶速度;step4改变车外温度;step5打开空调;step6改变轮毂尺寸检查里程计算是否正确')4274 now=time.strftime('%Y-%m-%d %H_%M_%S')4275 print('TC_爱车_ES8里程计算器----开始:'+now)4276 sleep(21)4277 driver.find_element_by_accessibility_id('返回').click()4278 sleep(1)4279 #爱车4280 driver.find_element_by_accessibility_id('爱车').click()4281 sleep(4)4282 #driver.execute_script("mobile: tap", {"touchCount":"1", "x":188, "y":613})4283 #sleep(2)4284 for i in range(5):4285 driver.execute_script("mobile: scroll", {"direction": "down"})4286 sleep(1)4287 sleep(2)4288 cmap=driver.find_elements_by_accessibility_id('ES8里程计算器')4289 if len(cmap) != 0:4290 print('ES8里程计算器按钮找到')4291 sleep(2)4292 driver.find_element_by_accessibility_id('ES8里程计算器').click()4293 sleep(4)4294 page=driver.page_source4295 sleep(2)4296 driver.execute_script('mobile: dragFromToForDuration',{'fromX':50,'fromY':530,'toX':50,'toY':503,'duration':1.0})4297 sleep(2)4298 #改变行驶速度4299 #>4300 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':324, 'y':373})4301 sleep(1)4302 res1=driver.find_elements_by_accessibility_id('393')4303 if len(res1) != 0:4304 print('改变行驶速度后里程计算正确')4305 sleep(1)4306 else:4307 print('改变行驶速度后里程计算不正确,请检查原因')4308 sleep(1)4309 now=time.strftime('%Y-%m-%d %H_%M_%S')4310 sf1='../../test_report/ios/'+now+'_errMileV_R_tc051.png'4311 driver.get_screenshot_as_file(sf1)4312 sleep(2)4313 #改变车外温度>4314 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':175, 'y':476})4315 sleep(1)4316 driver.execute_script('mobile: tap', {'touchCount':'1', 'x':175, 'y':476})4317 sleep(1)4318 res2=driver.find_elements_by_accessibility_id('387')4319 if len(res2) != 0:4320 print('改变车外温度后里程计算正确')4321 sleep(1)4322 else:4323 print('改变车外温度后里程计算不正确,请检查原因')4324 sleep(1)4325 now=time.strftime('%Y-%m-%d %H_%M_%S')4326 sf2='../../test_report/ios/'+now+'_errMileTemp_R_tc051.png'4327 driver.get_screenshot_as_file(sf2)4328 sleep(2)4329 #打开空调4330 driver.find_element_by_accessibility_id('OFF').click()4331 sleep(1)4332 res3=driver.find_elements_by_accessibility_id('309')4333 if len(res3) != 0:4334 print('打开空调后里程计算正确')4335 sleep(1)4336 else:4337 print('打开空调后里程计算不正确,请检查原因')4338 sleep(1)4339 now=time.strftime('%Y-%m-%d %H_%M_%S')4340 sf3='../../test_report/ios/'+now+'_errMileAir_R_tc051.png'4341 driver.get_screenshot_as_file(sf3)4342 sleep(2)4343 #改变轮毂尺寸4344 driver.find_element_by_accessibility_id('21英寸').click()4345 sleep(1)4346 res4=driver.find_elements_by_accessibility_id('301')4347 if len(res4) != 0:4348 print('改变轮毂尺寸后里程计算正确')4349 sleep(1)4350 else:4351 print('改变轮毂尺寸后里程计算不正确,请检查原因')4352 sleep(1)4353 now=time.strftime('%Y-%m-%d %H_%M_%S')4354 sf4='../../test_report/ios/'+now+'_errMileDem_R_tc051.png'4355 driver.get_screenshot_as_file(sf4)4356 sleep(2)4357 driver.find_element_by_accessibility_id('nav back btn').click()4358 sleep(2)4359 else:4360 print('ES8里程计算器按钮未找到/不存在,请检查原因')4361 sleep(2)4362 now=time.strftime('%Y-%m-%d %H_%M_%S')4363 print('TC_爱车_ES8里程计算器----结束:'+now)4364#*******************************************************4365#TC Name:test_aiche_es8content_tc0524366#Purpose:检查爱车页面ES8配置表浏览及分享功能4367#OS:iOS4368#Device:iPhone74369#Pre-conditions:用户已正常登录app4370#Post-conditions:N/A4371#Modify History:created by Sam [2018/10/25]4372#*******************************************************4373 def test_aiche_es8content_tc052(self):4374 driver=self.driver4375 print('TC_检查手机号码登录APP,检查点:爱车_ES8配置表浏览及分享功能----step1进入爱车页面')4376 print('step2进入ES8配置表;step3点右上角的分享按钮(先检查是否存在);step4检查分享微信好友功能是否正常')4377 print('step5检查分享微信朋友圈功能是否正常;step6检查分享微博好友功能是否正常;step7检查分享NIO好友功能是否正常')4378 now=time.strftime('%Y-%m-%d %H_%M_%S')4379 print('TC_爱车_ES8配置表浏览及分享功能----开始:'+now)4380 sleep(1)4381 driver.find_element_by_accessibility_id('返回').click()4382 sleep(1)4383 #爱车4384 driver.find_element_by_accessibility_id('爱车').click()4385 sleep(4)4386 #driver.execute_script("mobile: tap", {"touchCount":"1", "x":188, "y":613})4387 #sleep(2)4388 for i in range(5):4389 driver.execute_script("mobile: scroll", {"direction": "down"})4390 sleep(1)4391 sleep(2)4392 cmap=driver.find_elements_by_accessibility_id('ES8配置表')4393 if len(cmap) != 0:4394 print('ES8配置表按钮找到')4395 sleep(2)4396 #4397 driver.find_element_by_xpath('//XCUIElementTypeTable/XCUIElementTypeCell[8]/XCUIElementTypeButton[6]').click()4398 sleep(6)4399 page=driver.page_source4400 sleep(2)4401 #4402 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="个性化"]').click()4403 sleep(3)4404 driver.find_element_by_accessibility_id('选装包').click()4405 sleep(3)4406 driver.find_element_by_accessibility_id('附件').click()4407 sleep(3)4408 #分享图标4409 share=driver.find_elements_by_accessibility_id('nav share btn')4410 sleep(2)4411 if len(share) != 0:4412 print('分享按钮存在,检查通过')4413 sleep(3)4414 #share4415 driver.find_element_by_accessibility_id('nav share btn').click()4416 sleep(2)4417 #微信好友4418 wh=driver.find_elements_by_accessibility_id('微信好友')4419 if len(wh) != 0:4420 print('分享到微信好友按钮存在,检查通过')4421 sleep(2)4422 driver.find_element_by_accessibility_id('微信好友').click()4423 sleep(6)4424 driver.find_element_by_accessibility_id('王小龙').click()4425 sleep(3)4426 words=driver.find_elements_by_xpath('//XCUIElementTypeWindow[4]/XCUIElementTypeImage[1]/XCUIElementTypeOther[5]/XCUIElementTypeTextView')4427 sleep(2)4428 if len(words) != 0:4429 words[0].click()4430 sleep(1)4431 now0=time.strftime('%Y-%m-%d %H_%M_%S')4432 words[0].send_keys('人生苦短我的ES8订单微信好友:'+now0)4433 sleep(1)4434 #发送4435 driver.find_element_by_accessibility_id('发送').click()4436 sleep(2)4437 driver.find_element_by_accessibility_id('返回蔚来').click()4438 sleep(1)4439 #检查toast4440 save1=driver.find_elements_by_accessibility_id('分享成功')4441 if len(save1) != 0:4442 print('分享微信好友成功')4443 sleep(1)4444 else:4445 print('分享微信好友失败,请检查原因')4446 sleep(1)4447 now=time.strftime('%Y-%m-%d %H_%M_%S')4448 sf1='../../test_report/ios/'+now+'_errorGiftsharewechat_R_tc052.png'4449 driver.get_screenshot_as_file(sf1)4450 sleep(2)4451 else:4452 print('分享到微信好友按钮不存在,请检查原因')4453 sleep(2)4454 driver.find_element_by_accessibility_id('letter btn close').click()4455 sleep(2)4456 #share4457 driver.find_element_by_accessibility_id('nav share btn').click()4458 sleep(2)4459 #微信朋友圈4460 pyq=driver.find_elements_by_accessibility_id('微信朋友圈')4461 if len(pyq) != 0:4462 print('分享到微信朋友圈按钮存在,检查通过')4463 sleep(1)4464 driver.find_element_by_accessibility_id('微信朋友圈').click()4465 sleep(8)4466 word2=driver.find_element_by_xpath('//XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeOther[1]/XCUIElementTypeTextView')4467 word2.click()4468 sleep(1)4469 now2=time.strftime('%Y-%m-%d %H_%M_%S')4470 word2.send_keys('人生苦短我的ES8订单微信朋友圈:'+now2)4471 sleep(1)4472 driver.find_element_by_accessibility_id('表情').click()4473 sleep(1)4474 driver.find_element_by_accessibility_id('完成').click()4475 sleep(2)4476 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="公开"]').click()4477 sleep(1)4478 #私密, 仅自己可见4479 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="私密"]').click()4480 sleep(1)4481 driver.find_element_by_accessibility_id('完成').click()4482 sleep(2)4483 #发表4484 driver.find_element_by_accessibility_id('发表').click()4485 sleep(1)4486 #检查toast4487 save2=driver.find_elements_by_accessibility_id('分享成功')4488 if len(save2) != 0:4489 print('分享微信朋友圈成功')4490 sleep(1)4491 else:4492 print('分享微信朋友圈失败,请检查原因')4493 sleep(1)4494 now=time.strftime('%Y-%m-%d %H_%M_%S')4495 sf2='../../test_report/ios/'+now+'_errorGiftsharewechatpyq_R_tc052.png'4496 driver.get_screenshot_as_file(sf2)4497 sleep(1)4498 else:4499 print('分享到微信朋友圈按钮不存在,请检查原因')4500 sleep(2)4501 driver.find_element_by_accessibility_id('letter btn close').click()4502 sleep(2)4503 #share4504 driver.find_element_by_accessibility_id('nav share btn').click()4505 sleep(2)4506 #微博4507 wb=driver.find_elements_by_accessibility_id('微博')4508 if len(wb) != 0:4509 print('分享到微博按钮存在,检查通过')4510 sleep(2)4511 driver.find_element_by_accessibility_id('微博').click()4512 sleep(8)4513 driver.find_element_by_accessibility_id('发送到分组').click()4514 sleep(2)4515 #仅自己可见4516 driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="仅自己可见"]').click()4517 sleep(2)4518 #发送4519 driver.find_element_by_xpath('//XCUIElementTypeButton[@name="转发到微博"]').click()4520 sleep(1)4521 #检查toast4522 save3=driver.find_elements_by_accessibility_id('分享成功')4523 if len(save3) != 0:4524 print('分享微博成功')4525 sleep(1)4526 else:4527 print('分享微博失败,请检查原因')4528 sleep(1)4529 now=time.strftime('%Y-%m-%d %H_%M_%S')4530 sf3='../../test_report/ios/'+now+'_errorGiftsharewebo_R_tc052.png'4531 driver.get_screenshot_as_file(sf3)4532 sleep(1)4533 else:4534 print('分享到微博按钮不存在,请检查原因')4535 sleep(2)4536 driver.find_element_by_accessibility_id('letter btn close').click()4537 sleep(2)4538 #share4539 driver.find_element_by_accessibility_id('nav share btn').click()4540 sleep(2)4541 #NIO好友4542 mf=driver.find_elements_by_accessibility_id('NIO好友')4543 if len(mf) != 0:4544 print('分享到NIO好友按钮存在,检查通过')4545 sleep(1)4546 driver.find_element_by_accessibility_id('NIO好友').click()4547 sleep(2)4548 driver.find_element_by_accessibility_id('朋友').click()4549 sleep(2)4550 driver.find_elements_by_xpath('//XCUIElementTypeStaticText[contains(@name,"Sam8")]')[0].click()4551 sleep(1)4552 #检查toast4553 save4=driver.find_elements_by_accessibility_id('分享成功')4554 if len(save4) != 0:4555 print('分享NIO好友成功')4556 sleep(1)4557 else:4558 print('分享NIO好友失败,请检查原因')4559 sleep(1)4560 now=time.strftime('%Y-%m-%d %H_%M_%S')4561 sf4='../../test_report/ios/'+now+'_errorGiftsharemyfriend_R_tc052.png'4562 driver.get_screenshot_as_file(sf4)4563 sleep(1)4564 else:4565 print('分享到NIO好友按钮不存在,请检查原因')4566 sleep(2)4567 driver.find_element_by_accessibility_id('letter btn close').click()4568 sleep(2)4569 else:4570 print('分享按钮不存在/未找到,请检查原因')4571 sleep(2)4572 driver.find_element_by_accessibility_id('nav back btn').click() 4573 sleep(2)4574 now=time.strftime('%Y-%m-%d %H_%M_%S')4575 print('TC_爱车_ES8配置表浏览及分享功能----结束:'+now)4576 ...

Full Screen

Full Screen

AppPageElement_iOS.py

Source:AppPageElement_iOS.py Github

copy

Full Screen

1# coding=utf-82import sys3if sys.version_info[:1] > (2,): # python34 xrange = range5class MainPageWidgetIos(object):6 # 账户设置页7 def account_setting_page(self):8 d = {}9 # 标题10 d["title"] = ["//XCUIElementTypeTable/XCUIElementTypeImage", "xpath", u"账户设置页"]11 # 帮助与设置12 d["help_setting"] = [u"帮助与设置", "accessibility_id", u"帮助与设置"]13 # 用户名14 d["username"] = ["//XCUIElementTypeTable/XCUIElementTypeStaticText", "xpath", u"用户名"]15 return d16 # 帮助与设置17 def help_setting_page(self):18 d = {}19 # 标题20 d["title"] = [u"帮助与设置", "accessibility_id", u"帮助与设置"]21 # 帮助与设置22 d["return"] = ["//XCUIElementTypeOther[2]//XCUIElementTypeButton", "xpath", u"返回"]23 # 登出24 d["logout"] = [u"退出登录", "accessibility_id", u"退出登录"]25 return d26 # 登录页面27 def login_page(self):28 d = {}29 # 标题30 d["title"] = ["image_login", "accessibility_id", u"登录页面"]31 # 用户名32 d["username"] = ["//XCUIElementTypeOther[3]//XCUIElementTypeTextField", "xpath", u"用户名输入框"]33 # 密码34 d["password"] = ["//XCUIElementTypeOther[3]//XCUIElementTypeOther[2]/XCUIElementTypeSecureTextField",35 "xpath", u"密码输入框"]36 # 显示/关闭密码37 d["check_box"] = ["//XCUIElementTypeOther[3]//XCUIElementTypeButton", "xpath", u"显示/关闭密码"]38 # 登录39 d["login_button"] = ["//XCUIElementTypeOther[3]//XCUIElementTypeScrollView/"40 "XCUIElementTypeOther/XCUIElementTypeButton", "xpath", u"登录按钮"]41 return d42 # APP主页面43 def app_home_page(self):44 d = {}45 # 标题46 d["title"] = [u"微联", "accessibility_id", u"App主页面"]47 # +号48 d["add_device"] = ["newAdd", "accessibility_id", u"+号"]49 # 账户管理50 d["account_setting"] = ["newMenu", "accessibility_id", u"账户管理"]51 # 没有设备/未登录52 d["no_device"] = [u"认识微联", "accessibility_id", u"没有设备/未登录"]53 # 设备54 device = {}55 for i in xrange(5):56 device[57 i] = "//XCUIElementTypeOther[2]//XCUIElementTypeCell[%s]/XCUIElementTypeStaticText" % (i + 1)58 d["device"] = [device, "xpath", u"待控设备"]59 # 有设备60 d["has_device"] = ["//XCUIElementTypeTable/XCUIElementTypeCell/XCUIElementTypeButton", "xpath", u"有设备"]61 return d62 # 添加设备页面63 def add_device_method_page(self):64 d = {}65 # 标题66 d["title"] = [u"添加设备", "accessibility_id", u"添加设备页面"]67 # 通过设备品类添加68 d["variety"] = ["//XCUIElementTypeOther[2]//XCUIElementTypeButton[4]", "xpath", u"通过设备品类添加"]69 # 添加历史70 d["history"] = ["//XCUIElementTypeOther[2]//XCUIElementTypeButton[2]", "xpath", u"添加历史"]71 return d72 # 添加设备品类页面73 def add_device_list_page(self):74 d = {}75 # 标题76 d["title"] = [u"设备品类", "accessibility_id", u"添加设备品类页面"]77 # 插座列表选项78 d["option"] = [u"插座", "accessibility_id", u"插座列表选项"]79 return d80 # 进入设备添加历史页面81 # driver.find_elements_by_xpath("//android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.TextView[@text='2']")82 def add_history_list_page(self):83 d = {}84 # 标题85 d["title"] = [u"已添加设备", "accessibility_id", u"进入设备添加历史页面"]86 # 公牛Wi-Fi智能转换器2代电量计量版87 d["y201J"] = [u"公牛WiFi智能电量统计版转换器2代", "accessibility_id", u"公牛Wi-Fi智能转换器2代电量计量版"]88 # 公牛Wi-Fi智能转换器2代89 d["y2011"] = [u"公牛Wi-Fi智能插座2代", "accessibility_id", u"公牛Wi-Fi智能插座2代"]90 # 公牛Wi-Fi智能插座2代加强版91 d["y2011dl"] = [u"公牛Wi-Fi智能插座2代加强版", "accessibility_id", u"公牛Wi-Fi智能插座2代加强版"]92 return d93 # 进入插座列表页面94 def add_outlet_list_page(self):95 d = {}96 # 标题97 d["title"] = [u"插座", "accessibility_id", u"插座列表页面"]98 # 公牛Wi-Fi智能插座2代99 d["y2011"] = [u"公牛Wi-Fi智能插座2代", "accessibility_id", u"公牛Wi-Fi智能插座2代"]100 # 公牛Wi-Fi智能转换器2代电量计量版101 d["y201J"] = [u"公牛WiFi智能电量统计版转换器2代", "accessibility_id", u"公牛WiFi智能电量统计版转换器2代"]102 # 公牛Wi-Fi智能插座2代加强版103 d["y2011dl"] = [u"公牛Wi-Fi智能插座2代加强版", "accessibility_id", u"公牛Wi-Fi智能插座2代加强版"]104 return d105 # 搜索设备页106 def add_specification_page(self):107 d = {}108 # 标题109 d["title"] = [u"添加公牛WiFi智能电量统计版转换器2代", "accessibility_id", u"搜索设备页"]110 # 下一步111 d["next"] = [u"下一步", "accessibility_id", u"下一步"]112 return d113 # 进入输入密码页面114 def input_wifi_password_page(self):115 d = {}116 # 标题117 d["title"] = [u"添加公牛WiFi智能电量统计版转换器2代", "accessibility_id", u"搜索设备页"]118 # 确认wifi密码按钮119 d["confirm"] = [u"没有该元素", "accessibility_id", u"确认wifi密码按钮"]120 # wifi密码输入框121 d["password"] = [u"没有该元素", "accessibility_id", u"wifi密码输入框"]122 # 密码显示关闭123 d["check_box"] = [u"没有该元素", "accessibility_id", u"wifi密码输入框"]124 # 下一步125 d["next"] = [u"下一步", "accessibility_id", u"下一步"]126 return d127 # 搜索设备等待页面128 def search_device_loading_page(self):129 d = {}130 # 标题131 d["title"] = [u"添加中", "accessibility_id", u"搜索设备等待页面"]132 return d133 # 搜索到设备134 def search_device_success_page(self):135 # 搜索到设备MAC136 d = {}137 # 标题138 d["title"] = [u"添加公牛WiFi智能电量统计版转换器2代", "accessibility_id", u"有设备出现"]139 # 设备路径140 d["device_box"] = [u"没有该元素", "accessibility_id", u"设备等待添加"]141 # 使用142 d["confirm"] = [u"完成", "accessibility_id", u"使用"]143 return d144 # 搜索设备超时145 def search_device_fail_page(self):146 d = {}147 # 标题148 d["title"] = [u"重试", "accessibility_id", u"搜索设备超时"]149 return d150 # 设备控制页面151 def control_device_page(self):152 d = {}153 # 标题154 d["title"] = ["setting", "accessibility_id", u"设备控制页面"]155 # 设备信息进入按钮156 d["device_info"] = ["setting", "accessibility_id", u"设备信息进入按钮"]157 # 设备离线标志158 d["offline"] = [u"设备不在线", "accessibility_id", u"设备离线标志"]159 # 电源开关160 d["power_button"] = ["//XCUIElementTypeOther[2]//XCUIElementTypeButton", "xpath", u"电源开关"]161 # 电源状态162 d["power_state"] = ["//XCUIElementTypeWebView/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[2]"163 "/XCUIElementTypeStaticText", "xpath", u"电源状态"]164 # 功率165 d["power"] = ["//XCUIElementTypeWebView//XCUIElementTypeOther/XCUIElementTypeOther[2]/"166 "XCUIElementTypeStaticText", "xpath", u"功率"]167 # 电源开启168 d["power_on"] = [u"设备已开启", "accessibility_id", u"电源开启"]169 # 电源关闭170 d["power_off"] = [u"设备已关闭", "accessibility_id", u"电源关闭"]171 # 设备记忆模式172 d["memory_mode"] = [u"记忆模式", "accessibility_id", u"设备记忆模式"]173 # 设备安全模式174 d["safe_mode"] = [u"安全模式", "accessibility_id", u"设备安全模式"]175 # 模式定时176 d["mode_timer"] = ["//XCUIElementTypeWebView/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[3]",177 "xpath", u"模式定时"]178 # 普通定时179 d["normal_timer"] = ["//XCUIElementTypeWebView//XCUIElementTypeOther[5]//XCUIElementTypeOther[2]", "xpath",180 u"普通定时"]181 # 指示灯182 d["led"] = ["//XCUIElementTypeWebView//XCUIElementTypeOther[10]/XCUIElementTypeButton", "xpath", u"指示灯"]183 # 用电量184 d["elec"] = [u"用电量", "accessibility_id", u"用电量"]185 # 电价设置186 d["set_elec"] = [u"电价设置", "accessibility_id", u"电价设置"]187 # 电费188 d["elec_bill"] = [u"电费", "accessibility_id", u"电费"]189 # 返回190 d["to_return"] = ["clos_bar", "accessibility_id", u"返回"]191 return d192 # 设备信息页面193 def device_info_page(self):194 d = {}195 # 标题196 d["title"] = [u"设置", "accessibility_id", u"设备信息页面"]197 # 删除设备按钮198 d["unbind"] = [u"删除设备", "accessibility_id", u"删除设备按钮"]199 # 编辑设备备注200 d["nickname"] = ["//XCUIElementTypeOther[2]//XCUIElementTypeTable/XCUIElementTypeButton", "xpath", u"编辑设备备注"]201 # 返回按钮202 d["to_return"] = ["gray back", "accessibility_id", u"返回"]203 return d204 # 修改设备备注页面205 def change_nickname_page(self):206 d = {}207 # 标题208 d["title"] = [u"修改名称", "accessibility_id", u"修改设备备注页面"]209 # 保存210 d["saved"] = [u"保存", "accessibility_id", u"保存"]211 # 备注输入框212 d["nickname"] = ["//XCUIElementTypeTextField", "accessibility_id", u"备注输入框"]213 # 返回按钮214 d["to_return"] = ["gray back", "accessibility_id", u"返回"]215 return d216 # 模式定时页面217 def mode_timer_page(self):218 d = {}219 # 标题220 d["title"] = [u"自定义模式", "accessibility_id", u"模式定时页面"]221 # 热水器模式222 d["water_mode"] = ["//XCUIElementTypeWebView//XCUIElementTypeOther[4]", "xpath", u"热水器模式"]223 # 热水器模式开关224 d["water_button"] = ["//XCUIElementTypeWebView/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/"225 "XCUIElementTypeOther", "xpath", u"热水器模式开关"]226 # 鱼缸模式227 d["fish_mode"] = ["//XCUIElementTypeWebView//XCUIElementTypeOther[8]", "xpath", u"鱼缸模式"]228 # 鱼缸模式开关229 d["fish_button"] = ["//XCUIElementTypeWebView//XCUIElementTypeOther[5]/XCUIElementTypeOther", "xpath",230 u"鱼缸模式开关"]231 # 充电保护模式232 d["piocc_mode"] = ["//XCUIElementTypeWebView//XCUIElementTypeOther[12]", "xpath", u"充电保护模式"]233 # 充电保护模式开关234 d["piocc_button"] = ["//XCUIElementTypeWebView//XCUIElementTypeOther[9]/XCUIElementTypeOther", "xpath",235 u"充电保护模式开关"]236 # 返回按钮237 d["to_return"] = ["gray_back", "accessibility_id", u"返回"]238 return d239 # 热水器模式定时页面240 def water_mode_timer_page(self):241 d = {}242 # 标题243 d["title"] = [u"热水器模式", "accessibility_id", u"热水器模式定时页面"]244 # 开启时间245 d["start_time"] = [u"插座开启时间", "accessibility_id", u"插座开启时间控件"]246 # 开启时间247 d["start_time_text"] = ["//XCUIElementTypeWebView//XCUIElementTypeTextField", "xpath", u"插座开启时间"]248 # 关闭时间249 d["end_time"] = [u"插座关闭时间", "accessibility_id", u"插座关闭时间控件"]250 # 关闭时间251 d["end_time_text"] = ["//XCUIElementTypeWebView//XCUIElementTypeTextField[2]", "xpath", u"插座关闭时间"]252 # 时间滚轮,时253 d["roll_h"] = [u"//XCUIElementTypeOther[@name='时']", "xpath", u"时间滚轮,时", {"px": [0.51, 0.5]}]254 # 时间滚轮,分255 d["roll_m"] = [u"//XCUIElementTypeOther[@name='分']", "xpath", u"时间滚轮,分", {"px": [0.51, 0.5]}]256 # 重复257 d["repeat"] = ["//XCUIElementTypeWebView//XCUIElementTypeOther[3]", "xpath", u"重复"]258 # 模式名称259 d["mode_name"] = ["//XCUIElementTypeWebView//XCUIElementTypeOther[4]", "xpath", u"模式名称"]260 # 执行结果261 d["result"] = ["//XCUIElementTypeWebView//XCUIElementTypeOther[5]", "xpath", u"执行结果"]262 # 取消263 d["to_return"] = [u"取消", "accessibility_id", u"取消"]264 # 启动265 d["launch"] = [u"启动", "accessibility_id", u"启动"]266 return d267 # 鱼缸模式定时页面268 def fish_mode_timer_page(self):269 d = {}270 # 标题271 d["title"] = [u"鱼缸模式", "accessibility_id", u"鱼缸模式定时页面"]272 # 开启时间273 d["start_time"] = [u"插座开启时长", "accessibility_id", u"插座开启时间控件"]274 # 开启时间275 d["start_time_text"] = ["//XCUIElementTypeWebView//XCUIElementTypeTextField", "xpath", u"插座开启时间"]276 # 关闭时间277 d["end_time"] = [u"插座关闭时长", "accessibility_id", u"插座关闭时间控件"]278 # 关闭时间279 d["end_time_text"] = ["//XCUIElementTypeWebView//XCUIElementTypeTextField[2]", "xpath", u"插座关闭时间"]280 # 时间滚轮,小时281 d["roll_h"] = [u"//XCUIElementTypeOther[@name='小时']", "xpath", u"时间滚轮,小时", {"px": [0.51, 0.5]}]282 # 时间滚轮,分钟283 d["roll_m"] = [u"//XCUIElementTypeOther[@name='分钟']", "xpath", u"时间滚轮,分钟", {"px": [0.51, 0.5]}]284 # 重复285 d["repeat"] = ["//XCUIElementTypeWebView//XCUIElementTypeOther[3]", "xpath", u"重复"]286 # 模式名称287 d["mode_name"] = ["//XCUIElementTypeWebView//XCUIElementTypeOther[4]", "xpath", u"模式名称"]288 # 取消289 d["to_return"] = [u"取消", "accessibility_id", u"取消"]290 # 启动291 d["launch"] = [u"启动", "accessibility_id", u"启动"]292 return d293 # 充电保护模式定时页面294 def piocc_mode_timer_page(self):295 d = {}296 # 标题297 d["title"] = [u"充电保护模式", "accessibility_id", u"充电保护模式定时页面"]298 # 关闭时间299 d["end_time"] = [u"插座延时关闭时长", "accessibility_id", u"插座延时关闭时长控件"]300 # 关闭时间301 d["end_time_text"] = ["//XCUIElementTypeWebView//XCUIElementTypeTextField", "xpath", u"插座延时关闭时长"]302 # 时间滚轮,小时303 d["roll_h"] = [u"//XCUIElementTypeOther[@name='小时']", "xpath", u"时间滚轮,小时", {"px": [0.51, 0.5]}]304 # 时间滚轮,分钟305 d["roll_m"] = [u"//XCUIElementTypeOther[@name='分钟']", "xpath", u"时间滚轮,分钟", {"px": [0.51, 0.5]}]306 # 模式名称307 d["mode_name"] = ["//XCUIElementTypeWebView//XCUIElementTypeOther[2]", "xpath", u"模式名称"]308 # 执行结果309 d["result"] = ["//XCUIElementTypeWebView//XCUIElementTypeOther[3]", "xpath", u"执行结果"]310 # 取消311 d["to_return"] = [u"取消", "accessibility_id", u"取消"]312 # 启动313 d["launch"] = [u"启动", "accessibility_id", u"启动"]314 return d315 # 普通定时页面316 def normal_timer_page(self):317 d = {}318 # 标题319 d["title"] = [u"定时设置", "accessibility_id", u"普通定时页面"]320 # 添加定时321 d["add_timer"] = ["newAdd", "accessibility_id", u"添加定时按钮"]322 # 返回按钮323 d["to_return"] = ["gray_back", "accessibility_id", u"返回"]324 # 执行记录325 d["timer_log"] = [u"执行记录", "accessibility_id", u"执行记录"]326 # 编辑定时327 d["timer_edit"] = ["//XCUIElementTypeWebView//XCUIElementTypeOther[2]", "xpath", u"编辑定时", {"px": [0.95, 0.5]}]328 # 无定时329 d["no_timer"] = [u"暂无设置定时", "accessibility_id", u"无定时"]330 return d331 # 新建普通定时页面332 def add_normal_timer_page(self):333 d = {}334 # 标题335 d["title"] = [u"新建定时", "accessibility_id", u"新建普通定时页面"]336 # 设定时间337 d["set_timer"] = ["//XCUIElementTypeWebView//XCUIElementTypeTextField", "xpath", u"设定时间"]338 # 时间滚轮,时339 d["roll_h"] = [u"//XCUIElementTypeOther[@name='时']", "xpath", u"时间滚轮,时", {"px": [0.51, 0.5]}]340 # 时间滚轮,分341 d["roll_m"] = [u"//XCUIElementTypeOther[@name='分']", "xpath", u"时间滚轮,分", {"px": [0.51, 0.5]}]342 # 重复343 d["repeat"] = ["//XCUIElementTypeWebView//XCUIElementTypeOther[2]", "xpath", u"重复"]344 # 定时开机345 d["power_on"] = [u"定时开机", "accessibility_id", u"定时开机"]346 # 定时关机347 d["power_off"] = [u"定时关机", "accessibility_id", u"定时关机"]348 # 定时名称349 d["timer_name"] = ["//XCUIElementTypeWebView/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[4]",350 "xpath", u"定时名称"]351 # 执行结果通知352 d["timer_name"] = ["//XCUIElementTypeWebView/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[5]",353 "xpath", u"执行结果通知"]354 # 取消按钮355 d["to_return"] = [u"取消", "accessibility_id", u"取消"]356 # 保存按钮357 d["saved"] = [u"保存", "accessibility_id", u"保存"]358 return d359 # 定时重复页面360 def timer_repeat_page(self):361 d = {}362 # 标题363 d["title"] = [u"重复", "accessibility_id", u"定时重复页面"]364 # 重复按钮365 d["repeat_button"] = ["//XCUIElementTypeWebView/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/"366 "XCUIElementTypeOther", "xpath", u"重复按钮"]367 # 执行一次368 d["once"] = [u"执行一次", "accessibility_id", u"执行一次"]369 # 每天370 d["everyday"] = [u"每天", "accessibility_id", u"每天"]371 # 工作日372 d["workday"] = [u"工作日", "accessibility_id", u"工作日"]373 # 自定义374 d["define"] = [u"自定义", "accessibility_id", u"自定义"]375 # 周一376 d["monday"] = [u"周一", "accessibility_id", u"周一"]377 # 周二378 d["tuesday"] = [u"周二", "accessibility_id", u"周二"]379 # 周三380 d["wednesday"] = [u"周三", "accessibility_id", u"周三"]381 # 周四382 d["thursday"] = [u"周四", "accessibility_id", u"周四"]383 # 周五384 d["friday"] = [u"周五", "accessibility_id", u"周五"]385 # 周六386 d["saturday"] = [u"周六", "accessibility_id", u"周六"]387 # 周日388 d["weekday"] = [u"周日", "accessibility_id", u"周日"]389 # 鱼缸模式循环按钮390 d["fish_repeat_button"] = ["//XCUIElementTypeWebView/XCUIElementTypeOther/XCUIElementTypeOther/"391 "XCUIElementTypeOther/XCUIElementTypeOther", "xpath", u"鱼缸模式循环按钮"]392 # 永久循环393 d["forever"] = [u"永久循环", "accessibility_id", u"永久循环"]394 # 执行次数395 d["cycle_index"] = [u"执行次数设置(次)", "accessibility_id", u"执行次数"]396 # 返回按钮397 d["to_return"] = ["gray_back", "accessibility_id", u"返回"]398 return d399 # 定时执行记录页面400 def timer_log_page(self):401 d = {}402 # 标题403 d["title"] = [u"执行记录", "accessibility_id", u"定时执行记录页面"]404 # 清空定时记录405 d["clear"] = [u"清空", "accessibility_id", u"清空定时记录"]406 # 有执行记录407 d["has_log"] = ["//XCUIElementTypeWebView/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther",408 "xpath", u"有执行记录"]409 # 无执行记录410 d["no_log"] = [u"暂无执行纪录!", "accessibility_id", u"无执行记录"]411 # 返回按钮412 d["to_return"] = ["gray_back", "accessibility_id", u"返回"]413 return d414 # 设置电价页面415 def set_elec_page(self):416 d = {}417 # 标题418 d["title"] = [u"电价设置", "accessibility_id", u"电价设置页面"]419 # 单一电价设置420 d["single_price"] = [u"单一电价 ", "accessibility_id", u"单一电价设置"]421 # 峰谷电价设置422 d["peak_valley_price"] = [u"峰谷时间段电价", "accessibility_id", u"峰谷电价设置"]423 # 单一电ä