コード例 #1
0
 def test_QFXS_0010(self):
     """1、搜索不存在的用户名称"""
     mess = MessagePage()
     mess.open_workbench_page()
     wp = WorkbenchPage()
     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()
     import random
     a=str(random.random())
     #搜索框输入不存在用户名
     sccp.input_search_message(a)
     if not sccp.is_toast_exist("无搜索结果"):
         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()
コード例 #2
0
 def test_QFXS_0013(self):
     """1、点击“+”,添加接收人
         2、添加人数小于当前企业剩余条数"""
     mess = MessagePage()
     mess.open_workbench_page()
     wp = WorkbenchPage()
     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("飞信电话")
     if not 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()
コード例 #3
0
 def test_QFXS_0008(self):
     """1、点击用户本人头像"""
     mess = MessagePage()
     mess.open_workbench_page()
     wp = WorkbenchPage()
     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()
     phone_number = current_mobile().get_cards(CardType.CHINA_MOBILE)[0]
     sccp.click_text(phone_number)
     if not sccp.is_toast_exist("该联系人不可选"):
         raise AssertionError("没有toast提示该联系人不可选")
     sccp.click_back()
     time.sleep(2)
     sccp.click_back()
     mgp.wait_for_edit_message_page_load()
     mgp.click_close()
コード例 #4
0
    def test_QFXS_0043(self):
        """点击顶部关闭按钮退出到工作台页面"""

        gmp = GroupMessengerPage()
        # 等待群发信使首页加载
        gmp.wait_for_page_load()
        # 确保有【x】控件可点击
        try:
            gmp.click_new_message()
            nmp = NewMessagePage()
            # 等待群发信使->新建短信页面加载
            nmp.wait_for_page_load()
        except:
            gmp.click_back_by_android()
            gmp.click_new_message()
            nmp = NewMessagePage()
            # 等待群发信使->新建短信页面加载
            nmp.wait_for_page_load()
        nmp.click_close()
        wbp = WorkbenchPage()
        # 1.等待工作台页面加载
        wbp.wait_for_workbench_page_load()
        wbp.click_group_messenger()
        # 等待群发信使首页加载
        gmp.wait_for_page_load()
コード例 #5
0
 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()
コード例 #6
0
    def test_QFXS_0012(self):
        """用户同时在两个部门下"""

        gmp = GroupMessengerPage()
        # 等待群发信使首页加载
        gmp.wait_for_page_load()
        # 确保用户在企业部门下
        gmp.click_back()
        wbp = WorkbenchPage()
        # 添加本机号码到指定部门1
        department_name1 = "admin_department1"
        Preconditions.add_phone_number_to_department(department_name1)
        # 添加本机号码到指定部门2
        department_name2 = "admin_department2"
        Preconditions.add_phone_number_to_department(department_name2)
        workbench_name = wbp.get_workbench_name()
        # 解决用户部门变更后不能及时刷新的问题
        wbp.click_company_contacts()
        ecp = EnterpriseContactsPage()
        ecp.wait_for_page_load()
        time.sleep(2)
        ecp.click_back()
        time.sleep(2)
        if ecp.is_exist_department_name():
            ecp.click_back()
        wbp.wait_for_workbench_page_load()
        wbp.click_group_messenger()
        gmp.wait_for_page_load()
        gmp.click_new_message()
        nmp = NewMessagePage()
        # 等待群发信使->新建短信页面加载
        nmp.wait_for_page_load()
        nmp.click_add_icon()
        sccp = SelectCompanyContactsPage()
        # 等待群发信使->新建短信->选择联系人页面加载
        sccp.wait_for_page_load()
        # 1.跳转后是否显示企业层级:企业+部门名称(部门随机显示一个)
        self.assertEquals(sccp.is_exist_corporate_grade(), False)
        self.assertEquals(sccp.is_exist_department_by_name(workbench_name),
                          True)
        self.assertEquals(
            (sccp.is_exist_department_by_name(department_name1)
             or sccp.is_exist_department_by_name(department_name2)), True)
        sccp.click_back()
        nmp.wait_for_page_load()
        nmp.click_back()
        # 等待群发信使首页加载
        gmp.wait_for_page_load()
