def test_ZZJG_0018(self): """搜索已经存在的成员姓名""" # 1、点击“组织架构”应用 # 2、搜索已存在成员姓名 osp = OrganizationStructurePage() time.sleep(2) osp.wait_for_page_load() slc = SelectLocalContactsPage() if osp.is_text_present("飞信电话"): pass else: osp.click_text("添加联系人") time.sleep(1) osp.click_text("从手机通讯录添加") time.sleep(2) sc = SelectContactsPage() # 搜索联系人 sc.input_search_contact_message("飞信") # 选择“和飞信电话”联系人进行转发 sc.click_one_contact("飞信电话") # slc.click_one_contact("和飞信电话") slc.click_sure() if not slc.is_toast_exist("操作成功"): raise AssertionError("操作不成功") time.sleep(2) if not osp.is_on_this_page(): raise AssertionError("没有返回上一级") osp.click_text("搜索") osp.input_search_box("飞信") time.sleep(2) if not osp.is_text_present("飞信电话"): raise AssertionError("搜索失败")
def default_setUp(self): """进入组织架构页面""" Preconditions.select_mobile('Android-移动') mess = MessagePage() if mess.is_on_this_page(): Preconditions.enter_organization_page() return osp = OrganizationStructurePage() if osp.is_on_this_page(): current_mobile().hide_keyboard_if_display() return else: current_mobile().launch_app() Preconditions.enter_organization_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()