Exemple #1
0
    def test_005_jgq_gjss_p0(self):
        """
        金刚区-进入高级搜索页面
        VIP用户登查看无结果---我也是醉了基金
        """
        log.info(self.test_001_jgq_gjss_p0.__doc__)
        try:
            # 获取普通账号登录
            account = Account()
            acc_vip_name = account.get_account('vip')
            acc_pwd = account.get_pwd()
            log.info("登录普通账号:{},账号密码:{}".format(acc_vip_name, acc_pwd))
            # 登录vip账号
            self.login(phone_num=acc_vip_name, password=acc_pwd)
            self.in_allserver('gjss')
            # 关键字搜索---有限公司
            self.new_find_element(
                By.ID,
                self.ELEMENT['advance_search_keyword_input_et']).send_keys(
                    '我也是醉了基金')
            # 点击「查看结果」
            self.new_find_element(
                By.ID, self.ELEMENT['advance_search_check_result_tv']).click()
            # 进入搜索结果页
            page_title = self.new_find_element(By.ID,
                                               self.ELEMENT['page_title']).text
            log.info("搜素结果页页面title:{}".format(page_title))
            self.assertEqual(page_title, "搜索结果")
            result = self.isElementExist(
                By.ID, self.ELEMENT['advance_search_result_count'])
            self.assertFalse(result)
            no_result = self.new_find_element(
                By.ID, self.ELEMENT['tv_empty_title']).text
            log.info(no_result)
            # 搜索结果页-无结果重新搜索
            ele = self.new_find_element(By.ID,
                                        self.ELEMENT['tv_empty_sub_title'])
            print("-------", print(ele.size))

            # self.driver.tap()
            # time.sleep(5)

            log.info("搜索无结果,点击重新搜索")

            self.logout()
            account.release_account(acc_vip_name, "vip")
        except AssertionError:
            raise self.failureException()
        except Exception as e:
            print(e)
            raise Exception
Exemple #2
0
 def test_002_jgq_gjss_p0(self):
     """
     金刚区-进入高级搜索页面
     用户未登查看结果---调起登录
     普通用户查看结果---开通VIP
     """
     log.info(self.test_001_jgq_gjss_p0.__doc__)
     try:
         self.in_allserver('gjss')
         # 关键字搜索---有限公司
         self.new_find_element(
             By.ID,
             self.ELEMENT['advance_search_keyword_input_et']).send_keys(
                 '有限公司')
         # 点击「查看结果」
         self.new_find_element(
             By.ID, self.ELEMENT['advance_search_check_result_tv']).click()
         log.info("未登录查看结果拉起登录")
         login = self.isElementExist(By.ID, self.ELEMENT['btv_title'])
         self.assertTrue(login)
         # 获取普通账号登录
         account = Account()
         acc_pt_name = account.get_account('account')
         acc_pwd = account.get_pwd()
         log.info("登录普通账号:{},账号密码:{}".format(acc_pt_name, acc_pwd))
         # 登录普通账号
         self.hit_login(account=acc_pt_name, password=acc_pwd)
         # 普通账号没有权限----调起VIP弹框
         VIP = self.new_find_element(By.ID,
                                     self.ELEMENT['tv_top_title']).text
         self.assertEqual(VIP, "开通VIP会员使用高级搜索")
         # 账号退出
         self.logout()
         # 退还账号
         account.release_account(acc_pt_name, "account")
     except AssertionError:
         raise self.failureException()
     except Exception as e:
         print(e)
         raise Exception
