def setUpClass(cls):
     super().setUpClass()
     # 获取excel
     cls.excel = ReadExcel().read_excel("all_server")
     cls.server_oper = ServerOperating(driver=cls.driver,
                                       excel=cls.excel,
                                       log=cls.log)
Esempio n. 2
0
 def __init__(self, driver, log=None):
     if log is None:
         self.log = Logger("预处理步骤").getlog()
     else:
         self.log = log
     self.driver = driver
     self.excel = ReadExcel().read_excel("common")
     self.operation = Operation(driver, self.log)
     self.by = MobileBy()
Esempio n. 3
0
class TestSearchCompany1(BaseClick):

    a = ReadExcel()
    ELEMENT = a.read_excel("Search_company")

    def searh_keyword(self, keyword):
        '''首页进入搜索中间页搜索关键词'''
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['company_search_box']).click()
        self.operation.new_element(
            MobileBy.IOS_PREDICATE,
            self.ELEMENT['middle_search_box']).send_keys(keyword)

    def go_back(self):
        """返回上一页"""
        self.operation.mobile_drag_to_duration(0.2, 0.5, 0.6, 0.5)

    def get_search_result(self, keyword, way):
        '''获取关键词搜索结果第一家公司名称'''
        self.operation.new_element(
            MobileBy.IOS_PREDICATE,
            self.ELEMENT['middle_search_box']).send_keys(keyword)
        time.sleep(2)
        if way == 1:
            text = self.operation.new_element(
                MobileBy.IOS_CLASS_CHAIN,
                self.ELEMENT['search_result_first1']).text
            return text
        elif way == 2:
            text = self.operation.new_element(
                MobileBy.IOS_CLASS_CHAIN,
                self.ELEMENT['search_result_first2']).text
            return text
        elif way == 3:
            text = self.operation.new_element(
                MobileBy.IOS_CLASS_CHAIN,
                self.ELEMENT['search_result_first3']).text
            return text
        elif way == 4:
            text = self.operation.new_element(
                MobileBy.IOS_CLASS_CHAIN,
                self.ELEMENT['search_result_first4']).text
            return text
        elif way == 5:
            text = self.operation.new_element(
                MobileBy.IOS_CLASS_CHAIN,
                self.ELEMENT['search_result_first5']).text
            return text
        elif way == 6:
            text = self.operation.new_element(
                MobileBy.IOS_CLASS_CHAIN,
                self.ELEMENT['search_result_first6']).text
            return text

    def search_clear(self):
        '''输入框清除'''
        self.operation.new_element(MobileBy.IOS_PREDICATE,
                                   self.ELEMENT['search_clear']).click()

    def test_search_company_01(self):
        '''查公司-首页'''
        self.log.info(self.test_search_company_01.__doc__)

        goal_01 = '首页-输入框文案'
        text_01 = self.operation.new_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['company_search_box']).text
        log.info(text_01)
        self.assertIn('输入公司名称、老板姓名、品牌名称等', text_01, msg='错误-%s' % goal_01)

        goal_02 = '首页-点击搜索框能跳转到搜索中间页'
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['company_search_box']).click()
        result_01 = self.operation.is_element(MobileBy.IOS_PREDICATE,
                                              "name == '发现手机通讯录里的大老板,'")
        self.assertTrue(result_01, msg='错误-%s' % goal_02)
        self.go_back()

    def test_search_company_02(self):
        '''查公司-搜索中间页'''
        self.log.info(self.test_search_company_02.__doc__)

        goal_01 = '搜索中间页-输入框文案'
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['company_search_box']).click()
        text_01 = self.operation.new_element(
            MobileBy.IOS_PREDICATE, self.ELEMENT['middle_search_box']).text
        self.assertEqual(text_01, '输入公司名称、老板姓名、品牌名称等', msg='错误-%s' % goal_01)
        self.go_back()

    def test_search_company_03(self):
        '''查公司-支持搜索范围'''
        self.log.info(self.test_search_company_03.__doc__)

        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['company_search_box']).click()

        goal_01 = "输入公司全称能搜索到公司"
        result = self.get_search_result("北京金堤科技有限公司", 5)
        self.assertEqual(result, "北京金堤科技有限公司", "错误————%s" % goal_01)
        self.search_clear()

        goal_02 = "输入统一信用代码能搜索到公司"
        result = self.get_search_result("9111010831813798XE", 2)
        self.assertEqual(result, "北京金堤科技有限公司", "错误————%s" % goal_02)
        self.search_clear()

        goal_03 = "输入老板名称能搜索到公司"
        result = self.get_search_result("柳超", 6)
        self.assertEqual(result, "北京金堤科技有限公司", "错误————%s" % goal_03)
        self.search_clear()

        goal_04 = "输入关键字能搜索到公司"
        result = self.get_search_result("百度", 5)
        self.assertEqual(result, "北京百度网讯科技有限公司", "错误————%s" % goal_04)
        self.search_clear()

        goal_05 = "输入手机号能搜索到公司"
        result = self.get_search_result("18401651734", 1)
        self.assertEqual(result, "贝壳找房(北京)科技有限公司", "错误————%s" % goal_05)
        self.search_clear()

        goal_06 = "输入座机号能搜索到公司"
        result = self.get_search_result("010-59328108", 1)
        self.assertEqual(result, "北京链家旅居科技服务有限公司", "错误————%s" % goal_06)
        self.search_clear()

        goal_07 = "输入邮箱能搜索到公司"
        result = self.get_search_result("*****@*****.**", 1)
        self.assertEqual(result, "北京高策房地产经纪有限公司", "错误————%s" % goal_07)
        self.search_clear()

        goal_08 = "输入地址能搜索到公司"
        result = self.get_search_result("北京市海淀区西二旗西路2号院35号楼01层102-1", 1)
        self.assertEqual(result, "贝壳找房(北京)科技有限公司", "错误————%s" % goal_08)
        self.search_clear()

        goal_09 = "输入曾用名能搜索到公司"
        result = self.get_search_result("链家网(北京)科技有限公司", 1)
        self.assertEqual(result, "贝壳找房(北京)科技有限公司", "错误————%s" % goal_09)
        self.search_clear()

        goal_10 = "输入英文名能搜索到公司"
        result = self.get_search_result("Beijing Jindi Technology Co.,Ltd.", 4)
        self.assertEqual(result, "北京金堤科技有限公司", "错误————%s" % goal_10)
        self.search_clear()

        goal_11 = "输入域名能搜索到公司"
        result = self.get_search_result("www.tianyancha.com", 4)
        self.assertEqual(result, "北京天眼查科技有限公司", "错误————%s" % goal_11)
        self.search_clear()

        goal_12 = "输入经营范围能搜索到公司"
        result = self.get_search_result("二类6821医用电子仪器设备", 1)
        self.assertEqual(result, "江苏中惠医疗科技股份有限公司", "错误————%s" % goal_12)
        self.search_clear()

        goal_13 = "输入商标名称能搜索到公司"
        result = self.get_search_result("企业秒懂", 2)
        self.assertEqual(result, "北京金堤科技有限公司", "错误————%s" % goal_13)
        self.search_clear()

        goal_14 = "输入专利名称能搜索到公司"
        result = self.get_search_result("软基处理中塑料排水板的锚固装置", 1)
        self.assertEqual(result, "中国二十冶集团有限公司", "错误————%s" % goal_14)
        self.search_clear()

        goal_15 = "输入股东/高管名称能搜索到公司"
        result = self.get_search_result("朱永贵", 3)
        self.assertEqual(result, "中国二十冶集团有限公司", "错误————%s" % goal_15)
        self.search_clear()

        goal_16 = "输入项目名称能搜索到公司"
        result = self.get_search_result("蘑菇街", 5)
        self.assertEqual(result, "杭州卷瓜网络有限公司", "错误————%s" % goal_16)
        self.search_clear()

        goal_17 = "输入股票代码能搜索到公司"
        result = self.get_search_result("601800", 3)
        self.assertEqual(result, "中国交通建设股份有限公司", "错误————%s" % goal_17)
        self.search_clear()

        goal_18 = "输入拼音能搜索到公司"
        result = self.get_search_result("jiaotongjianshegufen", 1)
        self.assertEqual(result, "中国交通建设股份有限公司", "错误————%s" % goal_18)
        self.search_clear()
        self.go_back()

    def test_search_company_04(self):
        '''搜索中间页-输入框+排序'''
        self.log.info(self.test_search_company_03.__doc__)

        goal_01 = '不输入字符时不展示一键清除按钮'
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['company_search_box']).click()
        result_01 = self.operation.is_element(MobileBy.IOS_PREDICATE,
                                              self.ELEMENT['search_clear'])
        self.assertFalse(result_01, msg='错误-%s' % goal_01)

        goal_02 = "不输入字符时输入框右侧能正确展示为'取消'"
        text_02 = self.operation.new_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['top_right_corner1']).text
        self.assertEqual(text_02, '取消', msg='错误-%s' % goal_02)

        goal_03 = "输入一个字符后能正常展示一键清除按钮"
        self.operation.new_element(
            MobileBy.IOS_PREDICATE,
            self.ELEMENT['middle_search_box']).send_keys('a')
        result_03 = self.operation.is_element(MobileBy.IOS_PREDICATE,
                                              self.ELEMENT['search_clear'])
        self.assertTrue(result_03, msg='错误-%s' % goal_03)

        goal_04 = "输入一个字符时输入框右侧能正确展示为'取消'"
        text_04 = self.operation.new_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['top_right_corner1']).text
        self.assertEqual(text_04, '取消', msg='错误-%s' % goal_04)

        goal_05 = "输入关键字后点击一键清除能清空输入框内容"
        self.search_clear()
        text_05 = self.operation.new_element(
            MobileBy.IOS_PREDICATE, self.ELEMENT['middle_search_box']).text
        self.assertEqual(text_05, '输入公司名称、老板姓名、品牌名称等', msg='错误-%s' % goal_05)

        goal_06 = "点击取消能返回首页"
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['top_right_corner1']).click()
        result_06 = self.operation.is_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['company_search_box'])
        self.assertTrue(result_06, msg='错误-%s' % goal_06)

        goal_07 = ["输入两个字符时输入框右侧能正确展示为-排序", "输入两个字符时输入框左侧出现“返回”按钮"]
        self.searh_keyword('百度')
        text_07 = self.operation.new_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['top_right_corner2']).text
        self.assertEqual(text_07, '排序', msg='错误-%s' % goal_07[0])
        result_07 = self.operation.is_element(MobileBy.IOS_PREDICATE,
                                              self.ELEMENT['page_back'])
        self.assertTrue(result_07, msg='错误-%s' % goal_07[1])

        goal_08 = "输入关键词点击排序时默认选项为'默认排序'"
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['top_right_corner2']).click()
        result_08 = self.operation.is_element(MobileBy.IOS_CLASS_CHAIN,
                                              self.ELEMENT['default_sort'])
        self.assertTrue(result_08, msg='错误-%s' % goal_08)

        goal_09 = "点击排序中-按注册资本从高到低"
        self.search_clear()
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['top_right_corner1']).click()
        self.searh_keyword('北京金堤科技有限公司')
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['top_right_corner2']).click()
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['sort_02']).click()
        time.sleep(1)
        text_09_01 = self.operation.new_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['capital_01']).text
        text_09_02 = self.operation.new_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['capital_02']).text
        num_09_01 = re.sub("\D", "", text_09_01)
        num_09_02 = re.sub("\D", "", text_09_02)
        self.assertLess(num_09_02, num_09_01, "错误————%s" % goal_09)

        goal_10 = "点击排序中-按注册资本从低到高"
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['top_right_corner2']).click()
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['sort_03']).click()
        time.sleep(1)
        text_10_01 = self.operation.new_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['capital_01']).text
        text_10_02 = self.operation.new_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['capital_02']).text
        log.info(text_10_01)
        log.info(text_10_02)
        num_10_01 = re.sub("\D", "", text_10_01)
        num_10_02 = re.sub("\D", "", text_10_02)
        self.assertLess(num_10_02, num_10_01, "错误————%s" % goal_10)

        goal_11 = "点击排序中-按成立日期从早到晚"
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['top_right_corner2']).click()
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['sort_04']).click()
        time.sleep(1)
        text_11_01 = self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                                self.ELEMENT['date_01']).text
        text_11_02 = self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                                self.ELEMENT['date_02']).text
        num_11_01 = re.sub("\D", "", text_11_01)
        num_11_02 = re.sub("\D", "", text_11_02)
        self.assertLess(num_11_01, num_11_02, "错误————%s" % goal_11)

        goal_12 = "点击排序中-按成立日期从晚到早"
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['top_right_corner2']).click()
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['sort_05']).click()
        time.sleep(1)
        text_12_01 = self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                                self.ELEMENT['date_01']).text
        text_12_02 = self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                                self.ELEMENT['date_02']).text
        num_12_01 = re.sub("\D", "", text_12_01)
        num_12_02 = re.sub("\D", "", text_12_02)
        self.assertLess(num_12_02, num_12_01, "错误————%s" % goal_12)
