Esempio n. 1
0
 def make_already_in_call():
     """确保进入通话界面"""
     preconditions.connect_mobile(REQUIRED_MOBILES['IOS-移动'])
     current_mobile().hide_keyboard_if_display()
     cpg = CallPage()
     message_page = MessagePage()
     if message_page.is_on_this_page():
         cpg.click_call()
         return
     if cpg.is_on_the_call_page():
         return
     try:
         current_mobile().terminate_app('com.chinasofti.rcs', timeout=2000)
     except:
         pass
     current_mobile().launch_app()
     try:
         message_page.wait_until(
             condition=lambda d: message_page.is_on_this_page(), timeout=15)
         cpg.click_call()
         return
     except TimeoutException:
         pass
     preconditions.reset_and_relaunch_app()
     preconditions.make_already_in_one_key_login_page()
     preconditions.login_by_one_key_login()
     cpg.click_call()
Esempio n. 2
0
    def test_me_0009(self):
        """我的二维码转发-选择本地通讯录联系人-搜索未保存到本地通讯录联系人的手机号"""
        # 进入我的二维码页面
        me_page = MePage()
        me_page.click_qr_code_icon()

        # 点击转发
        qr_code = MyQRCodePage()
        # 等待加载完成
        qr_code.wait_for_loading_animation_end()
        # 解析二维码
        import time
        time.sleep(2)

        # 获取要转发的二维码(解析为链接)
        my_link = qr_code.decode_qr_code()
        print(my_link)
        qr_code.click_forward_qr_code()
        # current_mobile().click_text("选择本地联系人", True)

        pg = ContactsSelector()
        pg.wait_for_page_load()
        pg.search('13500000000')
        time.sleep(1)
        pg.click_local_contacts('13500000000(未知号码)')
        current_mobile().click_text("确定", True)

        toast = current_mobile().wait_until(condition=lambda d: current_mobile(
        ).get_element(['xpath', '//android.widget.Toast']))
        self.assertEqual('已转发', toast.text)
        qr_code.wait_for_page_load()
        qr_code.click_back()

        me_page.open_message_page()
        current_mobile().click_text('13500000000')

        chat = ChatWindowPage()
        chat.wait_for_page_load()
        # 如果弹出提示框就点击空白
        if chat.is_tips_display():
            chat.directly_close_tips_alert()

        # 获取截图
        screen_shot = current_mobile().get_screenshot_as_png()
        import io
        from PIL import Image
        from pyzbar import pyzbar

        # 屏幕是否包含刚刚转发的二维码(解析为文本链接)
        qrs = pyzbar.decode(Image.open(io.BytesIO(screen_shot)))
        self.assertIsNotNone(qrs)
        links = []
        for qr in qrs:
            links.append(qr.data.decode('utf-8'))
        self.assertIn(my_link, links)
