Example #1
0
class FeedPage(AppBasePage):
    """
        推荐页面
    """
    boot_ad = IdElement('com.vs.vipsai:id/btn_go')  # 启动页广告
    boot_ad_close_btn = IdElement(
        'com.vs.vipsai:id/img_home_popu_close')  # 关闭广告
    feed_btn = XpathElement(
        '(//android.widget.ImageView[@content-desc="唯赛"])[1]')  # 推荐
    join_btn = IdElement('com.vs.vipsai:id/nav_item_arena')  # 竞技场
Example #2
0
class BootAdPage(AppBasePage):
    """
        启动广告页面测试
    """
    boot_ad = IdElement('com.vs.vipsai:id/btn_go')  # 启动页广告
    boot_ad_close_btn = IdElement(
        'com.vs.vipsai:id/img_home_popu_close')  # 关闭广告
    boot_ad_skin_btn = XpathElement(
        '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout[2]/android.widget.TextView[1]'
    )
    boot_ad_img_btn = XpathElement('com.vs.vipsai:id/img_home_adv')
    boot_ad_go_btn = XpathElement('com.vs.vipsai:id/btn_go')
Example #3
0
class TournamentPage(AppBasePage):
    """
        推荐页面
    """
    boot_ad = IdElement('com.vs.vipsai:id/btn_go')  # 启动页广告
    tournament_btn = XpathElement(
        '(//android.widget.ImageView[@content-desc="唯赛"])[2]')
Example #4
0
class LoginPage(AppBasePage):
    """
        登录页面
    """

    login_btn = IdElement('com.vs.vipsai:id/nav_item_me')
    profile_image = IdElement('com.vs.vipsai:id/fragment_main_user_home_protrait_bg_layout')
    profile_setting_btn = IdElement('com.vs.vipsai:id/fragment_main_user_home_btn_setting')
    logout_btn = IdElement('com.vs.vipsai:id/fragment_setttings_btn_logout')
    confirm_btn = IdElement('com.vs.vipsai:id/positive_btn')
    # qq登录相关按钮
    qq_login_btn = IdElement('com.vs.vipsai:id/activity_main_login_btn_qq')
    qq_username_input = AccessibilityIdElement('请输入QQ号码或手机或邮箱')
    qq_password_input = AccessibilityIdElement('密码 安全', need_shot=False)
    qq_login_submit_btn = AccessibilityIdElement('登录')

    def login(self, option, kwargs):
        getattr(self, 'login_{}'.format(option))(**kwargs)

    def login_qq(self, username, password):
        self.qq_login_btn.click()
        self.qq_username_input.clear()
        self.qq_username_input.send_keys(username)
        self.qq_username_input.clear()
        self.qq_password_input.send_keys(password)
        self.qq_login_submit_btn.click()

    def logout(self):
        self.profile_setting_btn.click()
        self.logout_btn.click()
        self.confirm_btn.click()
Example #5
0
class ProfilePage(AppBasePage):
    """
        个人中心页面
    """
    boot_ad_close_btn = IdElement(
        'com.vs.vipsai:id/img_home_popu_close')  # 关闭启动页广告
    profile_btn = XpathElement(
        '(//android.widget.ImageView[@content-desc="唯赛"])[2]')  # 我的
    profile_dynamic_btn = IdElement('com.vs.vipsai:id/nav_tv_title')  # 动态按钮
    profile_award_btn = IdElement('com.vs.vipsai:id/nav_tv_title')  # 获奖
    profile_tournament_btn = IdElement('com.vs.vipsai:id/nav_tv_title')  # 比赛
    profile_works_btn = IdElement('com.vs.vipsai:id/nav_tv_title')  # 作品
    qq_login_btn = IdElement(
        'com.vs.vipsai:id/activity_main_login_btn_qq')  # 选择QQ作为登录方式
    login_btn = XpathElement(
        '/hierarchy/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.Button'
    )  #点击登录
Example #6
0
class MyPage(AppBasePage):
    """
        个人中心页面
    """
    boot_ad_close_btn = IdElement('com.vs.vipsai:id/img_home_popu_close')  # 关闭启动页广告
    my_btn = XpathElement('(//android.widget.ImageView[@content-desc="唯赛"])[4]')  # 我的
    # profile_dynamic_btn = IdElement('com.vs.vipsai:id/nav_tv_title')  # 动态按钮
    # profile_award_btn = IdElement('com.vs.vipsai:id/nav_tv_title')   # 获奖
    # profile_tournament_btn = IdElement('com.vs.vipsai:id/nav_tv_title')  # 比赛
    # profile_works_btn = IdElement('com.vs.vipsai:id/nav_tv_title')  # 作品
    # qq_login_btn = IdElement('com.vs.vipsai:id/activity_main_login_btn_qq')   # 选择QQ作为登录方式
    # login_btn = IdElement('com.tencent.mobileqq:id/login')  # 点击登录
    login_btn = IdElement('com.vs.vipsai:id/nav_item_me')
    profile_image = IdElement('com.vs.vipsai:id/fragment_main_user_home_protrait_bg_layout')
    profile_setting_btn = IdElement('com.vs.vipsai:id/fragment_main_user_home_btn_setting')
    logout_btn = IdElement('com.vs.vipsai:id/fragment_setttings_btn_logout')
    confirm_btn = IdElement('com.vs.vipsai:id/positive_btn')
    # qq登录相关按钮
    qq_login_btn = IdElement('com.vs.vipsai:id/activity_main_login_btn_qq')
    qq_username_input = AccessibilityIdElement('请输入QQ号码或手机或邮箱')
    qq_password_input = AccessibilityIdElement('密码 安全', need_shot=False)
    qq_login_submit_btn = AccessibilityIdElement('登 录')
