def delete_department_by_name(department_name): """删除指定部门""" wbp = WorkbenchPage() wbp.wait_for_workbench_page_load() wbp.click_organization() osp = OrganizationStructurePage() n = 1 # 解决工作台不稳定问题 while not osp.page_should_contain_text2("添加联系人"): osp.click_back() wbp.wait_for_workbench_page_load() wbp.click_organization() n += 1 if n > 20: break time.sleep(5) if osp.is_exist_specify_element_by_name(department_name): osp.click_specify_element_by_name(department_name) time.sleep(2) osp.click_specify_element_by_name("更多") time.sleep(2) osp.click_specify_element_by_name("部门设置") time.sleep(2) osp.click_delete() osp.click_sure() osp.click_back() wbp.wait_for_workbench_page_load()
def add_phone_number_to_he_contacts(): """添加本机号码到和通讯录""" wbp = WorkbenchPage() wbp.wait_for_workbench_page_load() wbp.click_organization() osp = OrganizationStructurePage() n = 1 # 解决工作台不稳定问题 while not osp.page_should_contain_text2("添加联系人"): osp.click_back() wbp.wait_for_workbench_page_load() wbp.click_organization() n += 1 if n > 20: break phone_number = current_mobile().get_cards(CardType.CHINA_MOBILE)[0] time.sleep(3) if not osp.is_exist_specify_element_by_name(phone_number): osp.click_specify_element_by_name("添加联系人") time.sleep(2) osp.click_specify_element_by_name("手动输入添加") osp.input_contacts_name("admin") osp.input_contacts_number(phone_number) osp.click_confirm() osp.wait_for_page_load() osp.click_back() wbp.wait_for_workbench_page_load()
def test_QFXS_0011(self): """1、再次点击头像,取消选择人员""" mess = MessagePage() mess.open_workbench_page() wp = WorkbenchPage() wp.wait_for_page_load() # 点击组织架构,添加联系人 wp.click_organization() org=Organization() org.wait_for_page_load() if not org.is_exit_element_by_text_swipe("飞信电话"): org.click_text("添加联系人") time.sleep(2) org.click_text("从手机通讯录添加") sccp = SelectCompanyContactsPage() sccp.wait_for_page_load() # 飞信电话 or 和飞信电话 sccp.click_one_contact("飞信电话") sccp.click_sure() time.sleep(1) org.click_back_by_android() time.sleep(2) org.wait_for_page_load() org.click_back() wp.wait_for_page_load() # 点击群发信使 wp.click_group_messenger() # 等待页面加载 mgp = MessageGroupPage() mgp.wait_for_page_load() # 点击新建短信 mgp.click_build_message() mgp.wait_for_edit_message_page_load() # 点击收件人 mgp.click_addressee() # 点击指定联系人 sccp = SelectCompanyContactsPage() sccp.wait_for_page_load() sccp.click_one_contact("飞信电话") time.sleep(3) sccp.click_text("飞信电话") if sccp.is_left_head_exit(): raise AssertionError("搜索栏左侧被取消人员人名和头像没有被移除") #返回 sccp.click_back() time.sleep(2) if sccp.is_exist_corporate_name(): sccp.click_back_by_android() mgp.wait_for_edit_message_page_load() mgp.click_close()