示例#1
0
 def bottomClassSheet(self):
     login(self)
     sleep(3)
     s=c.session()
     #bottom classSheet
     s(id='陪练单').tap()
     sleep(1)
     s(id='查看陪练单').tap()
     sleep(6)
     now=time.strftime('%Y-%m-%d %H_%M_%S')
     sf0='./'+now+'_015b_classSheetBottomTop_R.png'
     c.screenshot(sf0)
     sleep(2)
     s.swipe(800,500,800,50,0.5)
     sleep(1)
     s.swipe(800,500,800,50,0.5)
     sleep(1)
     s.swipe(800,500,800,50,0.5)
     sleep(1)
     now=time.strftime('%Y-%m-%d %H_%M_%S')
     sf1='./'+now+'_015b_classSheetBottomTail_R.png'
     c.screenshot(sf1)
     sleep(2)
     if s(id='点击播放语音评价').exists:
         s(id='点击播放语音评价').tap()
         sleep(6)
         s(id='点击播放语音评价').tap()
         sleep(2)
     s(id='ic nav back').tap()
     sleep(3)
     logout(self)
示例#2
0
 def waitForTeacher(self):
     login(self)
     sleep(2)
     s = c.session()
     s(id='进入教室').tap()
     sleep(5)
     if s(id='确定').exists:
         s(id='确定').tap()
         sleep(3)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf0 = './' + now + '_002b_enteredClassroom_R.png'
     c.screenshot(sf0)
     sleep(2)
     if s(id='pic_wait').exists:
         print('\nThere is a sign:请等待老师进入教室')
         sleep(2)
     s(id='呼叫老师').tap()
     sleep(4)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf1 = './' + now + '_002b_afterCallTeacher_R.png'
     c.screenshot(sf1)
     sleep(2)
     s.tap(349, 37)
     sleep(2)
     logout(self)
 def Logout(self):
     login(self)
     sleep(3)
     logout(self)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf1 = './' + now + '_012b_logout_R.png'
     c.screenshot(sf1)
     sleep(1)