Esempio n. 3
0
    def test_me_0011(self):
        """个人资料-分享名片到群"""
        # 点击头像进入名片
        me_page = MePage()
        me_page.wait_for_head_load()
        me_page.click_head()

        # 点击分享名片
        card = NameCardPage()
        card.wait_for_page_load()
        info = card.get_name_card_info()
        print(info)
        card.click_share_btn()

        # 分享到一个群
        current_mobile().click_text("选择一个群", True)

        pg = PickGroupPage()
        pg.wait_for_page_load()
        pg.select_group('群聊')
        current_mobile().click_text("发送名片", True)

        toast = current_mobile().wait_until(condition=lambda d: current_mobile(
        ).get_element(['xpath', '//android.widget.Toast']))
        self.assertEqual('已发送', toast.text)
 def setUpClass(cls):
     # 创建联系人
     fail_time = 0
     import dataproviders
     while fail_time < 3:
         try:
             required_contacts = dataproviders.get_preset_contacts()
             conts = ContactsPage()
             Preconditions.connect_mobile('Android-移动')
             current_mobile().hide_keyboard_if_display()
             Preconditions.make_already_in_message_page()
             conts.open_contacts_page()
             time.sleep(1)
             mp = MessagePage()
             mp.click_phone_contact()
             time.sleep(1)
             try:
                 if conts.is_text_present("发现SIM卡联系人"):
                     conts.click_text("显示")
             except:
                 pass
             for name, number in required_contacts:
                 # 创建联系人
                 conts.create_contacts_if_not_exits(name, number)
             required_group_chats = dataproviders.get_preset_group_chats()
             conts.open_group_chat_list()
             group_list = GroupListPage()
             for group_name, members in required_group_chats:
                 group_list.wait_for_page_load()
                 # 创建群
                 group_list.create_group_chats_if_not_exits(
                     group_name, members)
             group_list.click_back()
             conts.open_message_page()
             return
         except:
             fail_time += 1
             import traceback
             msg = traceback.format_exc()
             print(msg)
    def test_msg_xiaoliping_C_0051(self):
        """单聊会话页面,转发自己发送的图片到陌生人时失败"""

        scp = SingleChatPage()
        # 等待单聊会话页面加载
        scp.wait_for_page_load()
        scp.click_back()
        # 确保当前消息列表没有消息发送失败的标识影响验证结果
        Preconditions.make_no_message_send_failed_status()
        contact_name = "大佬1"
        Preconditions.enter_single_chat_page(contact_name)
        # 确保当前聊天页面已有图片
        Preconditions.make_already_have_my_picture()
        # 等待单聊会话页面加载
        scp.wait_for_page_load()
        # 设置手机网络断开
        # scp.set_network_status(0)
        # 1.长按自己发送的图片并转发
        scp.forward_pic()
        scg = SelectContactsPage()
        # 2.等待选择联系人页面加载
        scg.wait_for_page_load()
        number = "13855558888"
        # 输入陌生手机号码
        scg.input_search_keyword(number)
        time.sleep(2)
        current_mobile().hide_keyboard_if_display()
        # 3.选择陌生号码转发
        scg.click_unknown_member()
        # 确定转发
        scg.click_sure_forward()
        # 4.是否提示已转发,等待单聊页面加载
        self.assertEquals(scp.is_exist_forward(), True)
        scp.wait_for_page_load()
        # 返回到消息页
        scp.click_back()
        mp = MessagePage()
        mp.wait_for_page_load()
        # 5.是否存在消息发送失败的标识
        self.assertEquals(mp.is_iv_fail_status_present(), True)
Esempio n. 6
0
 def test_GGXX_0019(self):
     """管理员发布公告,取消发布,不发布公告"""
     # 1、管理员登录移动端和飞信工作台
     # 2、点击进入【公告信息】页面
     # 3、点击【发布公告】
     # 4、选择发布方式
     # 5、正确填写页面消息
     # 6、点击【发布】按钮
     # 7、点击【取消】按钮
     amp = AnnouncementMessagePage()
     amp.wait_for_page_loads()
     amp.click_text("发布公告")
     time.sleep(2)
     amp.input_title_text("ha6")
     amp.input_content_text("你好啊")
     current_mobile().hide_keyboard()
     time.sleep(2)
     amp.click_element_("发布")
     time.sleep(2)
     amp.click_element_("取消")
     current_mobile().back()
     amp.wait_for_page_loads()
Esempio n. 7
0
 def test_ZZJG_0019(self):
     """搜索已经存在的成员电话(最少输入电话号码前6位)"""
     # 1、点击“组织架构”应用
     # 2、搜索已存在成员电话号码(最少输入电话号码前6位)
     osp = OrganizationStructurePage()
     time.sleep(2)
     osp.wait_for_page_load()
     number = current_mobile().get_cards(CardType.CHINA_MOBILE)[0]
     osp.click_text("搜索")
     osp.input_search_box(number[0:6])
     time.sleep(3)
     if not osp.is_text_present(number):
         raise AssertionError("搜索失败")
Esempio n. 8
0
    def tearDown_test_msg_xiaoliping_B_0048():
        """消息免打扰关闭"""

        mp = MessagePage()
        if not mp.is_on_this_page():
            current_mobile().launch_app()
            mp.wait_for_page_load()
        Preconditions.enter_group_chat_page("群聊1")
        gcp = GroupChatPage()
        gcp.wait_for_page_load()
        gcp.click_setting()
        gcs = GroupChatSetPage()
        gcs.wait_for_page_load()
        time.sleep(2)
        # 关闭消息免打扰
        if gcs.get_switch_undisturb_status():
            gcs.click_switch_undisturb()
            time.sleep(4)
        gcs.click_back()
        gcp.wait_for_page_load()
        gcp.click_back()
        mp.wait_for_page_load()