コード例 #7
0
    def test_QFXS_0011(self):
        """用户在企业部门下又在企业子一层级中,直接进入企业层级"""

        gmp = GroupMessengerPage()
        # 等待群发信使首页加载
        gmp.wait_for_page_load()
        # 确保用户既在企业部门下又在企业子一层级
        gmp.click_back()
        wbp = WorkbenchPage()
        # 添加本机号码到指定部门
        department_name = "admin_department"
        Preconditions.add_phone_number_to_department(department_name)
        # 添加本机号码到和通讯录
        Preconditions.add_phone_number_to_he_contacts()
        workbench_name = wbp.get_workbench_name()
        # 解决用户部门变更后不能及时刷新的问题
        wbp.click_company_contacts()
        ecp = EnterpriseContactsPage()
        ecp.wait_for_page_load()
        time.sleep(2)
        ecp.click_back()
        time.sleep(2)
        if ecp.is_exist_department_name():
            ecp.click_back()
        wbp.wait_for_workbench_page_load()
        wbp.click_group_messenger()
        gmp.wait_for_page_load()
        gmp.click_new_message()
        nmp = NewMessagePage()
        # 等待群发信使->新建短信页面加载
        nmp.wait_for_page_load()
        nmp.click_add_icon()
        sccp = SelectCompanyContactsPage()
        # 等待群发信使->新建短信->选择联系人页面加载
        sccp.wait_for_page_load()
        # 1.是否直接进入企业层级:企业+部门名称
        self.assertEquals(sccp.is_exist_corporate_grade(), False)
        self.assertEquals(sccp.is_exist_department_by_name(workbench_name),
                          True)
        self.assertEquals(sccp.is_exist_department_by_name(department_name),
                          True)
        sccp.click_back()
        nmp.wait_for_page_load()
        nmp.click_back()
        # 等待群发信使首页加载
        gmp.wait_for_page_load()
コード例 #8
0
    def enter_group_messenger_page():
        """进入群发信使首页"""

        mp = MessagePage()
        mp.wait_for_page_load()
        mp.click_workbench()
        wbp = WorkbenchPage()
        wbp.wait_for_workbench_page_load()
        # 查找并点击所有展开元素
        wbp.find_and_click_open_element()
        wbp.click_add_group_messenger()
        n = 1
        # 解决工作台不稳定问题
        while not wbp.page_should_contain_text2("新建短信"):
            wbp.click_group_messenger()
            n += 1
            if n > 20:
                break
コード例 #9
0
    def tearDown_test_QFXS_0012():
        """恢复环境"""

        fail_time = 0
        while fail_time < 5:
            try:
                Preconditions.make_already_in_message_page()
                mp = MessagePage()
                mp.open_workbench_page()
                wbp = WorkbenchPage()
                Preconditions.delete_department_by_name("admin_department1")
                Preconditions.delete_department_by_name("admin_department2")
                workbench_name = wbp.get_workbench_name()
                # 查找并点击所有展开元素
                wbp.find_and_click_open_element()
                # 解决用户部门变更后不能及时刷新的问题
                wbp.click_company_contacts()
                ecp = EnterpriseContactsPage()
                ecp.wait_for_page_load()
                if ecp.is_exist_department_by_name(workbench_name):
                    ecp.click_corporate_by_name(workbench_name)
                time.sleep(2)
                ecp.click_back()
                sccp = SelectCompanyContactsPage()
                time.sleep(2)
                if sccp.is_exist_department_name():
                    ecp.click_back()
                wbp.wait_for_workbench_page_load()
                wbp.click_group_messenger()
                n = 1
                # 解决工作台不稳定问题
                while not wbp.page_should_contain_text2("新建短信"):
                    wbp.click_group_messenger()
                    n += 1
                    if n > 20:
                        break
                return
            except:
                fail_time += 1