Exemplo n.º 1
0
class TestVideoCall(object):
    def setup(self):
        logger.info("========登录模块测试用例执行开始========【{}】========".format(next(num)))
        self.driver_x620 = GetDriver().get_driver()                 #获取driver1,默认手机LE_X620
        self.m_x620 = MobileOperating(self.driver_x620)
        self.address_x620 = AddressList(self.driver_x620)
        self.home_x620 = HomeView(self.driver_x620)
        self.video_x620 = VideoCallPage(self.driver_x620)
        self.personal_page = PersonalDetailsPage(self.driver_x620)
    def teardown(self):
        logger.info("=============登录模块测试用例执行结束=============")
        self.driver_x620.quit()

    @allure.story('验证测试视频通话对方接通后页面')
    def test_video_1(self):
        logger.info('测试视频通话对方接通后页面')
        driver_pixel = GetDriver("PIXEL_XL").get_driver()           #获取driver2,指定设备PIXEL_XL
        time.sleep(5)
        try:
            self.home_x620.click_address_list_tab()                     #点击通讯录
            time.sleep(2)
            self.address_x620.uiautomator_text_click(self.address_x620.activity,'13694245189')     #点击手机号码为13694245189号码联系人
            self.address_x620.click_ele('拨打视频通话按钮',self.personal_page.video_call_btn,self.personal_page.activity)
            result1 = self.address_x620.check_ele_text(self.video_x620.activity,self.video_x620.video_tv_text,'正在等待对方接听...')
            assert_ture(self.driver_x620,result1)                #为接听前  验证是不是显示【正在等待对方接听...】
            video_pixel = VideoCallPage(driver_pixel)
            video_pixel.click_ele('接听按钮',video_pixel.ivVideoAnswer,video_pixel.activity)
            result2=self.address_x620.no_element(self.video_x620.video_tv_text)
            assert_false(self.driver_x620,result2)               #接听成功后,验证【正在等待对方接听...】是否不存在
            time.sleep(10)
            driver_pixel.quit()
        except:
            driver_pixel.quit()
Exemplo n.º 2
0
 def setup(self):
     logger.info("========登录模块测试用例执行开始========【{}】========".format(next(num)))
     self.driver = GetDriver().get_driver()
     self.driver.implicitly_wait(20)
     self.m = MobileOperating(self.driver)
     self.m.data_mode()                              #确保手机使用数据网络状态
     self.login = Login(self.driver)
Exemplo n.º 3
0
 def setup(self):
     logger.info("========登录模块测试用例执行开始========【{}】========".format(next(num)))
     self.driver_x620 = GetDriver().get_driver()                 #获取driver1,默认手机LE_X620
     self.m_x620 = MobileOperating(self.driver_x620)
     self.address_x620 = AddressList(self.driver_x620)
     self.home_x620 = HomeView(self.driver_x620)
     self.video_x620 = VideoCallPage(self.driver_x620)
     self.personal_page = PersonalDetailsPage(self.driver_x620)