示例#4
0
 def Login(self):
     #start
     login(self)
     sleep(3)
     now=time.strftime('%Y-%m-%d %H_%M_%S')
     sf0='./'+now+'_001b_login_R.png'
     #wda.DEBUG=False
     c.screenshot(sf0)
     sleep(3)
     logout(self)
 def uploadMusic(self):
     login(self)
     sleep(2)
     s=c.session()
     if s(id='上传乐谱').exists:
         s(id='上传乐谱').tap()
     else:
         s(id='查看乐谱').tap()
     sleep(2)
     if s.alert.wait(3):
         s.alert.accept()
         sleep(2)
     now=time.strftime('%Y-%m-%d %H_%M_%S')
     sf0='./'+now+'_005b_beforeAddMusic_R.png'
     c.screenshot(sf0)
     sleep(2)
     s(id='上传乐谱').tap()
     sleep(2)
     s(id='钢琴').tap()
     sleep(2)
     s(id='小提琴').tap()
     sleep(2)
     s(id='手风琴').tap()
     sleep(2)
     s(id='钢琴').tap()
     sleep(2)
     s(id='搜索书名或者曲目名').tap()
     sleep(2)
     s(id='车尔尼').tap()
     sleep(2)
     s(id='包含该曲目').tap()
     sleep(2)
     #first music
     s(className='XCUIElementTypeCell')[0].tap()
     sleep(3)
     turnpage_play(self)
     sleep(1)
     s(id='ic nav back').tap()
     sleep(2)
     s(id='   添 加   ').tap()
     sleep(2)
     s(id='ic nav back').tap()
     sleep(1)
     s(id='ic nav back').tap()
     sleep(1)
     now=time.strftime('%Y-%m-%d %H_%M_%S')
     sf1='./'+now+'_005b_afterAddMusic_R.png'
     c.screenshot(sf1)
     sleep(2)
     s(id='ic nav back').tap()
     sleep(2)
     logout(self)
 def changePwd(self):
     now=time.strftime('%Y-%m-%d %H_%M_%S')
     print('\n021:修改密码----开始:'+now)
     login(self)
     sleep(2)
     s=c.session()
     s(id='个人中心').tap()
     sleep(1)
     s(id='修改密码').tap()
     sleep(1)
     s(className='XCUIElementTypeSecureTextField')[0].tap()
     s(className='XCUIElementTypeSecureTextField')[0].set_text('123456')
     sleep(1)
     s(xpath='//XCUIElementTypeOther[2]/XCUIElementTypeSecureTextField').tap()
     s(xpath='//XCUIElementTypeOther[2]/XCUIElementTypeSecureTextField').set_text('123456wxl')
     sleep(1)
     s(xpath='//XCUIElementTypeOther[3]/XCUIElementTypeSecureTextField').tap()
     s(xpath='//XCUIElementTypeOther[3]/XCUIElementTypeSecureTextField').set_text('123456wxl')
     sleep(1)
     s(id='确认').tap()
     sleep(3)
     s.swipe(800,500,800,280,0.5)
     sleep(2)
     s(id='退出登录').tap()
     s(id='确定').tap()
     sleep(1)
     s(id='登录').tap()
     sleep(1)
     #check new password
     s(className='XCUIElementTypeTextField').tap()
     s(className='XCUIElementTypeTextField').clear_text()
     s(className='XCUIElementTypeTextField').set_text('14100000011')
     sleep(1)
     s(className='XCUIElementTypeSecureTextField').tap()
     s(className='XCUIElementTypeSecureTextField').clear_text()
     s(className='XCUIElementTypeSecureTextField').set_text('123456wxl')
     sleep(1)
     #登 录
     s(className='XCUIElementTypeButton',name='登录').tap()
     sleep(8)
     now=time.strftime('%Y-%m-%d %H_%M_%S')
     sf2='./'+now+'_021b_reLogin_R.png'
     c.screenshot(sf2)
     sleep(2)
     logout(self)
     sleep(1)
     now=time.strftime('%Y-%m-%d %H_%M_%S')
     print('\n021:修改密码----结束:'+now)
