Ejemplo n.º 1
0
 def default_setUp(self):
     """确保每个用例运行前在消息页面"""
     Preconditions.select_mobile('Android-移动')
     mess = MessagePage()
     if mess.is_on_this_page():
         return
     else:
         current_mobile().launch_app()
         Preconditions.make_already_in_message_page()
Ejemplo n.º 2
0
 def test_msg_huangcaizui_A_0045(self):
     """消息-消息列表界面+功能页面元素检查"""
     mess = MessagePage()
     # 点击+号
     mess.click_add_icon()
     mess.page_should_contain_text('新建消息')
     mess.page_should_contain_text('发送短信')
     mess.page_should_contain_text('发起群聊')
     mess.page_should_contain_text('群发助手')
     mess.page_should_contain_text('扫一扫')
Ejemplo n.º 3
0
 def test_msg_huangcaizui_A_0078(self):
     """消息-一对一消息会话-设置页面查找不存在的聊天内容"""
     Preconditions.enter_single_chat_page("大佬2")
     single = SingleChatPage()
     mess = MessagePage()
     chat_set = SingleChatSetPage()
     findchat = FindChatRecordPage()
     single.click_setting()
     chat_set.is_on_this_page()
     chat_set.search_chat_record()
     findchat.wait_for_page_loads()
     findchat.input_search_message('ADDWOQWIQWOPPQWIDIWQDQW')
     mess.page_should_contain_element((MobileBy.XPATH, '//*[@text ="无搜索结果"]'))
Ejemplo n.º 4
0
 def make_in_message_page(moible_param, reset=False):
     """确保应用在消息页面"""
     Preconditions.select_mobile(moible_param, reset)
     current_mobile().hide_keyboard_if_display()
     time.sleep(1)
     # 如果在消息页,不做任何操作
     mess = MessagePage()
     if mess.is_on_this_page():
         return
     # 进入一键登录页
     Preconditions.make_already_in_one_key_login_page()
     #  从一键登录页面登录
     Preconditions.login_by_one_key_login()
Ejemplo n.º 5
0
 def test_msg_huangcaizui_A_0100(self):
     """长按消息体是否弹出多功能列表"""
     Preconditions.enter_single_chat_page("大佬2")
     single = SingleChatPage()
     mess = MessagePage()
     # 如果当前页面不存在消息,发送一条消息
     if single._is_element_present((MobileBy.XPATH, '//*[@text ="呵呵哒"]')):
         single.press_mess('呵呵哒')
         mess.click_element((MobileBy.XPATH, '//*[@text ="删除"]'))
     single.input_text_message("呵呵哒")
     single.send_text()
     single.press_mess('呵呵哒')
     single.page_should_contain_text("复制")
     single.page_should_contain_text("转发")
     single.page_should_contain_text("收藏")
     single.page_should_contain_text("撤回")
     single.page_should_contain_text("删除")
     single.page_should_contain_text("多选")
Ejemplo n.º 6
0
 def test_msg_hanjiabin_0195(self):
     """名片消息——单聊——发出名片后--消息界面——长按"""
     mess = MessagePage()
     ChatMorePage().close_more()
     ChatMorePage().click_card()
     SelectContactsPage().click_one_contact_631("给个名片2")
     send_card = Send_CardNamePage()
     send_card.click_share_btn()
     send_card.press_mess('给个名片2')
     mess.click_element((MobileBy.XPATH, '//*[@text="多选"]'))
     mess.page_should_contain_element((MobileBy.XPATH, '//*[@text="删除"]'))
     mess.page_should_contain_element((MobileBy.XPATH, '//*[@text="转发"]'))
     mess.click_element((MobileBy.XPATH, '//*[@text="删除"]'))