Exemplo n.º 4
0
class TestLogin(object):
    def setup(self):
        logger.info("========登录模块测试用例执行开始========【{}】========".format(next(num)))
        self.driver = GetDriver().get_driver()
        self.driver.implicitly_wait(20)
        self.m = MobileOperating(self.driver)
        self.m.data_mode()                              #确保手机使用数据网络状态
        self.login = Login(self.driver)
    def teardown(self):
        logger.info("=============登录模块测试用例执行结束=============")
        self.driver.quit()

    @allure.story('验证登录号码是否为指定号码')
    def test_login_1(self):
        logger.info('验证登录号码是否为指定号码')
        self.m.reset_app()          #重置APP操作
        self.login.onekey_login_skip()
        result = self.login.check_ele_text(self.login.activity, self.login.login_phone,str(self.login.get_phone_num()[0]))
        assert_ture(result,self.driver)

    @allure.story('验证断网情况下登录页面显示')
    def test_login_2(self):
        logger.info('验证断网情况下登录页面显示')
        self.m.reset_app()          #重置APP操作
        self.login.onekey_login_skip()
        self.m.airplane_mode()
        time.sleep(2)
        result = self.login.check_ele_text(self.login.activity, self.login.tv_error_content, '网络不可用,请检查网络设置')
        assert_ture(self.driver, result)
        self.m.data_mode()
        time.sleep(2)
    @allure.story('验证登录成功进入主页是否成功')
    def test_login_3(self):
        logger.info('验证登录成功进入主页是否成功')
        self.m.reset_app()  # 重置APP操作
        self.login.onekey_login_skip()
        self.login.click_ele('一键登录',self.login.one_key_login,self.login.activity)
        self.login.click_ele('登录弹窗确定',self.login.login_tv_button,self.login.activity)
        time.sleep(15)
        self.login.grant_permissions_allow()
        self.login.click_ele('通讯录tab',HomeView.address_list,HomeView.activity)
        self.login.click_ele('通讯录tab',HomeView.address_list,HomeView.activity)
        result=self.login.check_ele_text(HomeView.activity,HomeView.address_list,'通讯录')
        assert_ture(self.driver,result)
Exemplo n.º 5
0
 def test_video_1(self):
     logger.info('测试视频通话对方接通后页面')
     driver_pixel = GetDriver("PIXEL_XL").get_driver()           #获取driver2,指定设备PIXEL_XL
     time.sleep(5)
     try:
         self.home_x620.click_address_list_tab()                     #点击通讯录
         time.sleep(2)
         self.address_x620.uiautomator_text_click(self.address_x620.activity,'13694245189')     #点击手机号码为13694245189号码联系人
         self.address_x620.click_ele('拨打视频通话按钮',self.personal_page.video_call_btn,self.personal_page.activity)
         result1 = self.address_x620.check_ele_text(self.video_x620.activity,self.video_x620.video_tv_text,'正在等待对方接听...')
         assert_ture(self.driver_x620,result1)                #为接听前  验证是不是显示【正在等待对方接听...】
         video_pixel = VideoCallPage(driver_pixel)
         video_pixel.click_ele('接听按钮',video_pixel.ivVideoAnswer,video_pixel.activity)
         result2=self.address_x620.no_element(self.video_x620.video_tv_text)
         assert_false(self.driver_x620,result2)               #接听成功后,验证【正在等待对方接听...】是否不存在
         time.sleep(10)
         driver_pixel.quit()
     except:
         driver_pixel.quit()
Exemplo n.º 6
0
            return True
        except:
            logger.info('{}获取失败'.format(message))
            return False

    def h5_contexts(self):
        '''切换H5页面操作'''
        contexts = self.driver.contexts
        print(contexts)
        self.driver.switch_to.context("WEBVIEW_chrome")
        print(self.driver.current_context)


if __name__ == '__main__':
    #GetDriver().close_appium_port()
    driver = GetDriver().get_driver()
    driver.implicitly_wait(20)
    m = MobileOperating(driver)

    def test_long():
        '''测试长按'''
        time.sleep(5)
        driver.find_element_by_id("com.cmic.college:id/tvContact").click()
        driver.find_element_by_id("com.cmic.college:id/tv_manage").click()
        elm = driver.find_element_by_xpath(
            "//android.support.v7.widget.RecyclerView[@resource-id='com.cmic.college:id/rv_content']/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]"
        )
        time.sleep(2)
        m.long_press_operating(elm)

    # test_long()
Exemplo n.º 7
0
    activity_center = (MobileBy.ID, 'com.cmic.college:id/activity_center')
    # 卡券
    coupons = (MobileBy.ID, 'com.cmic.college:id/web_hall_coupons')
    # 网上营业厅
    online_hall = (MobileBy.ID, 'com.cmic.college:id/web_hall_page')
    # 邀请有奖
    invite_prize = (MobileBy.ID, 'com.cmic.college:id/share_app')
    # 帮助与反馈
    feedback = (MobileBy.ID, 'com.cmic.college:id/feedback')
    # 设置
    setting_app = (MobileBy.ID, 'com.cmic.college:id/setting')

    def check_title(self):
        '''检查当前模块是否为我'''
        self.logger.info('检查当前页面title是否为[我]')
        return self.check_ele_text(self.activity, self.title, '我')

    def click_user_profile(self):
        self.logger.info('点击[查看并编辑个人资料]按钮')
        return self.click_ele('查看并编辑个人资料', self.user_profile, self.activity)

    def check_free_flow(self):
        self.logger.info('点击[查看并编辑个人资料]按钮')
        return self.click_ele('查看并编辑个人资料', self.user_profile, self.activity)