Esempio n. 4
0
class TestSearchCompany1(BaseClick):

    a = ReadExcel()
    ELEMENT = a.read_excel("Search_company")

    def searh_keyword(self, keyword):
        '''搜索中间页搜索关键词'''
        self.operation.new_element(
            MobileBy.IOS_PREDICATE,
            self.ELEMENT['middle_search_box']).send_keys(keyword)

    def send_keyword(self, keyword):
        '''搜索中间页搜索关键词(有搜索记录)'''
        self.operation.send(MobileBy.IOS_PREDICATE,
                            self.ELEMENT['middle_search_box'], keyword)

    def go_back(self):
        """返回上一页"""
        self.operation.mobile_drag_to_duration(0.2, 0.5, 0.6, 0.5)

    def go_search_result(self, keyword, way):
        '''进入关键词搜索结果第一家公司'''
        self.operation.new_element(
            MobileBy.IOS_PREDICATE,
            self.ELEMENT['middle_search_box']).send_keys(keyword)
        time.sleep(2)
        if way == 1:
            self.operation.new_element(
                MobileBy.IOS_CLASS_CHAIN,
                self.ELEMENT['search_result_first1']).click()
        elif way == 2:
            self.operation.new_element(
                MobileBy.IOS_CLASS_CHAIN,
                self.ELEMENT['search_result_first2']).click()
        elif way == 3:
            self.operation.new_element(
                MobileBy.IOS_CLASS_CHAIN,
                self.ELEMENT['search_result_first3']).click()
        elif way == 4:
            self.operation.new_element(
                MobileBy.IOS_CLASS_CHAIN,
                self.ELEMENT['search_result_first4']).click()
        elif way == 5:
            self.operation.new_element(
                MobileBy.IOS_CLASS_CHAIN,
                self.ELEMENT['search_result_first5']).click()
        elif way == 6:
            self.operation.new_element(
                MobileBy.IOS_CLASS_CHAIN,
                self.ELEMENT['search_result_first6']).click()

    def go_search_boss_result(self, keyword):
        '''进入关键词搜索结果第一家老板'''
        self.operation.new_element(
            MobileBy.IOS_PREDICATE,
            self.ELEMENT['middle_search_box']).send_keys(keyword)
        self.operation.new_element(MobileBy.IOS_PREDICATE,
                                   self.ELEMENT['search_boss_01']).click()

    def search_clear(self):
        '''输入框清除'''
        self.operation.new_element(MobileBy.IOS_PREDICATE,
                                   self.ELEMENT['search_clear']).click()

    def page_back(self):
        '''页面返回按钮'''
        self.operation.new_element(MobileBy.IOS_PREDICATE,
                                   self.ELEMENT['page_back']).click()

    # @getimage
    # def test_search_company_01(self):
    #     '''搜索中间页-身边老板'''
    #     self.log.info(self.test_search_company_01.__doc__)
    #
    #     goal_01 = '点击通讯录立即查看能进入「身边老板」页面'
    #     self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,self.ELEMENT['company_search_box']).click()
    #     self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,self.ELEMENT['view_now']).click()
    #     check_01 = self.operation.is_element(MobileBy.IOS_PREDICATE,"name == '开启通讯录权限'")
    #     log.info(check_01)
    #     if check_01 == True:
    #         self.operation.new_element(MobileBy.IOS_PREDICATE, "name=='立即开启'").click()
    #         self.operation.new_element(MobileBy.ACCESSIBILITY_ID,"OK").click()
    #         result_01 = self.operation.is_element(MobileBy.ACCESSIBILITY_ID,'身边老板')
    #         self.assertTrue(result_01,msg='错误-%s'%goal_01)
    #     else:
    #         result_01 = self.operation.is_element(MobileBy.ACCESSIBILITY_ID,'身边老板')
    #         self.assertTrue(result_01, msg='错误-%s' % goal_01)
    #
    #     self.go_back()

    def test_search_company_02(self):
        '''搜索中间页-热门搜索&最近搜索&最近浏览交互'''
        self.log.info(self.test_search_company_02.__doc__)

        goal_01 = '点击热门搜索模块能进入对应公司详情页'
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['company_search_box']).click()
        text_01 = self.operation.new_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['hot_search_01']).text
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['hot_search_01']).click()
        campany_name = self.operation.new_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['company_name']).text
        self.assertIn(text_01, campany_name, msg='错误-%s' % goal_01)
        self.page_back()

        goal_02 = '点击最近搜索的记录进入搜索结果页'
        keyword = '腾讯科技'
        self.send_keyword(keyword)
        self.search_clear()
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['recently_search_01']).click()
        text_02 = self.operation.new_element(
            MobileBy.IOS_PREDICATE, self.ELEMENT['middle_search_box']).text
        self.assertEqual(keyword, text_02, msg='错误-%s' % goal_02)
        self.search_clear()

        goal_03 = '有最近搜索记录不展示热门搜索'
        result_03 = self.operation.is_element(MobileBy.IOS_PREDICATE,
                                              "name == '热门搜索'")
        self.assertFalse(result_03, msg='错误-%s' % goal_03)

        goal_04 = "有最近浏览记录不展示热门搜索"
        self.page_back()
        self.search_clear()
        result_04 = self.operation.is_element(MobileBy.IOS_PREDICATE,
                                              "name == '热门搜索'")
        self.assertFalse(result_04, msg='错误-%s' % goal_04)

        goal_05 = "点击最近搜索的一键清除icon弹出确认弹框"
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['clear_01']).click()
        result_05 = self.operation.is_element(MobileBy.ACCESSIBILITY_ID,
                                              '是否清空全部搜索记录?')
        self.assertTrue(result_05, msg='错误-%s' % goal_05)

        goal_06 = "最近搜索-确认弹框中选择取消能返回搜索中间页"
        self.operation.new_element(MobileBy.IOS_PREDICATE,
                                   "name == '取消'").click()
        result_06 = self.operation.is_element(MobileBy.IOS_PREDICATE,
                                              "name == '发现手机通讯录里的大老板,'")
        self.assertTrue(result_06, msg='错误-%s' % goal_06)

        goal_07 = "最近搜索-确认弹框中选择确认能清空最近搜索记录"
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['clear_01']).click()
        self.operation.new_element(MobileBy.IOS_PREDICATE,
                                   "name == '确定'").click()
        result_07 = self.operation.is_element(MobileBy.ACCESSIBILITY_ID,
                                              "最近搜索")
        self.assertFalse(result_07, msg='错误-%s' % goal_07)

        goal_08 = "点击最近浏览的一键清除icon弹出确认弹框"
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['clear_01']).click()
        result_08 = self.operation.is_element(MobileBy.ACCESSIBILITY_ID,
                                              '是否清空全部浏览记录?')
        self.assertTrue(result_08, msg='错误-%s' % goal_08)

        goal_09 = "最近浏览-确认弹框中选择取消能返回搜索中间页"
        self.operation.new_element(MobileBy.IOS_PREDICATE,
                                   "name == '取消'").click()
        result_09 = self.operation.is_element(MobileBy.IOS_PREDICATE,
                                              "name == '发现手机通讯录里的大老板,'")
        self.assertTrue(result_09, msg='错误-%s' % goal_09)

        goal_10 = "最近浏览-确认弹框中选择确认能清空最近浏览记录"
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT['clear_01']).click()
        self.operation.new_element(MobileBy.IOS_PREDICATE,
                                   "name == '确定'").click()
        result_10 = self.operation.is_element(MobileBy.ACCESSIBILITY_ID,
                                              "最近浏览")
        self.assertFalse(result_10, msg='错误-%s' % goal_10)

        goal_11 = "删除最近搜索&最近浏览能展示热门搜索"
        result_11 = self.operation.is_element(MobileBy.IOS_PREDICATE,
                                              "name == '热门搜索'")
        self.assertTrue(result_11, msg='错误-%s' % goal_11)

        self.go_back()

    def test_search_company_03(self):
        '''搜索中间页-最近搜索展示规则'''
        self.log.info(self.test_search_company_03.__doc__)

        goal_01 = "搜索11条关键词查看最近搜索记录(倒序展示,最多展示10条)"
        search_list = [
            "百度1", "百度2", "百度3", "百度4", "百度5", "百度6", "百度7", "百度8", "百度9",
            "百度10", "百度11"
        ]
        self.operation.new_element(MobileBy.IOS_CLASS_CHAIN,
                                   self.ELEMENT["company_search_box"]).click()
        i = 0
        for i in range(len(search_list)):
            self.send_keyword(search_list[i])
            self.search_clear()
            i += 1
        text_01_01 = self.operation.new_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['recently_search_01']).text
        text_01_02 = self.operation.new_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['recently_search_10']).text
        log.info(text_01_01)
        log.info(text_01_02)
        if text_01_01 == search_list[10] and text_01_02 == search_list[1]:
            result_01 = True
        else:
            result_01 = False
        self.assertTrue(result_01, msg='错误-%s' % goal_01)

        goal_02 = "再次搜索相同关键词时查看最近搜索记录"
        self.send_keyword(search_list[10])
        self.search_clear()
        text_02_01 = self.operation.new_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['recently_search_01']).text
        text_02_02 = self.operation.new_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['recently_search_02']).text
        if text_02_01 == search_list[10] and text_02_02 == search_list[9]:
            result_02 = True
        else:
            result_02 = False
        self.assertTrue(result_02, msg='错误-%s' % goal_02)
        self.go_back()

    def test_search_company_04(self):
        '''搜索中间页-最近浏览展示规则'''
        self.log.info(self.test_search_company_04.__doc__)

        goal_01 = ["最近浏览-公司logo", "最近浏览-公司名称", "最近浏览-浏览标签", "最近浏览-删除"]
        self.go_search_result('北京金堤科技有限公司', 5)
        self.page_back()
        self.search_clear()
        result_01_01 = self.operation.is_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['recently_browse_logo'])
        self.assertTrue(result_01_01, msg='错误——%s' % goal_01[0])
        name_text = self.operation.new_element(
            MobileBy.IOS_CLASS_CHAIN,
            self.ELEMENT['recently_browse_name']).text
        self.assertEqual('北京金堤科技有限公司', name_text, msg='错误——%s' % goal_01[1])
        tag_text = self.operation.new_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['recently_browse_tag']).text
        self.assertEqual('今天浏览过', tag_text, msg='错误——%s' % goal_01[2])
        self.operation.is_element(MobileBy.IOS_CLASS_CHAIN,
                                  self.ELEMENT['recently_browse_del']).click()
        result_01_02 = self.operation.is_element(MobileBy.ACCESSIBILITY_ID,
                                                 '最近浏览')
        self.assertTrue(result_01_02, msg='错误——%s' % goal_01[3])

        goal_02 = ["最近浏览-老板logo", "最近浏览-老板名称", "最近浏览-浏览标签", "最近浏览-删除"]
        self.go_search_boss_result('李彦宏')
        self.page_back()
        self.search_clear()
        result_02_01 = self.operation.is_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['recently_browse_logo'])
        self.assertTrue(result_02_01, msg='错误——%s' % goal_02[0])
        name_text = self.operation.new_element(
            MobileBy.IOS_CLASS_CHAIN,
            self.ELEMENT['recently_browse_name']).text
        self.assertEqual('李彦宏', name_text, msg='错误——%s' % goal_02[1])
        tag_text = self.operation.new_element(
            MobileBy.IOS_CLASS_CHAIN, self.ELEMENT['recently_browse_tag']).text
        self.assertEqual('今天浏览过', tag_text, msg='错误——%s' % goal_02[2])
        self.operation.is_element(MobileBy.IOS_CLASS_CHAIN,
                                  self.ELEMENT['recently_browse_del']).click()
        result_02_02 = self.operation.is_element(MobileBy.ACCESSIBILITY_ID,
                                                 '最近浏览')
        self.assertTrue(result_02_02, msg='错误——%s' % goal_02[3])
Esempio n. 5
0
 def setUpClass(cls):
     super().setUpClass()
     # 获取excel
     cls.excel = ReadExcel().read_excel("human_detail")
     cls.user = cls.account.get_account()
     cls.vip_user = cls.account.get_account("vip", "0")