Ejemplo n.º 7
0
 def login_by_one_key_login():
     """
     从一键登录页面登录
     :return:
     """
     # 等待号码加载完成后,点击一键登录
     one_key = OneKeyLoginPage()
     one_key.wait_for_page_load()
     # one_key.wait_for_tell_number_load(60)
     one_key.click_one_key_login()
     # if one_key.have_read_agreement_detail():
     #     one_key.click_read_agreement_detail()
     #     # 同意协议
     #     agreement = AgreementDetailPage()
     #     agreement.click_agree_button()
     agreement = AgreementDetailPage()
     time.sleep(1)
     agreement.click_agree_button()
     # 等待消息页
     message_page = MessagePage()
     message_page.wait_login_success(60)
Ejemplo n.º 8
0
 def test_msg_huangcaizui_A_0184(self):
     """聊天会话窗口的批量选择器页面展示"""
     Preconditions.enter_single_chat_page("大佬2")
     mess = MessagePage()
     single = SingleChatPage()
     # 如果当前页面不存在消息,发送一条消息
     if not single._is_element_present((MobileBy.XPATH, '//*[@text ="测试一个呵呵"]')):
         single.input_text_message("测试一个呵呵")
         single.send_text()
     single.press_mess("测试一个呵呵")
     single.click_multiple_selection()
     time.sleep(2)
     group_chat = GroupChatPage()
     # 勾选消息时校验页面元素
     self.assertTrue(group_chat.is_exist_multiple_selection_back())
     mess.page_should_contain_text('已选择')
     self.assertTrue(group_chat.is_exist_multiple_selection_count())
     self.assertTrue(group_chat.is_enabled_multiple_selection_delete())
     self.assertTrue(group_chat.is_enabled_multiple_selection_forward())
     # 未勾选消息时校验页面元素
     group_chat.get_multiple_selection_select_box()[0].click()
     time.sleep(1)
     self.assertTrue(group_chat.is_exist_multiple_selection_back())
     mess.page_should_contain_text('未选择')
     self.assertFalse(group_chat.is_exist_multiple_selection_count())
     self.assertFalse(group_chat.is_enabled_multiple_selection_delete())
     self.assertFalse(group_chat.is_enabled_multiple_selection_forward())
Ejemplo n.º 9
0
 def test_msg_huangcaizui_A_0182(self):
     """自己撤回文本消息,是否会起新的头像"""
     Preconditions.enter_single_chat_page("大佬2")
     single = SingleChatPage()
     mess = MessagePage()
     # 如果当前页面不存在消息,发送一条消息
     if single._is_element_present((MobileBy.XPATH, '//*[@text ="呵呵哒"]')):
         single.press_mess('呵呵哒')
         mess.click_element((MobileBy.XPATH, '//*[@text ="删除"]'))
     single.input_text_message("呵呵哒")
     single.send_text()
     single.press_mess('呵呵哒')
     mess.click_element((MobileBy.XPATH, '//*[@text ="撤回"]'))
     # single.click_i_know()
     time.sleep(3)
     mess.page_should_contain_element((MobileBy.XPATH, '//*[@text ="你撤回了一条信息"]'))
Ejemplo n.º 10
0
    def enter_single_chat_page(name):
        """进入单聊聊天会话页面"""

        mp = MessagePage()
        mp.wait_for_page_load()
        # 点击 +
        mp.click_add_icon()
        # 点击“新建消息”
        mp.click_new_message()
        slc = SelectLocalContactsPage()
        slc.wait_for_page_load()
        # 进入单聊会话页面
        slc.selecting_local_contacts_by_name(name)
        bcp = BaseChatPage()
        if bcp.is_exist_dialog():
            # 点击我已阅读
            bcp.click_i_have_read()
        scp = SingleChatPage()
        # 等待单聊会话页面加载
        scp.wait_for_page_load()
Ejemplo n.º 11
0
 def test_msg_huangcaizui_A_0022(self):
     """免费/发送短信—选择手机联系人"""
     mess = MessagePage()
     # 点击+号
     mess.click_add_icon()
     # 点击免费短信
     mess.click_free_sms()
     mess_call_page = CallPage()
     freemsg = FreeMsgPage()
     # 若存在欢迎页面
     if freemsg.is_exist_welcomepage():
         # 点击确定按钮
         freemsg.click_sure_btn()
         time.sleep(2)
         # 若存在权限控制
         if mess_call_page.is_exist_allow_button():
             # 存在提示点击允许
             mess_call_page.wait_for_freemsg_load()
     mess.click_element((MobileBy.XPATH, '//*[@text ="测试短信1"]'))
     # 判断存在?标志
     FreeMsgPage().wait_is_exist_wenhao()
     # 判断存在退出短信按钮
     FreeMsgPage().wait_is_exist_exit()