Exemple #3
0
 def test_003_jgq_gjss_p0(self):
     """
     金刚区-进入高级搜索页面
     VIP用户登查看结果---
     """
     log.info(self.test_001_jgq_gjss_p0.__doc__)
     try:
         self.in_allserver('gjss')
         # 关键字搜索---有限公司
         self.new_find_element(
             By.ID,
             self.ELEMENT['advance_search_keyword_input_et']).send_keys(
                 '有限公司')
         # 点击「查看结果」
         self.new_find_element(
             By.ID, self.ELEMENT['advance_search_check_result_tv']).click()
         log.info("未登录查看结果拉起登录")
         login = self.isElementExist(By.ID, self.ELEMENT['btv_title'])
         self.assertTrue(login)
         # 获取VIP账号登录
         account = Account()
         acc_vip_name = account.get_account('vip')
         acc_pwd = account.get_pwd()
         log.info("登录VIP账号:{},账号密码:{}".format(acc_vip_name, acc_pwd))
         # 登录vip账号
         self.new_find_element(By.ID, self.ELEMENT['et_phone']).clear()
         self.hit_login(account=acc_vip_name, password=acc_pwd)
         # 登录后进入搜索结果页
         page_title = self.new_find_element(By.ID,
                                            self.ELEMENT['page_title']).text
         log.info("搜素结果页页面title:{}".format(page_title))
         self.assertEqual(page_title, "搜索结果")
         self.logout()
         account.release_account(acc_vip_name, "vip")
     except AssertionError:
         raise self.failureException()
     except Exception as e:
         print(e)
         raise Exception
 def test_004_qbfu_fjgs_p0(self):
     """
     附近公司
     1、筛选
     2、导出数据---目前只做了正常的流程
     3、导航
     4、点击「附近公司」item
     """
     log.info(self.test_004_qbfu_fjgs_p0.__doc__)
     try:
         self.in_allserver('fjgs')
         self.jump_bounced('allow_address')
         a = self.new_find_element(By.ID, self.ELEMENT['page_title']).text
         self.assertEqual(a, '附近公司', msg='页面title不匹配')
         b = self.isElementExist(By.ID, self.ELEMENT['export_data'])
         self.assertTrue(b, msg='「导出数据没有找到」')
         # 公司详情页
         cname = self.new_find_elements(By.ID,
                                        self.ELEMENT['company3'])[0].text
         # cname_status = self.new_find_elements(By.ID, self.ELEMENT['search_reg_status'])[0].text
         self.new_find_elements(By.ID, self.ELEMENT['company3'])[0].click()
         self.jump_bounced('first_btn')
         cname1 = self.new_find_element(By.ID,
                                        self.ELEMENT['company1']).text
         # cname_status_all = self.new_find_elements(By.ID, self.ELEMENT['search_reg_status']).text
         self.assertEqual(cname1,
                          cname,
                          msg='详情页{}-结果页{}不一致'.format(cname1, cname))
         # TODO 标签断言
         # self.assertIn(cname_status, cname_status_all,msg='展示标签应该在公司详情页标签中')
         self.driver.keyevent(4)
         # 导出数据
         self.new_find_element(By.ID, self.ELEMENT['export_data']).click()
         # 获取使用账号
         account = Account()
         acc_vip_name = account.get_account('vip')
         acc_pwd = account.get_pwd()
         log.info("登录VIP账号:".format(acc_vip_name))
         # 使用获取到的账号登录
         self.hit_login(account=acc_vip_name, password=acc_pwd)
         # 选择非增值导出
         self.new_find_element(By.XPATH,
                               self.ELEMENT['free_export']).click()
         self.new_find_element(By.XPATH,
                               self.ELEMENT['email_export']).click()
         self.new_find_element(By.XPATH,
                               self.ELEMENT['email_export']).send_keys(
                                   '*****@*****.**')
         self.new_find_element(By.XPATH,
                               self.ELEMENT['export_click']).click()
         # 成功页回到搜索结果页
         self.new_find_element(By.ID, self.ELEMENT['success_back']).click()
         # 导航
         self.new_find_elements(By.ID,
                                self.ELEMENT['navigation'])[0].click()
         c = self.new_find_element(By.ID, self.ELEMENT['page_title']).text
         self.assertEqual(c, '地图', msg='公司地图导航页')
         # 使用完了要还回去
         account.release_account(acc_vip_name, "vip")
     except AssertionError:
         raise self.failureException()
     except Exception as e:
         print(e)
         raise Exception
 def test_003_qbfw_zdh_p0(self):
     """
     找电话功能正常使用
     1、热门搜索
     2、输入搜索—有结果(点击公司/打电话)
     3、输入搜搜索无结果
     4、筛选 ---未做校验
     5、最近搜索(最多展示10)
     6、一键清除
     7、公司详情页跳转
     8、拨打电话
     """
     log.info(self.test_003_qbfw_zdh_p0.__doc__)
     try:
         self.in_allserver('zdh')
         # 随机点击热搜公司
         hot_search = self.hot_search()
         log.info('点击热搜公司:{}'.format(hot_search))
         legal_person = self.new_find_elements(
             By.ID, self.ELEMENT['legal_person_name'])[0].text
         log.info('法人:{}'.format(legal_person))
         phone = self.new_find_elements(By.ID,
                                        self.ELEMENT['phone_num'])[0].text
         log.info('电话:{}'.format(phone))
         address = self.new_find_elements(
             By.ID, self.ELEMENT['address_ph'])[0].text
         log.info('电话:{}'.format(address))
         cname = self.new_find_elements(By.ID,
                                        self.ELEMENT['company'])[0].text
         legal_name = self.new_find_elements(
             By.ID, self.ELEMENT['legal_person_name'])[0].text
         # 公司详情页跳转
         self.new_find_elements(By.ID, self.ELEMENT['company'])[0].click()
         self.jump_bounced('first_btn')
         time.sleep(2)
         cname1 = self.new_find_element(By.ID,
                                        self.ELEMENT['company1']).text
         legal_name1 = self.new_find_element(
             By.ID, self.ELEMENT['legal_person_name1']).text
         self.assertEqual(cname1, cname, msg='结果页-详情页 公司名称不一致')
         self.assertEqual(legal_name1, legal_name, msg='结果页-详情页 法人名称不一致')
         self.driver.keyevent(4)
         # 导出数据
         self.new_find_element(By.ID, self.ELEMENT['export_data']).click()
         # 获取使用账号
         account = Account()
         acc_vip_name = account.get_account('vip')
         acc_pwd = account.get_pwd()
         log.info("登录VIP账号:".format(acc_vip_name))
         self.hit_login(account=acc_vip_name, password=acc_pwd)
         count = self.count_num(By.ID, self.ELEMENT['search_title'])
         log.info("搜索结果列表页count:{}".format(count))
         # 再次点击导出数据
         self.new_find_element(By.ID, self.ELEMENT['export_data']).click()
         if count > 5000:
             # 选择非增值导出
             self.new_find_element(By.XPATH,
                                   self.ELEMENT['free_export']).click()
             self.new_find_element(By.XPATH,
                                   self.ELEMENT['email_export']).send_keys(
                                       '*****@*****.**')
         else:
             self.new_find_element(By.XPATH,
                                   self.ELEMENT['free_export']).click()
             # self.new_find_element(By.XPATH, self.ELEMENT['email_export']).click()
             self.new_find_element(By.XPATH,
                                   self.ELEMENT['email_export1']).send_keys(
                                       '*****@*****.**')
         self.new_find_element(By.XPATH,
                               self.ELEMENT['export_click']).click()
         # 成功页回到搜索结果页
         self.new_find_element(By.ID, self.ELEMENT['success_back']).click()
         # 拨打电话
         phone_num = self.new_find_elements(
             By.ID, self.ELEMENT['phone_num'])[0].text
         log.info('点击电话:{}'.format(phone_num))
         if phone_num == '暂无信息':
             self.new_find_elements(By.ID,
                                    self.ELEMENT['phone_num'])[1].click()
         else:
             self.new_find_elements(By.ID,
                                    self.ELEMENT['phone_num'])[0].click()
         a = self.isElementExist(By.ID, self.ELEMENT['num_input'])
         self.assertTrue(a, msg='未找到手机拨号页面')
         self.driver.keyevent(4)
         self.driver.keyevent(4)
         # 输入搜搜索无结果-@@
         self.search_clean()
         self.search_input('@@')
         c = self.isElementExist(By.ID, self.ELEMENT['search_title'])
         self.assertFalse(c, msg='标识存在的话是有结果')
         # 输入搜索—有结果 天眼查/85587728
         self.search_clean()
         d = self.search_input('85587728')
         d1 = self.new_find_elements(By.ID,
                                     self.ELEMENT['phone_num'])[0].text
         self.assertIn(d, d1, msg='电话号码in')
         e = self.isElementExist(By.ID, self.ELEMENT['search_title'])
         self.assertTrue(e, msg='标识不存在的话是无结果')
         self.search_clean()
         # 一键清除
         self.search_recent_clear(2)
         f = self.isElementExist(By.ID, self.ELEMENT['search_recent_clear'])
         self.assertTrue(f, msg='一键清除-取消,最近搜索按钮还存在')
         self.search_recent_clear()
         g = self.isElementExist(By.ID, self.ELEMENT['search_recent_clear'])
         self.assertFalse(g, msg='一键清除-确认,最近搜索按钮不存在')
         h = self.isElementExist(By.XPATH, self.ELEMENT['hotsearch_bs'])
         self.assertTrue(h, msg='一键清除不存在,「热门搜素」存在')
         # 最近搜索记录
         name_list = [
             '马云', '孙凯', '王四会', '马丁', '韩磊', '李明', '向小叶', '蓝小凯', '李晓凯',
             '朱小凯', '赵小凯', '陈小凯'
         ]
         for name in name_list:
             log.info('输入搜索词:{}'.format(name))
             self.search_input(name)
             self.search_clean()
         history_words = self.new_find_elements(By.XPATH,
                                                self.ELEMENT['hot_search'])
         for i in range(10):
             log.info("历史:{} vs 输入:{}".format(history_words[i].text,
                                              name_list[11 - i]))
             self.assertEqual(history_words[i].text, name_list[11 - i],
                              '名字顺序不一致')
         # 使用完了要还回去
         account.release_account(acc_vip_name, "vip")
     except AssertionError:
         raise self.failureException()
     except Exception as e:
         print(e)
         raise Exception