示例#7
0
 def checkClassSheet(self):
     login(self)
     sleep(2)
     s = c.session()
     #bottom classSheet
     s(id='陪练单').tap()
     sleep(3)
     i = random.randrange(0, 3, 1)
     s(id='查看陪练单')[i].tap()
     sleep(8)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf0 = './' + now + '_022b_classSheetDetail1_R.png'
     c.screenshot(sf0)
     sleep(2)
     s.swipe(800, 600, 0, 50, 0.5)
     sleep(1)
     s.swipe(800, 600, 0, 50, 0.5)
     sleep(1)
     s.swipe(800, 600, 0, 50, 0.5)
     sleep(1)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf1 = './' + now + '_022b_classSheetDetail2_R.png'
     c.screenshot(sf1)
     sleep(2)
     if s(id='评价老师').exists:
         s(id='评价老师').tap()
         sleep(1)
         s(id='满意').tap()
         s(id='非常耐心').tap()
         s(id='声音甜美').tap()
         s(id='互动性强').tap()
         s(id='满意').tap()
         s.swipe(800, 500, 0, 100, 0.5)
         sleep(2)
         #without name
         s(className='XCUIElementTypeTextView').tap()
         s(className='XCUIElementTypeTextView').set_text(
             '我的意见非常大,不是一句话能说完的。123456 abcdefg')
         sleep(1)
         s(id='完成').tap()
         s(id='提交评价').tap()
         sleep(3)
     s(id='ic nav back').tap()
     sleep(2)
     logout(self)
 def classUI(self):
     login(self)
     sleep(2)
     s = c.session()
     if s(id='本日暂时没有课程安排').exists:
         print('本日暂时没有课程安排!')
         sleep(2)
     else:
         if s(id='ic classroom2').enabled:
             print('进入教室的按钮现在是红色的!')
             sleep(2)
         else:
             print('进入教室的按钮现在是灰色的!')
             sleep(2)
     sleep(1)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf0 = './' + now + '_020b_classUI_R.png'
     c.screenshot(sf0)
     sleep(3)
     logout(self)
 def uploadMusicByOneself(self):
     login(self)
     sleep(3)
     s = c.session()
     if s(id='上节课程').exists:
         s(id='上节课程').tap()
         flag = s(className='XCUIElementTypeStaticText')[2].text
     else:
         flag = s(className='XCUIElementTypeStaticText')[3].text
     sleep(2)
     #ic upload1
     print('\n' + flag)
     print('\n已开始:' + str('已开始' in flag))
     print('\n已结束:' + str('已结束' in flag))
     sleep(1)
     if s(id='上传乐谱').exists:
         s(id='上传乐谱').tap()
     else:
         s(id='查看乐谱').tap()
     sleep(2)
     if s.alert.wait(3):
         s.alert.accept()
         sleep(2)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf = './' + now + '_024b_uploadedMusicIni_R.png'
     c.screenshot(sf)
     sleep(2)
     lis = s(className='XCUIElementTypeCell').find_elements()
     i = len(lis)
     print('\ni:' + str(i) + '----实际已有乐谱数量:' + str(i - 1))
     sleep(2)
     #delete existing music
     if (i != 1 and (not ('已开始' in flag) and not ('已结束' in flag))):
         for j in range(i - 1):
             s(id='删除').tap()
             sleep(2)
             s(id='确定').tap()
             sleep(2)
         sleep(2)
         s(id='上传乐谱').tap()
         sleep(2)
         """
         s(id='自主上传').tap()
         sleep(2)
         s(id='取消').tap()
         sleep(2)
         """
         s(id='自主上传').tap()
         sleep(2)
         s(id='最近上过的乐谱').tap()
         sleep(2)
         s(id='   添 加   ').tap()
         sleep(2)
         s(id='ic nav back').tap()
         sleep(2)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf0 = './' + now + '_024b_uploadedMusicByBefore_R.png'
         c.screenshot(sf0)
         sleep(2)
         #[i] for not deleting firstly
         s(id='ic_next')[1].tap()
         sleep(2)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf2 = './' + now + '_024b_uploadedMusicByBeforeDetail_R.png'
         c.screenshot(sf2)
         sleep(2)
         turnpage_play(self)
         sleep(2)
         s(id='ic nav back').tap()
         sleep(2)
         s(id='上传乐谱').tap()
         sleep(2)
         s(id='自主上传').tap()
         sleep(2)
         s(id='从相册选择').tap()
         sleep(2)
         s(className='XCUIElementTypeButton')[7].tap()
         sleep(2)
         s(id='完成').tap()
         sleep(8)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf1 = './' + now + '_024b_uploadedMusicByAlbum_R.png'
         c.screenshot(sf1)
         sleep(2)
         #[i+1] for not deleting firstly
         s(id='ic_next')[2].tap()
         sleep(8)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf3 = './' + now + '_024b_uploadedMusicByAlbumDetail_R.png'
         c.screenshot(sf3)
         sleep(2)
         s(id='ic nav back').tap()
         sleep(2)
         s(id='上传乐谱').tap()
         sleep(2)
         s(id='自主上传').tap()
         sleep(2)
         s(id='拍照上传').tap()
         sleep(2)
         s(id='ic_ photograph').tap()
         sleep(2)
         if s.alert.wait(3):
             s.alert.accept()
             sleep(2)
         s(xpath=
           '//XCUIElementTypeButton[@name="FrontBackFacingCameraChooser"]'
           ).tap()
         sleep(3)
         #PhotoCapture
         s(id='PhotoCapture').tap()
         sleep(2)
         s(id='使用照片').tap()
         sleep(2)
         s(id='完成').tap()
         sleep(10)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf4 = './' + now + '_024b_uploadedMusicBySelfie_R.png'
         c.screenshot(sf4)
         sleep(2)
         #[i+2] for not deleting firstly
         s(id='ic_next')[3].tap()
         sleep(8)
     else:
         s(id='上传乐谱').tap()
         sleep(2)
         s(id='自主上传').tap()
         sleep(2)
         s(id='取消').tap()
         sleep(2)
         s(id='自主上传').tap()
         sleep(2)
         s(id='最近上过的乐谱').tap()
         sleep(2)
         s(id='   添 加   ').tap()
         sleep(2)
         s(id='ic nav back').tap()
         sleep(2)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf5 = './' + now + '_024b_uploadedMusicByBefore_R.png'
         c.screenshot(sf5)
         sleep(2)
         #[i] for not deleting firstly
         s(id='ic_next')[i].tap()
         sleep(2)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf6 = './' + now + '_024b_uploadedMusicByBeforeDetail_R.png'
         c.screenshot(sf6)
         sleep(2)
         turnpage_play(self)
         sleep(2)
         s(id='ic nav back').tap()
         sleep(2)
         s(id='上传乐谱').tap()
         sleep(2)
         s(id='自主上传').tap()
         sleep(2)
         s(id='从相册选择').tap()
         sleep(2)
         s(className='XCUIElementTypeButton')[4].tap()
         sleep(2)
         s(id='完成').tap()
         sleep(8)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf7 = './' + now + '_024b_uploadedMusicByAlbum_R.png'
         c.screenshot(sf7)
         sleep(2)
         #[i+1] for not deleting firstly
         s(id='ic_next')[i + 1].tap()
         sleep(8)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf8 = './' + now + '_024b_uploadedMusicByAlbumDetail_R.png'
         c.screenshot(sf8)
         sleep(2)
         s(id='ic nav back').tap()
         sleep(2)
         s(id='上传乐谱').tap()
         sleep(2)
         s(id='自主上传').tap()
         sleep(2)
         s(id='拍照上传').tap()
         sleep(2)
         s(id='ic_ photograph').tap()
         sleep(2)
         if s.alert.wait(3):
             s.alert.accept()
             sleep(2)
         s(xpath=
           '//XCUIElementTypeButton[@name="FrontBackFacingCameraChooser"]'
           ).tap()
         sleep(2)
         #PhotoCapture
         s(id='PhotoCapture').tap()
         sleep(2)
         s(id='使用照片').tap()
         sleep(2)
         s(id='完成').tap()
         sleep(10)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf9 = './' + now + '_024b_uploadedMusicBySelfie_R.png'
         c.screenshot(sf9)
         sleep(2)
         #[i+2] for not deleting firstly
         s(id='ic_next')[i + 2].tap()
         sleep(8)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf10 = './' + now + '_024b_uploadedMusicBySelfieDetail_R.png'
     c.screenshot(sf10)
     sleep(2)
     s(id='ic nav back').tap()
     sleep(2)
     s(id='ic nav back').tap()
     sleep(2)
     logout(self)
 def deleteEditMusic(self):
     login(self)
     sleep(2)
     s = c.session()
     if s(id='上节课程').exists:
         s(id='上节课程').tap()
         flag = s(className='XCUIElementTypeStaticText')[2].text
     else:
         flag = s(className='XCUIElementTypeStaticText')[3].text
     sleep(2)
     #ic upload1
     print('\n' + flag)
     print('\n已开始:' + str('已开始' in flag))
     print('\n已结束:' + str('已结束' in flag))
     sleep(1)
     now = time.strftime('%Y-%m-%d %H_%M_%S')
     sf = './' + now + '_025b_classUI_R.png'
     c.screenshot(sf)
     sleep(2)
     if ((s(id='查看乐谱').exists)
             and (not ('已开始' in flag) and not ('已结束' in flag))):
         s(id='查看乐谱').tap()
         sleep(2)
         if s.alert.wait(3):
             s.alert.accept()
             sleep(2)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf0 = './' + now + '_025b_beforeDelete_R.png'
         c.screenshot(sf0)
         sleep(2)
         #item=s(className='XCUIElementTypeStaticText')[2].text
         #print(str(item))
         #sleep(1)
         if s(id='自主上传乐谱').exists:
             s(id='自主上传乐谱').tap()
             sleep(2)
             s(id='编辑').tap()
             sleep(2)
             #xy
             s(id='ic drag').tap()
             sleep(2)
             s(id='完成').tap()
             sleep(2)
         else:
             print('\n没有自主上传乐谱可以编辑!')
             sleep(2)
         s(id='删除')[0].tap()
         sleep(2)
         s(id='确定').tap()
         sleep(2)
         now = time.strftime('%Y-%m-%d %H_%M_%S')
         sf4 = './' + now + '_025b_afterDelete_R.png'
         c.screenshot(sf4)
         sleep(2)
         s(id='ic nav back').tap()
         sleep(2)
     elif (('已开始' in flag) or ('已结束' in flag)):
         print('\n现在时间不符合该脚本运行条件!')
         sleep(2)
     elif (not (s(id='查看乐谱').exists)):
         print('\n没有乐谱可以删除/编辑!')
         sleep(2)
     else:
         print('\n发生未知原因错误,请检查!')
     sleep(3)
     logout(self)
 def searchMusic(self):
     login(self)
     sleep(3)
     #ic upload1
     s=c.session()
     if s(id='上传乐谱').exists:
         s(id='上传乐谱').tap()
     else:
         s(id='查看乐谱').tap()
     sleep(2)
     if s.alert.wait(3):
         s.alert.accept()
         sleep(2)
     s(id='上传乐谱').tap()
     #hot search
     s(id='搜索书名或者曲目名').tap()
     s(id='考级').tap()
     sleep(1)
     s(id='钢琴').tap()
     sleep(3)
     s(id='小提琴').tap()
     sleep(3)
     s(id='手风琴').tap()
     sleep(3)
     s(id='钢琴').tap()
     sleep(3)
     #first music
     s(className='XCUIElementTypeCell')[0].tap()
     sleep(3)
     #first item
     s(className='XCUIElementTypeCell')[0].tap()
     sleep(3)
     now=time.strftime('%Y-%m-%d %H_%M_%S')
     sf2='./'+now+'_003b_searchedMusicByHotDetail_R.png'
     c.screenshot(sf2)
     sleep(2)
     turnpage_play(self)
     sleep(1)
     s(id='ic nav back').tap()
     sleep(1)
     s(id='ic nav back').tap()
     sleep(1)
     """
     s(id='取消').tap()
     sleep(2)
     s(id='全部').tap()
     sleep(2)
     """
     #whole music name
     s(className='XCUIElementTypeTextField').tap()
     s(className='XCUIElementTypeTextField').set_text('车尔尼299 No.02')
     sleep(1)
     s(id='Search').tap()
     sleep(3)
     s(id='包含该曲目').tap()
     sleep(3)
     s(className='XCUIElementTypeCell')[0].tap()
     sleep(3)
     now=time.strftime('%Y-%m-%d %H_%M_%S')
     sf1='./'+now+'_003b_searchedMusicByWholenameDetail_R.png'
     c.screenshot(sf1)
     sleep(2)
     turnpage_play(self)
     sleep(2)
     s(id='ic nav back').tap()
     sleep(1)
     s(id='ic nav back').tap()
     sleep(1)
     s(id='取消').tap()
     sleep(2)
     s(id='全部').tap()
     sleep(2)
     #keyword
     s(className='XCUIElementTypeTextField').tap()
     s(className='XCUIElementTypeTextField').set_text('299 No.07')
     sleep(1)
     s(id='Search').tap()
     sleep(3)
     s(id='包含该曲目').tap()
     sleep(3)
     s(className='XCUIElementTypeCell')[0].tap()
     sleep(3)
     now=time.strftime('%Y-%m-%d %H_%M_%S')
     sf3='./'+now+'_003b_searchedMusicByKeywordDetail_R.png'
     c.screenshot(sf3)
     sleep(2)
     turnpage_play(self)
     sleep(1)
     s(id='ic nav back').tap()
     sleep(1)
     s(id='ic nav back').tap()
     sleep(1)
     s(id='取消').tap()
     sleep(2)
     s(id='ic nav back').tap()
     sleep(1)
     s(id='ic nav back').tap()
     sleep(2)
     logout(self)