Ejemplo n.º 12
0
 def make_already_have_my_group(reset=False):
     """确保有群,没有群则创建群名为mygroup+电话号码后4位的群"""
     # 消息页面
     Preconditions.make_already_in_message_page(reset)
     mess = MessagePage()
     mess.wait_for_page_load()
     # 点击 +
     mess.click_add_icon()
     # 点击 发起群聊
     mess.click_group_chat()
     # 选择联系人界面,选择一个群
     sc = SelectContactsPage()
     times = 15
     n = 0
     # 重置应用时需要再次点击才会出现选择一个群
     while n < times:
         flag = sc.wait_for_page_load()
         if not flag:
             sc.click_back()
             time.sleep(2)
             mess.click_add_icon()
             mess.click_group_chat()
             sc = SelectContactsPage()
         else:
             break
         n = n + 1
     time.sleep(3)
     sc.click_select_one_group()
     # 群名
     group_name = Preconditions.get_group_chat_name()
     # 获取已有群名
     sog = SelectOneGroupPage()
     sog.wait_for_page_load()
     sog.click_search_group()
     time.sleep(2)
     sog.input_search_keyword(group_name)
     time.sleep(2)
     if sog.is_element_exit("群聊名"):
         current_mobile().back()
         time.sleep(2)
         current_mobile().back()
         return
     current_mobile().back()
     time.sleep(2)
     current_mobile().back()
     sog.click_back()
     time.sleep(2)
     sc.click_back()
     mess.wait_for_page_load()
     # 点击 +
     mess.click_add_icon()
     # 点击 发起群聊
     mess.click_group_chat()
     # 从本地联系人中选择成员创建群
     sc.click_local_contacts()
     time.sleep(2)
     slc = SelectLocalContactsPage()
     a = 0
     names = {}
     while a < 3:
         names = slc.get_contacts_name()
         num = len(names)
         if not names:
             raise AssertionError("No contacts, please add contacts in address book.")
         if num == 1:
             sog.page_up()
             a += 1
             if a == 3:
                 raise AssertionError("联系人只有一个,请再添加多个不同名字联系人组成群聊")
         else:
             break
     # 选择成员
     for name in names:
         slc.select_one_member_by_name(name)
     slc.click_sure()
     # 创建群
     cgnp = CreateGroupNamePage()
     cgnp.input_group_name(group_name)
     cgnp.click_sure()
     # 等待群聊页面加载
     GroupChatPage().wait_for_page_load()
Ejemplo n.º 13
0
    def get_into_group_chat_page(name):
        """进入群聊聊天会话页面"""

        mp = MessagePage()
        mp.wait_for_page_load()
        # 点击 +
        mp.click_add_icon()
        # 点击发起群聊
        mp.click_group_chat()
        scg = SelectContactsPage()
        times = 15
        n = 0
        # 重置应用时需要再次点击才会出现选择一个群
        while n < times:
            # 等待选择联系人页面加载
            flag = scg.wait_for_page_load()
            if not flag:
                scg.click_back()
                time.sleep(2)
                mp.click_add_icon()
                mp.click_group_chat()
            else:
                break
            n += 1
        scg.click_select_one_group()
        sog = SelectOneGroupPage()
        # 等待“选择一个群”页面加载
        sog.wait_for_page_load()
        # 选择一个普通群
        sog.selecting_one_group_by_name(name)
        gcp = GroupChatPage()
        gcp.wait_for_page_load()