Esempio n. 9
0
    def tearDown_test_msg_xiaoliping_B_0044():
        """消息免打扰关闭"""

        mess = MessagePage()
        if not mess.is_on_this_page():
            current_mobile().launch_app()
            mess.wait_for_page_load()
        Preconditions.enter_single_chat_page("大佬1")
        scp = SingleChatPage()
        scp.wait_for_page_load()
        scp.click_setting()
        scs = SingleChatSetPage()
        scs.wait_for_page_load()
        time.sleep(2)
        # 关闭消息免打扰
        if scs.is_selected_no_disturb():
            scs.click_no_disturb()
            time.sleep(4)
        scs.click_back()
        scp.wait_for_page_load()
        scp.click_back()
        mess.wait_for_page_load()
Esempio n. 10
0
 def test_msg_hanjiabin_0187(self):
     mess = MessagePage()
     # 点击消息页搜索
     mess.click_search()
     # 搜索关键词给个红包1
     SearchPage().input_search_keyword("给个红包1")
     # 选择联系人进入联系人页
     mess.choose_chat_by_name('给个红包1')
     # 点击消息按钮发送消息
     ContactDetailsPage().click_message_icon()
     chatdialog = ChatNoticeDialog()
     # 若存在资费提醒对话框,点击确认
     if chatdialog.is_exist_tips():
         chatdialog.accept_and_close_tips_alert()
     current_mobile().set_network_status(1)
     single = SingleChatPage()
     single.input_text_message("测试一个呵呵")
     single.send_text()
     time.sleep(2)
     chatwindow = ChatWindowPage()
     chatwindow.click_resend_button()
     current_mobile().set_network_status(6)
Esempio n. 11
0
 def setUpClass(cls):
     # 创建联系人
     fail_time = 0
     import dataproviders
     while fail_time < 3:
         try:
             required_contacts = dataproviders.get_preset_contacts()
             conts = ContactsPage()
             preconditions.connect_mobile(REQUIRED_MOBILES['Android-移动'])
             current_mobile().hide_keyboard_if_display()
             preconditions.make_already_in_message_page()
             for name, number in required_contacts:
                 conts.open_contacts_page()
                 if conts.is_text_present("显示"):
                     conts.click_text("不显示")
                 conts.create_contacts_if_not_exits(name, number)
             return
         except:
             fail_time += 1
             import traceback
             msg = traceback.format_exc()
             print(msg)
Esempio n. 12
0
 def test_GGXX_0022(self):
     """验证未发公告页搜索是否正确"""
     # 1、点击右上角放大镜图标
     # 2、点击搜索栏,输入输入存在的关键字
     # 3、点击搜索
     amp = AnnouncementMessagePage()
     amp.wait_for_page_loads()
     amp.click_text("发布公告")
     time.sleep(2)
     amp.input_title_text("ha6")
     amp.input_content_text("你好啊")
     current_mobile().hide_keyboard()
     time.sleep(2)
     amp.click_element_("保存")
     time.sleep(2)
     amp.click_element_("确定")
     amp.wait_for_page_loads()
     amp.click_element_("未发公告")
     time.sleep(2)
     amp.click_element_("搜索")
     time.sleep(2)
     amp.click_element_("搜索输入框")
     time.sleep(2)
     amp.input_search_text("ha")
     time.sleep(3)
     amp.click_text("搜索")
     time.sleep(2)
     if not amp.is_text_present("ha6"):
         raise AssertionError("搜索不成功")
     amp.click_text("ha6")
     time.sleep(2)
     amp.click_element_("删除")
     time.sleep(2)
     amp.click_element_("确定")
     time.sleep(2)
     amp.click_element_("X")
     wbp = WorkbenchPage()
     wbp.wait_for_page_load()
Esempio n. 13
0
 def make_already_in_call_page():
     """
     前置条件:
     1.已登录客户端
     2.当前在消息页面
     """
     # 如果当前页面是在通话录页,不做任何操作
     call_page = CallPage()
     if call_page.is_on_this_page():
         return
     # 如果当前页面已经是一键登录页,进行一键登录页面
     one_key = OneKeyLoginPage()
     try:
         one_key.wait_until(
             condition=lambda d: one_key.is_text_present('一键登录'),
             timeout=15)
     except:
         pass
     if one_key.is_text_present('一键登录'):
         Preconditions.login_by_one_key_login()
     # 如果当前页不是引导页第一页,重新启动app
     else:
         try:
             current_mobile().terminate_app('com.cmic.college',
                                            timeout=2000)
         except Exception:
             traceback.print_exc()
             pass
         current_mobile().launch_app()
         try:
             call_page.wait_until(
                 condition=lambda d: call_page.is_on_this_page(), timeout=3)
             return
         except TimeoutException:
             pass
         Preconditions.reset_and_relaunch_app()
         Preconditions.make_already_in_one_key_login_page()
         Preconditions.login_by_one_key_login()