if __name__ == '__main__':
    driver = GetDriver().get_driver()
    HomeView(driver).click_me_tab()
    MeView(driver).check_title()
    address_list = (MobileBy.ID, 'com.cmic.college:id/tvContact')
    # 密友tab
    meetyou = (MobileBy.ID, 'com.cmic.college:id/tvContact')
    # 合家欢
    contact = (MobileBy.ID, 'com.cmic.college:id/dynamic_tab')
    # 我tab
    me = (MobileBy.ID, 'com.cmic.college:id/tvMe')
    #登录进入,权限申请【允许】
    permission_allow = (
        MobileBy.ID, 'com.android.packageinstaller:id/permission_allow_button')
    #登录进入,权限申请【拒绝】
    permission_deny = (
        MobileBy.ID, 'com.android.packageinstaller:id/permission_deny_button')

    def click_me_tab(self):
        return self.click_ele('我', self.me, self.activity)

    def click_address_list_tab(self):
        return self.click_ele('通讯录', self.address_list, self.activity)

    def click_workbench_tab(self):
        return self.click_ele('密友tab', self.meetyou, self.activity)

    def click_contact_tab(self):
        return self.click_ele('合家欢', self.contact, self.activity)


if __name__ == '__main__':
    driver = GetDriver("phone1").get_driver()
    h = HomeView(driver).click_me_tab()
    print(h)
        company = data.get('company').get('after')
        if not company == '未设置':
            self.logger.info('输入公司')
            return self.send_key_ele('公司输入框', self.edit_profile_name, company,
                                     self.activity)
        else:
            self.logger.info('数据为未设置, 只做清空,不做输入')
            return True

    def input_edit_position(self):
        position = data.get('position').get('after')
        if not position == '未设置':
            self.logger.info('输入职位')
            return self.send_key_ele('职位输入框', self.edit_profile_name, position,
                                     self.activity)
        else:
            self.logger.info('数据为未设置, 只做清空,不做输入')
            return True

    def click_save(self):
        self.logger.info('点击[保存]按钮')
        return self.click_ele('保存', self.save, self.activity)


if __name__ == '__main__':
    dr = GetDriver('phone1')
    driver = dr.get_driver()
    HomeView(driver).click_me_tab()
    MeView(driver).click_user_profile()
    ShowUserProfileView(driver).click_edit()
    EditUserProfileView(driver).check_profile_name_title()
from test.suite.mobile_operating import MobileOperating

def save_picture(driver):
    '''保存截图到指定目录'''
    path1 = os.path.join(REPORT_DIR, "picture_save")
    dir_name ="%s"%time.strftime("%Y%m%d")
    try:
        os.mkdir(path1 + "\\"+dir_name)
        path_new_dir = os.path.join(path1,dir_name)
    except:
        path_new_dir = os.path.join(path1, dir_name)
    path_new = os.path.join(path_new_dir,time.strftime("%H%M%S")+".png")
    MobileOperating(driver).save_screenshut(path_new)
def assert_ture(driver,expr):
    '''判断正确,如果错误就截图到指定目录'''
    if not expr:
        save_picture(driver)
        raise Exception('判断【{}】正确-----失败'.format(expr))

def assert_false(driver,expr):
    '''判断错误,如果正确就截图到指定目录'''
    if expr:
        save_picture(driver)
        raise Exception('判断【{}】失败-----失败'.format(expr))


if __name__ == '__main__':
    # unittest.main()
    driver = GetDriver().get_driver()
    save_picture(driver)
    driver.quit()