Exemple #6
0
    def test_005_taiwan_dwtz_p0(self):
        """
        台湾企业-企业背景-对外投资
        """
        log.info(self.test_005_taiwan_dwtz_p0.__doc__)
        try:
            self.enter_official_information('怡安医疗器材股份有限公司')
            # 获取对外投资 公司详情页count
            foreign_investment_count = self.new_find_element(By.XPATH, self.ELEMENT['foreign_investment_count']).text
            foreign_investment_count = int(foreign_investment_count)
            log.info("对外投资count:{}".format(foreign_investment_count))
            # 进入对外投资模块
            self.new_find_element(By.XPATH, self.ELEMENT["foreign_investment"]).click()
            title_name = self.get_elemengt_text(self.ELEMENT['title_name'])
            log.info("页面title:{}".format(title_name))
            self.assertEqual("对外投资", title_name, msg="页面title不对应")
            # 对外投资 公司/公司跳转
            comp = self.new_find_elements(By.ID, self.ELEMENT['outinvest_company_name_tv'])
            comp_name = comp[0].text # 公司名称
            log.info('对外投资公司:{}'.format(comp_name))
            comp[0].click() # 进入公司详情页
            self.driver.keyevent(4) # 公司详情页回退到对外投资页
            # 法定代表人/人详情跳转
            outinvest_legal_tv = self.new_find_elements(By.ID, self.ELEMENT['outinvest_company_name_tv'])
            outinvest_legal_tv1 = outinvest_legal_tv[0].text
            log.info("法定代表人:{}".format(outinvest_legal_tv1))
            outinvest_legal_tv[0].click() # 进入人详情
            self.driver.keyevent(4)  # 人详情页回退到对外投资页
            # 经营状态
            outinvest_reg_capital_tv = self.new_find_elements(By.ID, self.ELEMENT['outinvest_reg_capital_tv'])
            outinvest_reg_capital_tv1 = outinvest_reg_capital_tv[0].text
            log.info("经营状态:{}".format(outinvest_reg_capital_tv1))
            self.assertTrue(operating_check(1, outinvest_reg_capital_tv1))
            # 投资数额
            tv_outinvest_amount = self.new_find_elements(By.ID, self.ELEMENT['tv_outinvest_amount'])
            tv_outinvest_amount1 = tv_outinvest_amount[0].text
            log.info("投资数额:{}".format(tv_outinvest_amount1))
            self.assertTrue(is_bill_available(tv_outinvest_amount1))
            # 投资比例
            tv_outinvest_ratio = self.new_find_elements(By.ID, self.ELEMENT['tv_outinvest_ratio'])
            tv_outinvest_ratio1 = tv_outinvest_ratio[0].text
            log.info("注册比例:{}".format(tv_outinvest_ratio1))
            self.assertTrue(is_percentage_available(tv_outinvest_ratio1))
            # 成立日期
            tv_outinverst_date = self.new_find_elements(By.ID, self.ELEMENT['tv_outinverst_date'])
            tv_outinverst_date1 = tv_outinverst_date[0].text
            log.info("成立日期:{}".format(tv_outinverst_date1))
            # 股权结构
            tv_outinvest_title_right = self.new_find_elements(By.ID, self.ELEMENT['tv_outinvest_title_right'])
            tv_outinvest_title_right[0].click()

            account = Account()
            acc_vip_name = account.get_account('vip')
            acc_pwd = account.get_pwd()
            log.info("登录VIP账号:{},密码为:{}".format(acc_vip_name, acc_pwd))
            self.login(acc_vip_name, acc_pwd)
            title_name = self.get_elemengt_text(self.ELEMENT['title_name'])
            log.info("页面title:{}".format(title_name))
            self.assertEqual("股权结构", title_name, msg="页面title不对应")
            self.driver.keyevent(4)
            # 对外投资列表页count统计
            foreign_investment_count1 = self.all_count_compute_v1(By.ID, self.ELEMENT['outinvest_company_name_tv'])
            self.assertEqual(foreign_investment_count1, foreign_investment_count)
            account.release_account(acc_vip_name, "vip")
        except AssertionError:
            raise self.failureException()
        except Exception as e:
            log.error(error_format(e))
            raise Exception
 def test_007_foundation_dwtz_p0(self):
     """
     基金会-企业背景-对外投资
     """
     log.info(self.test_007_foundation_dwtz_p0.__doc__)
     try:
         # vip 账号登录登录
         account = Account()
         acc_vip_name = account.get_account('vip')
         acc_pwd = account.get_pwd()
         log.info("登录VIP账号:".format(acc_vip_name))
         self.login(acc_vip_name, acc_pwd)
         self.enter_official_information("上海文化发展基金会")
         self.swipeUp(x1=0.5, y1=0.85, y2=0.65, t=500)
         # 获取对外投资count
         foreign_investment_count = self.new_find_element(
             By.XPATH, self.ELEMENT["foreign_investment_count"]
         ).text
         log.info("对外投资count:{}".format(foreign_investment_count))
         # 进入对外投资
         self.new_find_element(By.XPATH, self.ELEMENT["foreign_investment"]).click()
         page_title = self.new_find_element(By.ID, self.ELEMENT["title_name"]).text
         self.assertEqual(page_title, "对外投资", msg="页面title不一致")
         # 存长图
         save_long_figure = self.new_find_element(By.XPATH, self.ELEMENT["save_long_figure"])
         self.assertIsNotNone(save_long_figure)
         # 分享
         share = self.new_find_element(By.XPATH, self.ELEMENT["share"])
         self.assertIsNotNone(share)
         # 对外投资页-页面字段展示
         # 公司名称
         outinvest_company_name = self.new_find_elements(By.ID, self.ELEMENT["outinvest_company_name"])[1].text
         log.info("公司名称:{}".format(outinvest_company_name))
         # 法定代表人
         outinvest_legal = self.new_find_elements(By.ID, self.ELEMENT["outinvest_legal"])[1].text
         log.info("法定代表人:{}".format(outinvest_legal))
         # 经营状态
         outinvest_reg_capital = self.new_find_elements(By.ID, self.ELEMENT["outinvest_reg_capital"])[1].text
         log.info("经营状态:{}".format(outinvest_reg_capital))
         a = operating_check(1, outinvest_reg_capital)
         self.assertTrue(a)
         # 投资数额
         outinvest_amount = self.new_find_elements(By.ID, self.ELEMENT["outinvest_amount"])[1].text
         log.info("投资数额:{}".format(outinvest_amount))
         a = is_bill_available(outinvest_amount)
         self.assertTrue(a)
         # 投资比例
         outinvest_ratio = self.new_find_elements(By.ID, self.ELEMENT["outinvest_ratio"])[1].text
         log.info("投资比例:{}".format(outinvest_ratio))
         a = is_percentage_available(outinvest_ratio)
         self.assertTrue(a)
         # 成立日期
         outinverst_date = self.new_find_elements(By.ID, self.ELEMENT["outinverst_date"])[1].text
         log.info("成立日期:{}".format(outinverst_date))
         a = check_time(outinverst_date)
         self.assertTrue(a)
         # 公司的跳转
         self.new_find_elements(By.ID, self.ELEMENT["outinvest_company_name"])[1].click()
         comp_name = self.new_find_element(By.ID, self.ELEMENT["comp_name"]).text
         log.info("页面跳转后公司详情页name:{}".format(comp_name))
         self.assertEqual(comp_name, outinvest_company_name)
         self.driver.keyevent(4)
         # 人的跳转
         self.new_find_elements(By.ID, self.ELEMENT["outinvest_legal"])[1].click()
         close_guide(self)
         person_name = self.new_find_element(By.ID, self.ELEMENT["person_name"]).text
         # self.assertEqual(person_name, outinvest_legal)
         self.assertIn(outinvest_legal, person_name)
         self.driver.keyevent(4)
         # 股权机构的跳转
         self.new_find_elements(By.ID, self.ELEMENT["outinvest_title_right"])[1].click()
         title_name = self.new_find_element(By.ID, self.ELEMENT["title_name"]).text
         self.assertEqual(title_name, '股权结构')
         self.driver.keyevent(4)
         # 对外投资页count
         comp_count = self.all_count_compute_v1(By.ID, self.ELEMENT["outinvest_company_name"])
         log.info("对外投资页item展示数量:{}".format(comp_count))
         self.assertEqual(comp_count, int(foreign_investment_count))
         account.release_account(acc_vip_name, "vip")
     except AssertionError:
         raise self.failureException()
     except Exception as e:
         log.error(e)
         raise Exception