Esempio n. 14
0
    def test_Conts_TagsGrouping_0010(self):
        """多方电话"""
        group_name = uuid.uuid4().__str__()
        members = [
            '给个红包1',
            '给个红包2',
        ]
        # 进入标签分组列表页面
        conts_page = ContactsPage()
        conts_page.open_contacts_page()
        conts_page.click_label_grouping()

        # 创建分组
        lg = LabelGroupingPage()
        real_name = lg.create_group(group_name, *members)

        # 进入分组
        lg.wait_for_page_load()
        lg.click_label_group(real_name)

        # 点击多方通话
        detail = LableGroupDetailPage()
        detail.click_multi_tel()

        # 选择联系人
        contacts_selector = ContactsSelector()
        contacts_selector.select_local_contacts(*members)

        mtc = MultipartyCallPage()
        mtc.ignore_tips_if_tips_display()

        # 检查点:进入多方通话主叫页面
        mtc.assert_caller_tips_is_display()

        # 等待来电
        mtc.wait_for_call_back(max_wait_time=16)
        # 挂断电话
        current_mobile().hang_up_the_call()
Esempio n. 15
0
    def test_me_zhangshuli_018(self):
        """分享名片-选择手机联系人-通过姓名关键字或者手机号码搜索自己"""
        mep = MePage()
        #预置本地联系人 本机
        mep.open_contacts_page()
        con = ContactsPage()
        con.click_phone_contact()
        con.click_search_phone_contact()
        phone_number = current_mobile().get_cards(CardType.CHINA_MOBILE)
        con.input_search_keyword(phone_number)
        if con.is_element_present_by_id('本地联系人搜索结果'):
            con.click_back()
        else:
            con.click_add()
            time.sleep(2)
            creat = CreateContactPage()
            creat.click_input_name()
            creat.input_name('本机')
            creat.click_input_number()
            creat.input_number(phone_number[0])
            creat.click_save()
            time.sleep(2)
            ContactDetailsPage().click_back()
            con.click_back()
        #进入通讯录页面
        con.open_me_page()

        # 0.检验是否跳转到我页面,点击进入查看并编辑资料
        self.assertEquals(mep.is_on_this_page(), True)
        mep.click_view_edit()
        mup = MeViewUserProfilePage()
        time.sleep(2)
        # 1.点击分享名片
        mup.page_up()
        mup.click_share_card()
        scp = SelectContactsPage()
        scp.wait_for_page_load()
        time.sleep(2)
        # 2.点击选择一个手机联系人-分享名片
        scp.click_phone_contact()
        time.sleep(2)
        slp = SelectLocalContactsPage()
        slp.click_search_box()
        slp.input_search_keyword('本机')
        slp.click_search_result()
        time.sleep(2)
        # 点击弹框右上角的取消按钮

        # 分享名片
        slp.is_toast_exist('该联系人不可选择')
Esempio n. 16
0
 def enter_voice_announcement_page(reset=False):
     """从消息进入语音通知页面"""
     # 登录进入消息页面
     LoginPreconditions.make_already_in_message_page(reset)
     mess = MessagePage()
     # 从消息进入组织架构页面
     mess.open_workbench_page()
     workbench = WorkbenchPage()
     if workbench.is_on_welcome_page():
         workbench.click_now_create_team()
     else:
         a = 0
         while a < 10:
             workbench.wait_for_page_load()
             workbench.click_voice_notice()
             time.sleep(5)
             if workbench.is_text_present("认证失败"):
                 current_mobile().back()
                 a += 1
             else:
                 break
     vnp = VoiceNoticePage()
     vnp.wait_for_page_loads()
