def enter_single_chat_page(name): """进入单聊聊天会话页面""" mp = MessagePage() mp.wait_for_page_load() # 点击 + mp.click_add_icon() # 点击“新建消息” mp.click_new_message() # 提示对话框-start cbp = CalllogBannerPage() if cbp.is_exist_feixin_call_tip(): cbp.click_feixin_call_tip() time.sleep(3) cts = CallTypeSelectPage() if cts.is_text_present("知道了"): cts.click_i_know() # 提示对话框-end 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()
def test_msg_xiaoliping_C_0044(self): """单聊会话页面,转发自己发送的图片给手机联系人""" # 确保当前聊天页面已有图片 Preconditions.make_already_have_my_picture() scp = SingleChatPage() # 等待单聊会话页面加载 scp.wait_for_page_load() # 1.长按自己发送的图片并转发 scp.forward_pic() scg = SelectContactsPage() # 2.等待选择联系人页面加载 scg.wait_for_page_load() # 点击“选择本地联系人”菜单 scg.select_local_contacts() slc = SelectLocalContactsPage() # 等待选择联系人->本地联系人 页面加载 slc.wait_for_page_load() name = "大佬2" # 3.选择一个手机联系人 slc.selecting_local_contacts_by_name(name) # 确定转发 slc.click_sure_forward() # 4.是否提示已转发,等待单聊页面加载 self.assertEquals(scp.is_exist_forward(), True) scp.wait_for_page_load() # 返回到消息页 scp.click_back() time.sleep(2) mp = MessagePage() if not mp.is_on_this_page(): cdp = ContactDetailsPage() cdp.click_back_icon() cp = ContactsPage() cp.wait_for_page_load() cp.open_message_page() # 等待消息页面加载 mp.wait_for_page_load() # 选择刚发送消息的聊天页 mp.choose_chat_by_name(name) time.sleep(2) bcp = BaseChatPage() if bcp.is_exist_dialog(): # 点击我已阅读 bcp.click_i_have_read() # 5.验证是否发送成功 cwp = ChatWindowPage() cwp.wait_for_msg_send_status_become_to('发送成功', 30) # 返回消息页 scp.click_back()
def test_msg_xiaoliping_C_0047(self): """单聊会话页面,转发自己发送的图片给团队联系人""" scp = SingleChatPage() # 等待单聊会话页面加载 scp.wait_for_page_load() # 确保当前聊天页面已有图片 Preconditions.make_already_have_my_picture() # 1.长按自己发送的图片并转发 scp.forward_pic() scg = SelectContactsPage() # 2.等待选择联系人页面加载 scg.wait_for_page_load() # 点击“选择和通讯录联系人”菜单 scg.click_he_contacts() shc = SelectHeContactsDetailPage() # 等待选择联系人->和通讯录联系人 页面加载 shc.wait_for_he_contacts_page_load() # 3.选择一个团队联系人 # 需要考虑测试号码存在多个团队的情况 Preconditions.if_exists_multiple_enterprises_enter_single_chat() name = "大佬3" shc.selecting_he_contacts_by_name(name) # 确定转发 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() # 选择刚发送消息的聊天页 mp.choose_chat_by_name(name) time.sleep(2) chat = BaseChatPage() if chat.is_exist_dialog(): # 点击我已阅读 chat.click_i_have_read() # 5.验证是否发送成功 cwp = ChatWindowPage() cwp.wait_for_msg_send_status_become_to('发送成功', 30) # 返回消息页 scp.click_back()
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()
def test_msg_huangcaizui_B_0035(self): """在单聊页面中非首次点击发送短信按钮是否有短信资费介绍页--无资费介绍""" # 1.网络正常,本网用户 # 2.客户端已登录 # 3.已经使用过发送短信功能,短信设置开关已开启 Preconditions.make_already_have_used_free_sms2() # 4.在单聊会话页面 slc = SelectLocalContactsPage() slc.selecting_local_contacts_by_name("测试号码") # Step: 1.点击下方发送短信按钮 basepg = BaseChatPage() # CheckPoint: 1.直接进入短信编辑页面,无资费介绍页 basepg.page_should_not_contain_text("欢迎使用免费短信") self.assertTrue(basepg.is_exist_exit_sms()) basepg.click_exit_sms() basepg.click_back_by_android()
def test_msg_xiaoliping_C_0050(self): """单聊会话页面,转发自己发送的图片给陌生人""" # 确保当前聊天页面已有图片 Preconditions.make_already_have_my_picture() scp = SingleChatPage() # 等待单聊会话页面加载 scp.wait_for_page_load() # 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() # 选择刚发送消息的陌生联系人 mp.choose_chat_by_name(number) time.sleep(2) bcp = BaseChatPage() if bcp.is_exist_dialog(): # 点击我已阅读 bcp.click_i_have_read() # 5.验证是否发送成功 cwp = ChatWindowPage() cwp.wait_for_msg_send_status_become_to('发送成功', 30) # 返回消息页 scp.click_back()
def test_msg_huangcaizui_B_0039(self): """收藏短信""" # 1.网络正常,本网用户 # 2.客户端已登录 # 3.本机已发送短信 Preconditions.select_contact_send_sms("测试号码") # Step: 1、进入单聊会话页面 Preconditions.enter_single_chat_page("测试号码") # 2、长按短信 basepg = BaseChatPage() basepg.press_mess("测试短信,请勿回复") # 3、点击收藏按钮 basepg.click_collection() # CheckPoint: 短信成功收藏 self.assertTrue(basepg.is_toast_exist("已收藏")) time.sleep(3) if basepg.is_exist_exit_sms(): basepg.click_exit_sms() time.sleep(1) basepg.click_back_by_android()
def test_msg_huangcaizui_B_0037(self): """删除短信""" # 1.网络正常,本网用户 # 2.客户端已登录 # 3.本机已发送短信 Preconditions.select_contact_send_sms("测试号码") # Step: 1、进入单聊会话页面 Preconditions.enter_single_chat_page("测试号码") # 2、长按短信 basepg = BaseChatPage() basepg.press_mess("测试短信,请勿回复") # 3、点击删除按钮 basepg.click_delete() # 4、确认删除(IOS) # SelectLocalContactsPage().click_sure_forward() # CheckPoint: 短信成功删除 basepg.page_should_not_contain_text("测试短信,请勿回复") time.sleep(2) if basepg.is_exist_exit_sms(): basepg.click_exit_sms() time.sleep(1) basepg.click_back_by_android()
def test_msg_huangcaizui_B_0036(self): """转发短信""" # 1.网络正常,本网用户 # 2.客户端已登录 # 3.本机已发送短信 Preconditions.select_contact_send_sms("测试号码") # Step: 1、进入单聊会话页面 Preconditions.enter_single_chat_page("测试号码") # 2、长按短信 basepg = BaseChatPage() basepg.press_mess("测试短信,请勿回复") # 3、点击转发按钮 basepg.click_forward() # CheckPoint: 选择转发会调起联系人选择器,转发短信成功 basepg.page_should_contain_text("选择联系人") # 4、选择转发联系人 SelectContactsPage().search("14775970982") SelectContactsPage().select_one_contact_by_name('测试号码') # 5、点击发送 SelectLocalContactsPage().click_sure_forward() # CheckPoint: 选择转发会调起联系人选择器,转发短信成功 self.assertTrue(basepg.is_toast_exist("已转发")) time.sleep(2) if basepg.is_exist_exit_sms(): basepg.click_exit_sms() time.sleep(1) basepg.click_back_by_android()
def test_msg_huangcaizui_B_0035(self): """在单聊页面中非首次点击发送短信按钮是否有短信资费介绍页--无资费介绍""" # 1.网络正常,本网用户 # 2.客户端已登录 # 3.已经使用过发送短信功能,短信设置开关已开启 Preconditions.make_already_have_used_free_sms() # 4.在单聊会话页面 Preconditions.enter_single_chat_page("测试号码") # Step: 1.点击下方发送短信按钮 basepg = BaseChatPage() basepg.click_free_msg() time.sleep(2) # CheckPoint: 1.直接进入短信编辑页面,无资费介绍页 basepg.page_should_not_contain_text("欢迎使用免费短信") self.assertTrue(basepg.is_exist_exit_sms()) basepg.click_exit_sms() basepg.click_back_by_android()
def test_msg_huangcaizui_B_0024(self): """在单聊页面中非首次点击发送短信按钮是否有短信资费介绍页--网络异常""" # 1.网络异常,本网用户 # 2.客户端已登录 # 3.已经使用过发送短信功能,短信设置开关已开启 Preconditions.make_already_have_used_free_sms() # 4.在单聊会话页面 Preconditions.enter_single_chat_page("测试号码") # Step: 1.点击下方发送短信按钮 basepg = BaseChatPage() time.sleep(3) basepg.click_free_msg() time.sleep(2) # CheckPoint: 1.直接进入短信编辑页面 self.assertTrue(basepg.is_exist_exit_sms()) # Step: 2.编辑好短信,点击发送按钮 basepg.input_free_message("测试短信,请勿回复") basepg.click_send_sms() time.sleep(1) if basepg.is_exist_send_button(): basepg.click_send_button() time.sleep(2) # CheckPoint: 2.短信发送失败,toast提示:网络异常,请检查网络设置(IOS) self.assertTrue(SingleChatPage().is_msg_send_fail()) basepg.click_exit_sms() basepg.click_back_by_android()
def test_msg_huangcaizui_B_0039(self): """收藏短信""" # 1.网络正常,本网用户 # 2.客户端已登录 # 3.本机已发送短信 Preconditions.make_already_have_used_free_sms2() # Step: 1、进入单聊会话页面 slc = SelectLocalContactsPage() slc.selecting_local_contacts_by_name("测试号码") basepg = BaseChatPage() basepg.input_free_message("测试短信,请勿回复") basepg.click_send_sms() time.sleep(2) # 2、长按短信 basepg = BaseChatPage() basepg.press_mess("测试短信,请勿回复") # 3、点击收藏按钮 basepg.click_collection() # CheckPoint: 短信成功收藏 self.assertTrue(basepg.is_toast_exist("已收藏")) time.sleep(3) if basepg.is_exist_exit_sms(): basepg.click_exit_sms() time.sleep(1) basepg.click_back_by_android()
def test_msg_huangcaizui_B_0037(self): """删除短信""" # 1.网络正常,本网用户 # 2.客户端已登录 # 3.本机已发送短信 Preconditions.make_already_have_used_free_sms2() # Step: 1、进入单聊会话页面 slc = SelectLocalContactsPage() slc.selecting_local_contacts_by_name("测试号码") basepg = BaseChatPage() basepg.input_free_message("测试短信,请勿回复") basepg.click_send_sms() time.sleep(2) # 2、长按短信 basepg = BaseChatPage() basepg.press_mess("测试短信,请勿回复") # 3、点击删除按钮 basepg.click_delete() # 4、确认删除(IOS) # SelectLocalContactsPage().click_sure_forward() # CheckPoint: 短信成功删除 basepg.page_should_not_contain_text("测试短信,请勿回复") time.sleep(2) if basepg.is_exist_exit_sms(): basepg.click_exit_sms() time.sleep(1) basepg.click_back_by_android()
def test_msg_huangcaizui_B_0023(self): """在单聊页面中非首次点击发送短信按钮是否有短信资费介绍页""" # 1.网络正常,本网用户 # 2.客户端已登录 # 3.已经使用过发送短信功能,短信设置开关已开启 Preconditions.make_already_have_used_free_sms2() # 4.在单聊会话页面 slc = SelectLocalContactsPage() slc.selecting_local_contacts_by_name("测试号码") # Step: 1.点击下方发送短信按钮 basepg = BaseChatPage() # CheckPoint: 1.直接进入短信编辑页面 self.assertTrue(basepg.is_exist_exit_sms()) # Step: 2.编辑好短信,点击发送按钮 basepg.input_free_message("测试短信,请勿回复") basepg.click_send_sms() time.sleep(1) if basepg.is_exist_send_button(): basepg.click_send_button() time.sleep(2) # CheckPoint: 2.短信发送成功并返回短信编辑页面 self.assertTrue(basepg.is_exist_exit_sms()) basepg.click_exit_sms() basepg.click_back_by_android()
def test_msg_huangcaizui_B_0040(self): """多选,批量转发与删除短信""" # 1.网络正常,本网用户 # 2.客户端已登录 # 3.本机已发送短信 Preconditions.select_contact_send_sms("测试号码") # Step: 1、进入单聊会话页面 Preconditions.enter_single_chat_page("测试号码") # 2、长按短信 basepg = BaseChatPage() basepg.press_mess("测试短信,请勿回复") # 3、点击多选按钮 basepg.click_multiple_selection() time.sleep(1) # CheckPoint: 成功进入多选模式,可批量转发与删除短信 basepg.page_should_contain_text("删除") basepg.page_should_contain_text("转发") time.sleep(1) basepg.click_back_by_android() if basepg.is_exist_exit_sms(): basepg.click_exit_sms() time.sleep(1) basepg.click_back_by_android()
def select_contact_send_sms(name): """选择联系人,发送短信""" Preconditions.make_already_have_used_free_sms() Preconditions.enter_single_chat_page(name) basepg = BaseChatPage() basepg.click_free_msg() time.sleep(2) basepg.input_free_message("测试短信,请勿回复") basepg.click_send_sms() if basepg.is_exist_send_button(): basepg.click_send_button() basepg.click_exit_sms() basepg.click_back_by_android()
def test_msg_huangcaizui_B_0040(self): """多选,批量转发与删除短信""" # 1.网络正常,本网用户 # 2.客户端已登录 # 3.本机已发送短信 Preconditions.make_already_have_used_free_sms2() # Step: 1、进入单聊会话页面 slc = SelectLocalContactsPage() slc.selecting_local_contacts_by_name("测试号码") basepg = BaseChatPage() basepg.input_free_message("测试短信,请勿回复") basepg.click_send_sms() time.sleep(2) # 2、长按短信 basepg = BaseChatPage() basepg.press_mess("测试短信,请勿回复") # 3、点击多选按钮 basepg.click_multiple_selection() time.sleep(1) # CheckPoint: 成功进入多选模式,可批量转发与删除短信 basepg.page_should_contain_text("删除") basepg.page_should_contain_text("转发") time.sleep(1) basepg.click_back_by_android() if basepg.is_exist_exit_sms(): basepg.click_exit_sms() time.sleep(1) basepg.click_back_by_android()
def test_QYTXL_0016(self): """点击搜索结果未保存到本地的RCS用户进入Profile页""" # 进入企业通讯录首页 Preconditions.enter_enterprise_contacts_page() ecp = EnterpriseContactsPage() # 点击搜索框 ecp.click_search_box() search_name = "陈丹丹" ecp.input_search_message(search_name) time.sleep(2) ecp.click_contacts_by_name(search_name) cdp = ContactDetailsPage() cdp.wait_for_page_load() # 1.是否显示用户的详情信息(副号拨打没做验证,需要提供满足条件的测试号码) self.assertEquals(cdp.is_exists_contacts_name(), True) self.assertEquals(cdp.is_exists_contacts_number(), True) self.assertEquals(cdp.is_exists_contacts_image(), True) self.assertEquals(cdp.is_exists_value_by_name("公司"), True) self.assertEquals(cdp.is_exists_value_by_name("职位"), True) self.assertEquals(cdp.is_exists_value_by_name("邮箱"), True) self.assertEquals(cdp.is_exists_message_icon(), True) self.assertEquals(cdp.is_exists_call_icon(), True) self.assertEquals(cdp.is_exists_voice_call_icon(), True) self.assertEquals(cdp.is_exists_video_call_icon(), True) self.assertEquals(cdp.is_exists_dial_hefeixin_icon(), True) self.assertEquals(cdp.is_exists_save_contacts_icon(), True) # 2.点击各个按钮验证(副号拨打没做验证,需要提供满足条件的测试号码) # 点击联系人头像 cdp.click_contacts_image() time.sleep(5) # 验证是否显示大图 self.assertEquals(cdp.is_exists_big_avatar(), True) # 返回 cdp.click_big_avatar() time.sleep(2) # 点击消息图标 cdp.click_message_icon() bcp = BaseChatPage() if bcp.is_exist_dialog(): bcp.click_i_have_read() scp = SingleChatPage() # 等待单聊会话页面加载 scp.wait_for_page_load() scp.click_back() time.sleep(2) # 点击电话图标 cdp.click_call_icon() time.sleep(5) # 验证是否在通话界面 self.assertEquals(cdp.is_phone_in_calling_state(), True) cp = CallPage() # 挂断电话 cp.hang_up_the_call() time.sleep(2) # 点击语音通话图标 cdp.click_voice_call_icon() time.sleep(4) if cdp.is_text_present("继续拨打"): cdp.click_text("继续拨打") time.sleep(4) if cdp.is_text_present("始终允许"): cdp.click_text("始终允许") time.sleep(4) if cdp.is_text_present("暂不开启"): cdp.click_text("暂不开启") time.sleep(2) # 验证是否弹出语音会话弹窗 self.assertEquals(cdp.is_text_present("正在呼叫"), True) # 挂断语音通话 cp.hang_up_voice_call() time.sleep(2) # 点击视频通话图标 cdp.click_video_call_icon() time.sleep(4) if cdp.is_text_present("继续拨打"): cdp.click_text("继续拨打") time.sleep(4) if cdp.is_text_present("暂不开启"): cdp.click_text("暂不开启") time.sleep(2) # 验证是否弹出视频会话弹窗 self.assertEquals(cdp.is_text_present("视频通话呼叫中"), True) # 挂断视频通话 cp.hang_up_video_call() # 点击和飞信电话 cdp.click_hefeixin_call_menu() time.sleep(2) if cdp.is_text_present("我知道了"): cdp.click_text("我知道了") time.sleep(4) if cdp.is_text_present("始终允许"): cdp.click_text("始终允许") time.sleep(4) if cdp.is_text_present("和飞信电话"): cp.hang_up_the_call() time.sleep(4) if cdp.is_text_present("暂不开启"): cdp.click_text("暂不开启") time.sleep(2) # 验证是否拨打和飞信电话 self.assertEquals(cdp.is_text_present("请先接听来电,随后将自动呼叫对方"), True) # 挂断和飞信电话 cp.hang_up_hefeixin_call() time.sleep(2) # 3.点击保存到通讯录按钮,进入编辑联系人页面,验证每个字段都可以编辑并保存成功 cdp.click_save_contacts_icon() ccp = CreateContactPage() ccp.wait_for_page_load() ccp.create_contact("陈丹丹", "13800137004", "test_work", "员工", "*****@*****.**") time.sleep(2) # 是否保存成功 self.assertEquals(cdp.is_exists_share_card_icon(), True) self.assertEquals(cdp.is_exists_save_contacts_icon(), False)
def test_msg_huangcaizui_B_0024(self): """在单聊页面中非首次点击发送短信按钮是否有短信资费介绍页--网络异常""" # 1.网络异常,本网用户 # 2.客户端已登录 # 3.已经使用过发送短信功能,短信设置开关已开启 Preconditions.make_already_have_used_free_sms2() # 4.在单聊会话页面 slc = SelectLocalContactsPage() slc.selecting_local_contacts_by_name("测试号码") # Step: 1.点击下方发送短信按钮 basepg = BaseChatPage() time.sleep(2) # CheckPoint: 1.直接进入短信编辑页面 result = basepg.is_text_present("退出") self.assertTrue(result) # Step: 2.编辑好短信,点击发送按钮 basepg.input_free_message("测试短信,请勿回复") basepg.click_send_sms() time.sleep(1) if basepg.is_exist_send_button(): basepg.click_send_button() time.sleep(2) # CheckPoint: 2.短信发送失败,toast提示:网络异常,请检查网络设置(IOS) self.assertTrue(SingleChatPage().is_msg_send_fail()) basepg.click_exit_sms() basepg.click_back_by_android()