def tearDown_test_QYTXL_0016(): """恢复环境""" Preconditions.make_already_in_message_page() mp = MessagePage() mp.open_contacts_page() cp = ContactsPage() cp.wait_for_page_load() # 删除指定联系人 cp.click_search_box() name = "陈丹丹" contact_search = ContactListSearchPage() contact_search.wait_for_page_load() contact_search.input_search_keyword(name) if contact_search.is_contact_in_list(name): cp.select_contacts_by_name(name) cdp = ContactDetailsPage() cdp.wait_for_page_load() cdp.click_edit_contact() time.sleep(1) current_mobile().hide_keyboard_if_display() time.sleep(1) cdp.change_delete_number() cdp.click_sure_delete() contact_search.click_back() cp.wait_for_page_load() mp.open_workbench_page() wbp = WorkbenchPage() # 返回工作台 wbp.wait_for_workbench_page_load()
def create_contacts_if_not_exits(self, name, number): """ 导入联系人数据 :param name: :param number: :return: """ from pages import ContactDetailsPage detail_page = ContactDetailsPage() self.wait_for_page_load() # 创建联系人 self.click_search_box() from pages import ContactListSearchPage contact_search = ContactListSearchPage() contact_search.wait_for_page_load() contact_search.input_search_keyword(name) if contact_search.is_contact_in_list(name): contact_search.click_back() else: contact_search.click_back() self.click_add() from pages import CreateContactPage create_page = CreateContactPage() create_page.wait_for_page_load() create_page.hide_keyboard_if_display() create_page.create_contact(name, number) detail_page.wait_for_page_load() detail_page.click_back_icon()
def create_contacts_if_not_exits(self, name, number): """ 导入联系人数据 :param name: :param number: :return: """ from pages import ContactDetailsPage detail_page = ContactDetailsPage() self.wait_for_page_load() # 创建联系人 self.click_search_box() from pages import ContactListSearchPage contact_search = ContactListSearchPage() contact_search.wait_for_page_load() contact_search.input_search_keyword(name) if contact_search.is_contact_in_list(name): contact_search.click_back() else: contact_search.click_back() self.click_element(self.__class__.__locators['联系-手机联系人']) self.click_add() from pages import CreateContactPage create_page = CreateContactPage() create_page.wait_for_page_load() create_page.hide_keyboard_if_display() create_page.create_contact(name, number) detail_page.wait_for_page_load() detail_page.click_back_icon() time.sleep(1) # current_mobile().back() self.click_back()
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_QYTXL_0015(self): """点击搜索结果已保存到本地的本机用户进入联系人详情页""" # 进入企业通讯录首页 Preconditions.enter_enterprise_contacts_page() ecp = EnterpriseContactsPage() # 点击搜索框 ecp.click_search_box() search_number = current_mobile().get_cards(CardType.CHINA_MOBILE)[0] ecp.input_search_message(search_number) time.sleep(2) ecp.click_contacts_by_number(search_number) cdp = ContactDetailsPage() cdp.wait_for_page_load() time.sleep(2) # 确保本机用户已保存到本地 if cdp.is_exists_save_contacts_icon(): cdp.click_save_contacts_icon() ccp = CreateContactPage() ccp.wait_for_page_load() ccp.save_contact() time.sleep(2) # 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_share_card_icon(), True) # 点击分享名片 cdp.click_share_card_icon() scp = SelectContactsPage() scp.wait_for_page_load() scp.click_select_one_group() sog = SelectOneGroupPage() sog.wait_for_page_load() name = "群聊1" # 分享名片到一个普通群 sog.selecting_one_group_by_name(name) time.sleep(2) sog.click_text("发送名片") # 2.是否提示已发送 self.assertEquals(sog.is_toast_exist("已发送"), True) time.sleep(2) # 3.验证消息、电话、语音视频、视频电话、副号拨打(需要提供满足条件的测试号码)、和飞信电话是否置灰,不可点击 self.assertEquals(cdp.message_icon_is_enabled(), False) self.assertEquals(cdp.call_icon_is_enabled(), False) self.assertEquals(cdp.voice_call_icon_is_enabled(), False) self.assertEquals(cdp.video_call_icon_is_enabled(), False) self.assertEquals(cdp.dial_hefeixin_icon_is_enabled(), False) # 返回消息页面验证是否发送成功 cdp.click_back_icon() time.sleep(1) ecp.click_return() time.sleep(1) ecp.click_back() time.sleep(1) ecp.click_back() wbp = WorkbenchPage() wbp.wait_for_workbench_page_load() mp = MessagePage() mp.open_message_page() mp.wait_for_page_load() mp.choose_chat_by_name(name) time.sleep(2) cwp = ChatWindowPage() cwp.wait_for_msg_send_status_become_to('发送成功', 10) gcp = GroupChatPage() # 返回工作台 gcp.click_back() mp.wait_for_page_load() mp.open_workbench_page() wbp.wait_for_workbench_page_load()
def test_QYTXL_0013(self): """点击搜索结果已保存到本地的RCS用户进入联系人详情页""" # 进入企业通讯录首页 Preconditions.enter_enterprise_contacts_page() ecp = EnterpriseContactsPage() # 点击搜索框 ecp.click_search_box() search_name = "大佬1" 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_share_card_icon(), True) # 返回工作台 cdp.click_back_icon() time.sleep(1) ecp.click_return() time.sleep(1) ecp.click_back() time.sleep(1) ecp.click_back() wbp = WorkbenchPage() wbp.wait_for_workbench_page_load()