Esempio n. 17
0
    def setUp_test_login_0008(self):
        """测试机登录客户端、辅助机打开到验证码登录页"""
        # A手机已经登录
        Preconditions.select_mobile('Android-移动')
        current_mobile().hide_keyboard_if_display()
        current_mobile().reset_app()
        Preconditions.make_already_in_one_key_login_page()
        one_key = OneKeyLoginPage().wait_for_tell_number_load(60)
        self.login_number = one_key.get_login_number()
        Preconditions.login_by_one_key_login()

        # B手机进入短信登录界面
        Preconditions.select_mobile('Android-电信')
        current_mobile().hide_keyboard_if_display()
        current_mobile().reset_app()
        Preconditions.make_already_in_sms_login_page()
Esempio n. 18
0
 def enter_organization_page(reset=False):
     """从消息进入组织架构页面"""
     # 登录进入消息页面
     LoginPreconditions.make_already_in_message_page(reset)
     mess = MessagePage()
     # 从消息进入组织架构页面
     mess.open_workbench_page()
     workbench = WorkbenchPage()
     if workbench.is_on_welcome_page():
         workbench.click_now_create_team()
     else:
         a = 0
         while a < 20:
             workbench.wait_for_page_load()
             workbench.click_organization()
             # time.sleep(5)
             if not workbench.page_should_contain_text2("添加联系人"):
                 current_mobile().back()
                 a += 1
             else:
                 break
     osp = OrganizationStructurePage()
     osp.wait_for_page_load()
Esempio n. 19
0
 def test_Msg_PrivateChat_VideoPic_0120(self):
     """在单聊会话窗,搜索特殊字符关键字发送趣图"""
     self.delete_media_msg()
     # 1、点击GIF图标
     chat = SingleChatPage()
     gif = ChatGIFPage()
     if gif.is_gif_exist():
         gif.close_gif()
     chat.click_gif()
     gif.wait_for_page_load()
     # 2、搜索框输入关键字
     chars = ['appium', 'xxxx', 'a', '123456', '*']
     # 提示无搜索结果,换个关键词试试
     for msg in chars:
         gif.input_message(msg)
         if gif.is_toast_exist("无搜索结果,换个热词试试", timeout=4):
             gif.input_message("")
             gif.close_gif()
             current_mobile().hide_keyboard_if_display()
             chat.wait_for_page_load()
             return
     raise AssertionError("搜索框输入关键字" + "、".join(chars) +
                          "有gif搜索结果,请换输入关键字试试")
Esempio n. 20
0
 def enter_create_team_page2(reset=False, name="ateam7272"):
     """创建团队及选择团队"""
     mess = MessagePage()
     mess.click_contacts()
     time.sleep(1)
     contact = ContactsPage()
     contact.click_contact_all_team()
     time.sleep(1)
     group_names = contact.get_all_group_name2()
     result = contact.is_contain_group_name(group_names, name)
     contact.click_back_by_android()
     # 当前在联系tab页面
     if not result:
         # 从消息进入创建团队页面
         # 1、不存在ateam7272团队
         mess.open_workbench_page()
         workbench = WorkbenchPage()
         if workbench.is_on_welcome_page():
             workbench.click_now_create_team()
         else:
             workbench.wait_for_page_load()
             workbench.click_create_team()
         team = CreateTeamPage()
         if team.is_on_this_page():
             current_mobile().hide_keyboard_if_display()
         time.sleep(3)
         WorkbenchPreconditions.create_team(name)
         # 进入联系Tab页面
         workbench.open_contacts_page()
         time.sleep(3)
     # 1、保证当前在联系tab页面
     # 2、无论是否存在ateam7272团队,重新选择
     # 3、选择该团队(1、当前没有选择该团队 2、当前已选择该团队)
     contact = ContactsPage()
     contact.click_team_setting_btn()
     contact.choose_team_by_name(name)
     contact.open_message_page()
 def create_sub_department(departmentName="bm0"):
     """从消息列表开始创建子部门并添加部门成员"""
     WorkbenchPreconditions.enter_organization_page()
     osp = OrganizationStructurePage()
     osp.wait_for_page_load()
     osp.click_specify_element_by_name2("添加子部门")
     osp.wait_for_sub_department_page_load()
     osp.input_sub_department_name(departmentName)
     osp.click_specify_element_by_name2("完成")
     time.sleep(2)
     # if osp.is_toast_exist("部门已存在,请勿重复添加"):
     if osp.is_text_present("部门属性"):
         current_mobile().back()
         osp.wait_for_page_load()
     else:
         osp.wait_for_page_load()
         time.sleep(2)
         osp.click_specify_element_by_name(departmentName)
         time.sleep(1)
         osp.click_specify_element_by_name2("添加联系人")
         time.sleep(1)
         osp.click_specify_element_by_name2("从手机通讯录添加")
         time.sleep(2)
         sc = SelectContactsPage()
         slc = SelectLocalContactsPage()
         # 选择联系人
         names = slc.get_contacts_name_list()
         time.sleep(2)
         sc.click_one_contact(names[0])
         sc.click_one_contact(names[1])
         sc.click_one_contact(names[2])
         # slc.click_one_contact("和飞信电话")
         slc.click_sure()
         # if not slc.is_toast_exist("操作成功"):
         #     raise AssertionError("操作不成功")
         time.sleep(2)
         current_mobile().back()
         time.sleep(2)
         if not osp.is_on_this_page():
             raise AssertionError("没有返回上一级")
         time.sleep(2)
         current_mobile().back()
         workbench = WorkbenchPage()
         workbench.wait_for_page_load()
         time.sleep(3)
         current_mobile().back()
         workbench.open_message_page()