Ejemplo n.º 14
0
 def go_to_group_double(group_name):
     """从消息列表进入双机群聊,前提:已经存在双机群聊"""
     mess = MessagePage()
     mess.wait_for_page_load()
     mess = MessagePage()
     mess.wait_for_page_load()
     # 点击 +
     mess.click_add_icon()
     # 点击 发起群聊
     mess.click_group_chat()
     # 选择联系人界面,选择一个群
     sc = SelectContactsPage()
     times = 15
     n = 0
     # 重置应用时需要再次点击才会出现选择一个群
     while n < times:
         flag = sc.wait_for_page_load()
         if not flag:
             sc.click_back()
             time.sleep(2)
             mess.click_add_icon()
             mess.click_group_chat()
             sc = SelectContactsPage()
         else:
             break
         n = n + 1
     time.sleep(3)
     sc.click_select_one_group()
     # # 群名
     # group_name = Preconditions.get_group_chat_name_double()
     # 获取已有群名
     sog = SelectOneGroupPage()
     sog.wait_for_page_load()
     sog.click_search_group()
     time.sleep(2)
     sog.input_search_keyword(group_name)
     time.sleep(2)
     if not sog.is_element_exit("群聊名"):
         raise AssertionError("没有找到双机群聊,请确认是否创建")
     sog.click_element_("群聊名")
     gcp = GroupChatPage()
     gcp.wait_for_page_load()
Ejemplo n.º 15
0
 def build_one_new_group_with_number(puhone_number, group_name):
     """新建一个指定成员和名称的群,如果已存在,不建群"""
     # 消息页面
     mess = MessagePage()
     mess.wait_for_page_load()
     # 点击 +
     mess.click_add_icon()
     # 点击 发起群聊
     mess.click_group_chat()
     # 选择联系人界面,选择一个群
     sc = SelectContactsPage()
     times = 15
     n = 0
     # 重置应用时需要再次点击才会出现选择一个群
     while n < times:
         flag = sc.wait_for_page_load()
         if not flag:
             sc.click_back()
             time.sleep(2)
             mess.click_add_icon()
             mess.click_group_chat()
             sc = SelectContactsPage()
         else:
             break
         n = n + 1
     time.sleep(3)
     sc.click_select_one_group()
     # 群名
     # group_name = Preconditions.get_group_chat_name()
     # 获取已有群名
     sog = SelectOneGroupPage()
     sog.wait_for_page_load()
     sog.click_search_group()
     time.sleep(2)
     sog.input_search_keyword(group_name)
     time.sleep(2)
     if sog.is_element_exit("群聊名"):
         current_mobile().back()
         time.sleep(2)
         current_mobile().back()
         return True
     current_mobile().back()
     time.sleep(2)
     current_mobile().back()
     current_mobile().back()
     time.sleep(2)
     current_mobile().back()
     time.sleep(2)
     # 点击 +
     mess.click_add_icon()
     # 点击 发起群聊
     mess.click_group_chat()
     # 添加指定电话成员
     time.sleep(2)
     sc.input_search_keyword(puhone_number)
     time.sleep(2)
     sog.click_text("tel")
     time.sleep(2)
     # 从本地联系人中选择成员创建群
     sc.click_local_contacts()
     time.sleep(2)
     slc = SelectLocalContactsPage()
     SelectContactsPage().click_one_contact_631("飞信电话")
     # a = 0
     # names = {}
     # while a < 3:
     #     names = slc.get_contacts_name()
     #     num = len(names)
     #     if not names:
     #         raise AssertionError("No contacts, please add contacts in address book.")
     #     if num == 1:
     #         sog.page_up()
     #         a += 1
     #         if a == 3:
     #             raise AssertionError("联系人只有一个,请再添加多个不同名字联系人组成群聊")
     #     else:
     #         break
     # # 选择成员
     # for name in names:
     #     slc.select_one_member_by_name(name)
     slc.click_sure()
     # 创建群
     cgnp = CreateGroupNamePage()
     cgnp.input_group_name(group_name)
     cgnp.click_sure()
     # 等待群聊页面加载
     GroupChatPage().wait_for_page_load()
     return False