def test_share(self, action: ElementActions): action.click(HomePage.分享按钮) action.sleep(1) """ 判断是否有文本"share to" """ action.is_text_displayed('Share to')
def test_Normalshot(self, action: ElementActions): action.click(HomePage.拍摄按钮) if action.is_text_displayed('Allow Access', is_retry=False): action.click(ShotPage.申请权限) action.click(ShotPage.获取权限) action.click(ShotPage.获取权限) action.click(ShotPage.拍摄提示) else:pass action.click(ShotPage.拍摄按钮) action.sleep(15) action.click(ShotPage.编辑完成) #action.click(ShotPage.上传按钮) assert action.is_text_displayed('Post')
def test_musicShot(self,action:ElementActions): action.click(HomePage.音乐集合页按钮) action.click(MusicCgPage.拍摄按钮) action.sleep(3) assert action.is_text_displayed('Tap to shoot') """
def test_Upload(self,action:ElementActions): action.click(HomePage.拍摄按钮) action.click(ShotPage.上传视频) action.sleep(2) action.click(ShotPage.选择视频) action.click(ShotPage.剪切完成) action.click(ShotPage.编辑完成) assert action.is_text_displayed('Post')
def test_comment(self, action: ElementActions): action.sleep(1) action.click(HomePage.评论按钮) action.sleep(1) action.click(CommentPage.评论框打开) action.text(CommentPage.评论框输入, 'nice') action.click(CommentPage.评论发送) action.sleep(1) assert action.is_text_displayed('nice')
def test_rrtv_login(self, action: ElementActions): L.d('rrtv login') account = Steps.get_account() action.click(MyPage.我的) action.click(MyPage.头像) action.click(LoginPage.账号密码登录) action.text(LoginPage.账户, account[0]) action.back_press() action.text(LoginPage.密码, account[1]) action.back_press() action.click(LoginPage.登录) assert action.is_text_displayed("test")
def test_login_empty_password(self, action: ElementActions): account = Steps.get_account() time.sleep(20) action.swip_left(3) time.sleep(5) L.d('test_login_empty_password') L.i('账户{0},密码为空'.format(account[0])) action.click(HomePage.登录) login(account[0], "", action) action.sleep(5) try: assert action.is_text_displayed('密码能为空1') except Exception as e: action.save_failure_pic(sys._getframe().f_code.co_name)
def test_5partshot(self,action:ElementActions): action.click(HomePage.拍摄按钮) action.click(ShotPage.拍摄按钮) action.sleep(3) action.click(ShotPage.拍摄按钮) action.click(ShotPage.拍摄按钮) action.sleep(3) action.click(ShotPage.拍摄按钮) action.click(ShotPage.拍摄按钮) action.sleep(3) action.click(ShotPage.拍摄按钮) action.click(ShotPage.拍摄按钮) action.sleep(3) action.click(ShotPage.编辑完成) assert action.is_text_displayed('Post')
def test_home(self, action: ElementActions): # up.登录页.login(action,'13550234762','tmhrush2233') action.click(p.特卖首页.搜索输入框) #因为调用action的大部分公用方法是返回self,所以可以一条语句执行多次不同方法 action.text(p.分类列表搜索页.搜索输入框,"口红")\ .click(p.分类列表搜索页.搜索按钮) action.click(p.搜索后列表页.第一个商品项) #循环下拉,检查是否有对应关键字,找到后终止 for count in range(20): if action.swip_down().is_text_displayed("商品参数"): break #没有对应关键字抛出错误 if action.is_text_displayed("口红") == False: raise NotFoundTextError action.sleep(1)
def test_login(self, action: ElementActions): L.d('test_login') """ 检查是否在登录状态,在登陆的话就退出登录再登录 """ action.click(HomePage.我的) if action.is_text_displayed('like'): action.click(MyPage.设置) action.click(SettingPage.登出) action.click(SettingPage.确定) action.click(HomePage.我的) else: pass action.click(HomePage.登陆按钮) action.sleep(1) action.text(LoginPage.手机号, '96522075359') action.click(LoginPage.获取验证码) action.sleep(1) action.text(LoginPage.密码, '2333') action.sleep(0.5) action.click(LoginPage.登陆) assert action.get_text(MyPage.名字) == 'kirua'
def swip_down(self, action: ElementActions): assert action.is_text_displayed()
def test_pressShot(sel,action:ElementActions): action.click(HomePage.拍摄按钮) action.click(ShotPage.长按拍摄) action.long_press(ShotPage.拍摄按钮, dua=15000) action.click(ShotPage.编辑完成) assert action.is_text_displayed('Post')