Esempio n. 22
0
    def setUpClass(cls):

        Preconditions.select_mobile('Android-移动')
        # 导入测试联系人、群聊
        fail_time1 = 0
        flag1 = False
        import dataproviders
        while fail_time1 < 3:
            try:
                required_contacts = dataproviders.get_preset_contacts()
                conts = ContactsPage()
                current_mobile().hide_keyboard_if_display()
                Preconditions.make_already_in_message_page()
                conts.open_contacts_page()
                try:
                    if conts.is_text_present("发现SIM卡联系人"):
                        conts.click_text("显示")
                except:
                    pass
                for name, number in required_contacts:
                    # 创建联系人
                    conts.create_contacts_if_not_exits(name, number)
                required_group_chats = dataproviders.get_preset_group_chats()
                conts.open_group_chat_list()
                group_list = GroupListPage()
                for group_name, members in required_group_chats:
                    group_list.wait_for_page_load()
                    # 创建群
                    group_list.create_group_chats_if_not_exits(
                        group_name, members)
                group_list.click_back()
                conts.open_message_page()
                flag1 = True
            except:
                fail_time1 += 1
            if flag1:
                break
Esempio n. 23
0
 def test_GGXX_0021(self):
     """管理员发布未发布公告,发布成功"""
     # 1、管理员登录移动端和飞信工作台
     # 2、点击进入【公告信息】页面
     # 3、点击【未发布公告】
     # 4、选中一条未发布公告
     # 5、点击【发布】按钮
     # 6、点击【确定】按钮
     amp = AnnouncementMessagePage()
     amp.wait_for_page_loads()
     amp.click_text("发布公告")
     time.sleep(2)
     amp.input_title_text("ha6")
     amp.input_content_text("你好啊")
     current_mobile().hide_keyboard()
     time.sleep(2)
     amp.click_element_("保存")
     time.sleep(2)
     amp.click_element_("确定")
     amp.wait_for_page_loads()
     amp.click_element_("未发公告")
     time.sleep(2)
     amp.click_text("ha6")
     time.sleep(2)
     amp.click_element_("发布text")
     time.sleep(2)
     amp.click_element_("确定")
     amp.wait_for_page_loads()
     if not amp.is_text_present("ha6"):
         raise AssertionError("公告发布不成功")
     amp.click_text("ha6")
     time.sleep(2)
     amp.click_text("下线")
     time.sleep(2)
     amp.click_element_("确定")
     amp.wait_for_page_loads()
