Exemple #1
0
    def test_add_poster(self, action: ElementActions):

        action.click(HomePage.关注按钮)
        action.sleep(1)
        action.capture_screen(
            u'关注截图',
            '/Users/zhangweishun/Desktop/appium-lich-master/screenshot/')
 def home(self, action: ElementActions):
     action.driver.wait_activity(self.activity, 8, interval=0.3)
     try:
         action.click(self.关闭初始化弹出窗, wait=3)
     except:
         log.info('无弹窗需要关闭,所以不会找到元素 关闭初始化弹出窗')
     action.tap(self.关闭初始化浮窗)
def login(account, password, action: ElementActions):
    time.sleep(5)
    # action.driver.find_element_by_id('com.shautolinked.car:id/btnLeft').click()

    action.text(LoginPage.用户名, account, clear_first=True)
    action.text(LoginPage.密码, password, clear_first=True)
    action.sleep(1)
    action.click(LoginPage.登录)
Exemple #4
0
    def test_share(self, action: ElementActions):

        action.click(HomePage.分享按钮)
        action.sleep(1)
        """
        判断是否有文本"share to"
        """
        action.is_text_displayed('Share to')
    def test_musicShot(self,action:ElementActions):
        action.click(HomePage.音乐集合页按钮)

        action.click(MusicCgPage.拍摄按钮)
        action.sleep(3)

        assert action.is_text_displayed('Tap to shoot')
        """
Exemple #6
0
 def pageinto(self, action: ElementActions):
     action.sleep(0.5).start_activity(self.activity)
     usercenterpage = UserCenterPage()
     # usercenterpage.pageinto(action)
     if action.find_ele(usercenterpage.注册登陆) != None:
         action.click(usercenterpage.注册登陆)
     else:
         log.info('app已是登陆状态,无法进入登陆页')
Exemple #7
0
    def test_download(self, action: ElementActions):
        action.click(HomePage.下载按钮)
        action.sleep(2)

        # 断言再想想,很难想
        action.capture_screen(
            u'下载截图',
            '/Users/zhangweishun/Desktop/appium-lich-master/screenshot/')
 def test_login(self, action: ElementActions):
     L.d('test_login')
     account = Steps.get_account()
     action.click(HomePage.登录入口)
     action.text(LoginPage.账户, account[0])
     action.text(LoginPage.密码, account[1])
     action.sleep(1)
     action.click(LoginPage.登录)
     assert action.is_toast_show('欢迎回来')
 def test_switchShot(self,action:ElementActions):
     """
     翻转摄像头
     :return:
     """
     action.click(HomePage.拍摄按钮)
     action.sleep(1)
     action.capture_screen(u'摄像头', '/Users/zhangweishun/Desktop/appium-lich-master/screenshot/')
     action.click(ShotPage.切换摄像头)
     action.sleep(1)
     action.capture_screen(u'切换摄像头', '/Users/zhangweishun/Desktop/appium-lich-master/screenshot/')
Exemple #10
0
 def test_login(self, action: ElementActions):
     L.d('test_login')
     allure.attach('描述', '这是一个登陆的case')
     account = Steps.get_account()
     action.sleep(3)
     # action.test_SwipeGuideImages()
     action.click(HomePage.登录入口)
     action.text(LoginPage.账户, account[0])
     action.text(LoginPage.密码, account[1])
     action.sleep(1)
     action.click(LoginPage.登录)
     action.sleep(3)
     assert action._find_text_in_page("我的")
Exemple #11
0
 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_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_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_slowShot(self,action:ElementActions):
     action.click(HomePage.拍摄按钮)
     action.click(ShotPage.拍摄速度)
     action.click(ShotPage.慢速)
     action.click(ShotPage.拍摄按钮)
     action.sleep(12)
     assert action.is_element_displayed(ShotPage.编辑完成,is_retry=False)
 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')
Exemple #17
0
    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")
Exemple #19
0
    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'
Exemple #20
0
 def switch_密码登录tag(self, action: ElementActions):
     action.click(self.密码登录tag)
 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')
Exemple #22
0
 def pageinto(self, action: ElementActions):
     usercenter = UserCenterPage()
     usercenter.pageinto(action)
     action.click(usercenter.设置按钮)
 def test_epicShot(self,action:ElementActions):
     action.click(ShotPage.拍摄速度)
     action.click(ShotPage.极慢)
     action.click(ShotPage.拍摄按钮)
     action.sleep(8)
     assert action.is_element_displayed(ShotPage.编辑完成,is_retry=False)
 def open_person_info(self, action: ElementActions):
     action.click(MyPage.我的)
     action.click(MyPage.已登录头像)
     action.click(UpOwnerPage.编辑)
Exemple #25
0
    def test_otherHomepage(self, action: ElementActions):
        uper = action.get_text(HomePage.作者名称)

        action.click(HomePage.作者头像)
        assert uper == action.get_text(MyPage.名字)