Example #7
0
class AppBasePage(BasePage):
    """App页面基类"""
    popup_close = IdElement('com.vs.vipsai:id/img_home_popu_close')
Example #8
0
class AppBasePage(BasePage):
    """App页面基类"""
    popup_close = IdElement('com.vs.vipsai:id/img_home_popu_close')


# class clean:
#     def clean_text(self,text)  # 清除文本框方法的安装
#       self.keyevent(123)    # 123代表光标移动到末尾键
#       for i in range(0,len(text)):
#           self.keyevent(67)   #  67代表退格键
#
#     def find_ele(self,id):  # 获取到要删除的文本框内容
#         find_ele = driver.find_element_by_id(id)
#         find_ele.click()
#         ruturn find_ale.get_attribute('text')
#

# FileName : Tmall_App.py
# Author   : Adil
# DateTime : 2018/3/25 17:22
# SoftWare : PyCharm

# import time
# from appium import  webdriver

# caps = {}
#
# caps['platformName'] = 'Android'
# caps['platformVersion'] = '6.0'
# caps['deviceName'] = 'N79SIV5PVCSODAQC'
# caps['appPackage'] = 'com.tmall.wireless'
# caps['appActivity'] = 'com.tmall.wireless.splash.TMSplashActivity'
# #隐藏键盘
# caps['unicodeKeyboard'] = True
# caps['resetKeyboard'] = True
# driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', caps)

# # 获取屏幕的size
# size = driver.get_window_size()
# print(size)
# # 获取屏幕宽度 width
# width = size['width']
# print(width)
# # 获取屏幕高度 height
# height = size['height']
# print(height)
#
# # 执行滑屏操作,向下(下拉)滑动
# x1 = width*0.5
# y1 = height*0.25
# y2 = height*0.8
# time.sleep(3)
# print("滑动前")
# driver.swipe(x1,y1,x1,y2)
# print("滑动后")
# # 增加滑动次数,滑动效果不明显,增加滑动次数
#
# for i in range(5):
#     print("第%d次滑屏"%i)
#     time.sleep(3)
#     driver.swipe(x1,y1,x1,y2)
# time.sleep(3)

# """
#      封装滑动方法
#  """
# size = self.driver.get_window_size() # 获取屏幕的size
# print(size)
# width = size['width']  # 获取屏幕宽度 width
# print(width)
# height = size['height']  # 获取屏幕高度 height
# print(height)
#
# def swipeUp(driver,n = 5):
#     """定义向上滑动方法"""
#     print("定义向上滑动方法")
#     x1 = width*0.5
#     y1 = height*0.9
#     y2 = height*0.25
#     time.sleep(3)
#     print("滑动前")
#     for i in range(n):
#         print("第%d次滑屏" % i)
#         time.sleep(3)
#         driver.swipe(x1, y1, x1, y2)
#
# def swipeDown(driver,n = 5):
#     """定义向下滑动方法"""
#     print("定义向下滑动方法")
#     x1 = width*0.5
#     y1 = height*0.25
#     y2 = height*0.9
#     time.sleep(3)
#     print("滑动前")
#         for i in range(n):
#         print("第%d次滑屏" % i)
#         time.sleep(3)
#         driver.swipe(x1, y1, x1, y2)
#
# def swipeLeft(driver,n = 5):
#     """定义向左滑动方法"""
#     print("定义向左滑动方法")
#     x1 = width*0.8
#     x2 = width*0.2
#     y1 = height*0.5
#     time.sleep(3)
#     print("滑动前")
#         for i in range(n):
#         print("第%d次滑屏" % i)
#         time.sleep(3)
#         driver.swipe(x1, y1, x2, y1)
#
# def swipeRight(driver,n = 5):
#     """定义向右滑动方法"""
#     print("定义向右滑动方法")
#     x1 = width*0.2
#     x2 = width*0.8
#     y1 = height*0.5
#     time.sleep(3)
#     print("滑动前")
#         for i in range(n):
#         print("第%d次滑屏" % i)
#         time.sleep(3)
#         driver.swipe(x1, y1, x2, y1)

# if __name__ == '__main__':
#
#     swipeUp(driver)
#     swipeDown(driver)
#     swipeLeft(driver)
#     swipeRight(driver)
#
#     driver.quit()