Esempio n. 24
0
    def make_already_in_message_page(reset_required=False):
        """确保应用在消息页面"""

        if not reset_required:
            message_page = MessagePage()
            if message_page.is_on_this_page():
                return
            else:
                try:
                    current_mobile().terminate_app('com.chinasofti.rcs', timeout=2000)
                except:
                    pass
                current_mobile().launch_app()
            try:
                message_page.wait_until(
                    condition=lambda d: message_page.is_on_this_page(),
                    timeout=3
                )
                return
            except TimeoutException:
                pass
        Preconditions.reset_and_relaunch_app()
        Preconditions.make_already_in_one_key_login_page()
        Preconditions.login_by_one_key_login()
 def setUpClass(cls):
     Preconditions.select_mobile('Android-移动')
     Preconditions.make_already_in_message_page()
     # 导入测试联系人、群聊
     fail_time1 = 0
     flag1 = False
     import dataproviders
     while fail_time1 < 2:
         try:
             required_contacts = dataproviders.get_preset_contacts()
             conts = ContactsPage()
             current_mobile().hide_keyboard_if_display()
             Preconditions.make_already_in_message_page()
             conts.open_contacts_page()
             if conts.is_text_present("发现SIM卡联系人"):
                 conts.click_text("显示")
             for name, number in required_contacts:
                 # 创建联系人
                 conts.create_contacts_if_not_exits_new(name, number)
             flag1 = True
         except:
             fail_time1 += 1
         if flag1:
             break
Esempio n. 26
0
 def test_login_0001(self, login_time=60):
     """ 本网非首次登录已设置头像-一键登录页面元素检查"""
     oklp = OneKeyLoginPage()
     # 检查一键登录
     oklp.wait_for_page_load()
     oklp.wait_for_tell_number_load(timeout=60)
     # 检查电话号码
     phone_numbers = current_mobile().get_cards(CardType.CHINA_MOBILE)
     oklp.assert_phone_number_equals_to(phone_numbers[0])
     # 检查 服务协议等待页面进入引导页第一页(自动允许权限)
     oklp.page_should_contain_text("服务条款")
     # 登录
     # oklp.check_the_agreement()
     oklp.click_one_key_login()
     MessagePage().wait_login_success(login_time)
Esempio n. 27
0
 def test_CJTD_0002(self):
     """创建团队"""
     team = CreateTeamPage()
     team.click_back()
     workbench = WorkbenchPage()
     workbench.wait_for_page_load()
     # 有默认的团队,就不创建
     default_team_name = Preconditions.get_team_name()
     workbench.click_enterprise_name_triangle()
     time.sleep(1)
     teams = workbench.get_team_names()
     current_mobile().back()
     if default_team_name in teams:
         print("当前已有团队:" + default_team_name + ",未再创建!")
         workbench.click_create_team()
         team.wait_for_page_load()
         return
     # 点击最底部的“创建团队”
     workbench.click_create_team()
     team.wait_for_page_load()
     Preconditions.create_team()
     # 回到创建团队页面
     workbench.click_create_team()
     team.wait_for_page_load()
 def test_call_zhenyishan_0087(self):
     """通话模块:团队联系人选择页搜索栏--搜索本机号码"""
     # 1、当前为团队联系人选择页
     # Step: 1、在输入框输入本机号码
     cpg = CallPage()
     cpg.click_multi_party_video()
     SelectContactsPage().click_search_he_contact()
     time.sleep(1)
     # CheckPoint:1、默认置灰不可选
     # CheckPoint:2、点击则toast提示:该联系人不可选择
     phone_number = current_mobile().get_cards(CardType.CHINA_MOBILE)[0]
     SelectContactsPage().search(phone_number)
     MultiPartyVideoPage().click_img_icon_contactlist()
     self.assertTrue(cpg.is_toast_exist("该联系人不可选择"))
     cpg.click_back_by_android(2)
Esempio n. 29
0
def capture_screen_shot(path):
    from library.core.utils import applicationcache
    if os.path.isfile(path):
        os.remove(path)
    dir_name, file_name = os.path.split(path)
    if not os.path.isdir(dir_name):
        os.makedirs(dir_name)
    if not isinstance(applicationcache.current_mobile(), NoConnection):
        capture = getattr(applicationcache.current_driver(),
                          'get_screenshot_as_file', lambda p: None)
        try:
            result = capture(path)
            return result
        except:
            return
    return
Esempio n. 30
0
 def add_phone_number_to_department(department_name):
     """添加本机号码到指定部门"""
     osp = OrganizationStructurePage()
     osp.click_specify_element_by_name("添加联系人")
     time.sleep(2)
     osp.click_specify_element_by_name("手动输入添加")
     osp.input_contacts_name("本机测试")
     phone_number = current_mobile().get_cards(CardType.CHINA_MOBILE)[0]
     osp.input_contacts_number(phone_number)
     osp.hide_keyboard()
     # 完成
     osp.click_confirm()
     # 返回4次
     time.sleep(1)
     osp.click_close()
     time.sleep(1)
     osp.click_back()