class PersonsBank(unittest.TestCase):
	"""登录系统切换到人物库"""

	def setUp(self) -> None:
		self.lo = LoggIn()
		driver = BaseDriver().getdriver()
		self.c = Commonlib(driver)
		self.c.solv_log_waring()
		self.pbb = PersonsBankBusiness(driver)
		self.lob = LoginBussiness(driver)

	def tearDown(self) -> None:
		pass

	@parameterized.expand(bulid_data)
	def test_person_colum(self,username,pwd,expect,is_sucess):
		try:
			if is_sucess:
				text_list = []
				self.lob.logoin(username,pwd)
				self.pbb.person_index()
				famous_text = self.pbb.pbh.get_famouspersion_text()
				text_list.append(famous_text)
				unknow_text = self.pbb.pbh.get_unknownpersion_text()
				text_list.append(unknow_text)
				print("生成列表为---->%s"%text_list)
				self.assertEqual(text_list,expect)
				return text_list
		except Exception as e:
			self.lo.logg_out(e)
			self.c.get_screen_shot("test_person_colum")
class SearchFamousPersonsInfo(unittest.TestCase):
    """名人详细信息"""
    def setUp(self) -> None:
        self.lo = LoggIn()
        driver = BaseDriver.getdriver()
        self.c = Commonlib(driver)
        self.c.solv_log_waring()
        self.pbb = PersonsBankBusiness(driver)
        self.lgin = LoginBussiness(driver)

    def tearDown(self) -> None:
        pass

    @parameterized.expand(bulid_data)
    def test_get_famousperson_info(self, username, pwd, value, is_sucess):
        """拿到著名人物的信息"""
        try:
            self.lgin.logoin(username, pwd)
            self.pbb.search_name_person(value)
            if is_sucess:
                search_list = []
                search_name = self.pbb.pbh.get_famoussion_name_text()
                search_list.append(search_name)
                search_china_name = self.pbb.pbh.get_china_name_text()
                search_list.append(search_china_name)
                search_foreign_name = self.pbb.pbh.get_forgin_name_text()
                search_list.append(search_foreign_name)
                search_gender = self.pbb.pbh.get_famous_gender_text()
                search_list.append(search_gender)
                search_nation = self.pbb.pbh.get_famous_nation_text()
                search_list.append(search_nation)
                search_party = self.pbb.pbh.get_famous_party_text()
                search_list.append(search_party)
                search_university = self.pbb.pbh.get_university_name_text()
                search_list.append(search_university)
                search_homeaddr = self.pbb.pbh.get_homeaddres_text()
                search_list.append(search_homeaddr)
                search_persion = self.pbb.pbh.get_position_text()
                search_list.append(search_persion)

                # self.assertEqual(expect,search_list)
                print("输入搜索值为---->%s,搜索到结果为%s" % (value, search_list))
            else:
                error_info = self.pbb.pbh.get_send_errorkeywords_text()
                print("输入搜索值---->%s后搜索到结果为--->%s" % (value, error_info))

        except Exception as e:
            self.lo.logg_out(e)
            self.c.get_screen_shot("test_get_famousperson_info")
class YinShiPinBusiness:
    """音视频业务分类"""
    def __init__(self, driver):
        self.lo = LoggIn()
        self.c = Commonlib(driver)
        self.login = LoginBussiness(driver)
        self.yinsp = YinshiPinHandle(driver)

    def yin_shipin_index(self, username, pwd):
        # titlelist = []
        self.lo.logg_out("登录音视频前台")
        self.login.logoin(username, pwd)
        self.c.wait_time(3)

        self.lo.logg_out("打开音视频栏目")
        self.yinsp.click_yinship()
        self.c.wait_time(2)
Exemple #4
0
 def test_load_video_login(self, username, pwd, expect, is_sucess):
     """登录成功拿到页面文字' 视频管理',登录失败停留在登录页面拿到文字‘声像情报分析系统’"""
     try:
         LoggIn.logg_out("准备登录上传视频登录页面")
         self.b.loadvideologin(username, pwd)
         if is_sucess:
             textsucess = self.b.loginhandle.log_sucess_text()
             print("登录成功后断言为------>%s" % textsucess)
             return textsucess
             #断言,"视频管理"
             self.assertEqual(textsucess, expect)
         else:
             # textfail = self.busi_loadvd_login.loginhandle.login_fail_text()
             textfail = self.b.loginhandle.login_fail_text()
             print("登录失败后停留在登录页面断言为---->%s" % textfail)
             self.assertEqual(textfail, expect)
             return textfail
             #断言  “声像情报分析系统”
     except Exception as e:
         self.c.get_screen_shot("test_load_video_login")
         print(e)
class YinShiPinTest(unittest.TestCase):
    """点击音视频栏目,拿到下面子栏目的title"""
    def setUp(self) -> None:
        self.lo = LoggIn()
        driver = BaseDriver().getdriver()
        self.c = Commonlib(driver)
        self.c.solv_log_waring()
        self.b = YinShiPinBusiness(driver)

    def tearDown(self) -> None:
        self.c.wait_time(2)
        self.c.quit_broswer()

    @parameterized.expand(bulid_data)
    def test_yinshi_colum(self, username, pwd, expect, is_sucess):
        """拿到音视频下的子栏目的三个值"""
        try:
            if is_sucess:
                titlelist = []
                self.b.yin_shipin_index(username, pwd)

                text_shishiredian = self.b.yinsp.text_shisrd_title()
                titlelist.append(text_shishiredian)

                text_neiwangzibian = self.b.yinsp.text_neiwzb_title()
                titlelist.append(text_neiwangzibian)

                text_waiwangziyuan = self.b.yinsp.text_waiwang_title()
                titlelist.append(text_waiwangziyuan)

                text_guanzhu = self.b.yinsp.text_wodeguanzhu_title()
                titlelist.append(text_guanzhu)

                self.assertEqual(titlelist, expect)
                print("点击音视频库后下子栏目为---->%s" % titlelist)
                return titlelist

        except Exception as e:
            self.lo.logg_out(e)
            self.c.get_screen_shot("test_yinshi_colum")
Exemple #6
0
class PersonsBankBusiness:
    """人物库业务层"""
    def __init__(self, driver):
        # self.driver = driver
        self.lo = LoggIn()
        self.c = Commonlib(driver)
        self.login = LoginBussiness(driver)  #登录
        self.pbh = PersonsBankHandle(driver)

    def person_index(self):
        """切换到人物库"""
        # self.login.logoin("admin","111111")
        self.lo.logg_out("点击人物库,切换到人物库首页,")
        self.pbh.click_persion_bank()
        self.c.wait_time(2)

    def search_name_person(self, value):
        #输入名称,搜索知名人物
        # search_list = []
        self.person_index()
        self.pbh.input_person_name(value)
        self.c.wait_time(5)
        self.pbh.click_search_btn_ele()
        self.c.wait_time(5)
class LoginTest(unittest.TestCase):
    """登录测试案例正例反例"""
    def setUp(self) -> None:
        self.dr = BaseDriver().getdriver()
        self.common = Commonlib(self.dr)
        self.lo = LoggIn()
        self.lo.logg_out("------------->打开浏览器运行--%s--这个类" % LoginTest)
        self.common.solv_log_waring()
        self.businesslogin = LoginBussiness(self.dr)

    def tearDown(self) -> None:
        self.common.wait_time(5)
        self.common.quit_broswer()
        self.lo.logg_out(">-----------关闭浏览器")

    @parameterized.expand(bulid_data)
    def test_login(self, username, pwd, expect, is_sucess):
        """登录"知音晓视"正例和反例  登录成功,拿到"声像情报融合分析平台",不成功则停留在主页 '声像情报分析系统'"""
        try:
            self.businesslogin.logoin(username, pwd)
            if is_sucess:
                """登录成功就返回主页信息"""
                text = self.businesslogin.loghandle.login_sucess_text()
                self.lo.logg_out("登录成功后进入主页面,主页面标题为---->%s" % text)
                print("登录成功后进入主页面,主页面标题为---->%s" % text)
                self.assertEqual(text, expect)
                return text
                #断言  "声像情报融合分析平台"
            else:
                # """登录失败,就停在登录主页"""
                texttwo = self.businesslogin.loghandle.login_fail_text()
                self.lo.logg_out("密码错误登录失败停留在登录页面文字为--->%s" % texttwo)
                print("密码错误登录失败停留在登录页面文字为--->%s" % texttwo)
                self.assertEqual(texttwo, expect)
                return texttwo
                #断言    "声像情报分析系统"
        except Exception as e:
            self.common.get_screen_shot("test_login")
Exemple #8
0
class UpLoadVideoTest(unittest.TestCase):
    """上传正常格式视频和非正常格式视频"""
    def setUp(self) -> None:
        self.lo = LoggIn()
        self.dr = BaseDriver().getdriver()
        self.c = Commonlib(self.dr)
        self.c.solv_log_waring()
        self.b = UpLoadVideoBusiness(self.dr)

    def tearDown(self) -> None:
        self.c.wait_time(20)
        self.c.quit_broswer()

    @parameterized.expand(bulid_data)
    def test_up_load_video_type(self, username, pwd, expect, is_sucess):
        try:
            self.b.up_load_video(username, pwd)
            if is_sucess:
                self.b.up_load_sucess_type_video()
                loadvideo_sucess_text = self.b.upldhandle.get_sucess_upload_video_text(
                )
                return loadvideo_sucess_text
                #断言为---->本地上传
                self.lo.logg_out("视频上传完毕,上传页面text为---->%s" %
                                 loadvideo_sucess_text)
                self.assertEqual(loadvideo_sucess_text, expect)
            else:
                self.b.up_load_erroe_type_video()
                loadvideo_fail_text = self.b.upldhandle.get_fiali_upload_video_text(
                )
                self.lo.logg_out("上传视频格式不正确,弹出弹框文字为--->%s" %
                                 loadvideo_fail_text)
                print("上传视频格式不正确,弹出弹框文字为--->%s" % loadvideo_fail_text)
                self.assertEqual(loadvideo_fail_text, expect)
                return loadvideo_fail_text

        except Exception as e:
            self.lo.logg_out(e)
            self.b.common.get_screen_shot("test_up_load_video_type")
Exemple #9
0
 def openbaidu(self):
     LoggIn.logg_out("打开浏览器")
     self.dr = webdriver.Chrome()
     LoggIn.logg_out("打开百度")
     self.dr.get("http:www.baidu.com")
    def up_load_sucess_type_video(self):
        """上传正确的视频格式"""
        videoname = random.choice(videolist)
        allpath = filepath + '\\' + videoname
        #第三方上传视频工具  + 正常视频上传路径
        os.system(r"C:\Users\Test\ruanjian\Autoitupload-filr\upload.exe  %s" %
                  allpath)
        self.common.wait_time(2)

        LoggIn.logg_out("选择外网资源")
        self.upldhandle.click_waiwang_btn()

        LoggIn.logg_out("选择频道分类")
        self.common.wait_time(2)
        self.upldhandle.click_pindao_btn()

        LoggIn.logg_out("随机选取一个栏目--人工智能、电子对抗、区块链")
        self.common.wait_time(3)
        self.upldhandle.click_fenlei_lanmu()

        LoggIn.logg_out("选择语言栏目")
        self.common.wait_time(2)
        self.upldhandle.click_langue_btn()

        LoggIn.logg_out("随机选择语言")
        self.common.wait_time(2)
        self.upldhandle.click_choice_langue_btn()

        LoggIn.logg_out("清除制作日期,重新输入当期日期")
        self.common.wait_time(2)
        self.upldhandle.clear_make_data_btn()
        self.common.wait_time(2)
        self.upldhandle.send_make_data_btn()
        self.common.wait_time(1)
        self.upldhandle.click_index()

        LoggIn.logg_out("清除上传日期,重新上传当天日期")
        self.common.wait_time(2)
        self.upldhandle.clear_upload_data()
        self.common.wait_time(2)
        self.upldhandle.send_upload_data_btn()
        self.upldhandle.click_index()

        LoggIn.logg_out("点击index首页切换,点击摘要输入框,输入内容摘要")
        self.common.wait_time(2)
        self.upldhandle.click_index()
        self.common.wait_time(2)
        self.upldhandle.click_index()
        self.upldhandle.input_content()

        LoggIn.logg_out("导入视频按钮")
        self.common.wait_time(2)
        self.upldhandle.import_video_btn()

        LoggIn.logg_out("关闭上传视频弹窗按钮")
        self.common.wait_time(2)
        self.upldhandle.click_alter_ele()

        #查看处理过程按钮
        self.common.wait_time(2)
        self.upldhandle.click_sucess_process()

        LoggIn.logg_out("视频上传完毕")
        self.common.wait_time(2)
class UpLoadVideoBusiness:
    """上传视频业务层"""
    def __init__(self, driver):
        # self.basedriver = BaseDriver()
        # driver = self.basedriver.getdriver()
        self.lo = LoggIn()
        self.common = Commonlib(driver)
        self.loginbusi = LoadVideoBussiness(driver)
        self.upldhandle = UpLoadVideoHandle(driver)

    def up_load_video(self, username, pwd):
        """登录后台"""
        self.lo.logg_out("打开浏览器,登录后台上传视频")
        self.loginbusi.loadvideologin(username, pwd)
        self.common.wait_time(3)
        #点击导入视频按钮
        self.upldhandle.click_loadvideo_btn()
        self.lo.logg_out("点击上传视频")
        self.upldhandle.click_choice_video()
        self.common.wait_time(2)

    def up_load_erroe_type_video(self):
        # 上传不正确的视频格式,
        # 非input标签,第三方工具制作参数   +   上传文件的路径
        self.lo.logg_out("加载上传视频路径")
        os.system(r"C:\Users\Test\ruanjian\Autoitupload-filr\upload.exe %s" %
                  filepathone)
        self.common.wait_time(2)
        # loadvideo_fail_text = self.upldhandle.get_fiali_upload_video_text()
        # print(failtext)

    def up_load_sucess_type_video(self):
        """上传正确的视频格式"""
        videoname = random.choice(videolist)
        allpath = filepath + '\\' + videoname
        #第三方上传视频工具  + 正常视频上传路径
        os.system(r"C:\Users\Test\ruanjian\Autoitupload-filr\upload.exe  %s" %
                  allpath)
        self.common.wait_time(2)

        LoggIn.logg_out("选择外网资源")
        self.upldhandle.click_waiwang_btn()

        LoggIn.logg_out("选择频道分类")
        self.common.wait_time(2)
        self.upldhandle.click_pindao_btn()

        LoggIn.logg_out("随机选取一个栏目--人工智能、电子对抗、区块链")
        self.common.wait_time(3)
        self.upldhandle.click_fenlei_lanmu()

        LoggIn.logg_out("选择语言栏目")
        self.common.wait_time(2)
        self.upldhandle.click_langue_btn()

        LoggIn.logg_out("随机选择语言")
        self.common.wait_time(2)
        self.upldhandle.click_choice_langue_btn()

        LoggIn.logg_out("清除制作日期,重新输入当期日期")
        self.common.wait_time(2)
        self.upldhandle.clear_make_data_btn()
        self.common.wait_time(2)
        self.upldhandle.send_make_data_btn()
        self.common.wait_time(1)
        self.upldhandle.click_index()

        LoggIn.logg_out("清除上传日期,重新上传当天日期")
        self.common.wait_time(2)
        self.upldhandle.clear_upload_data()
        self.common.wait_time(2)
        self.upldhandle.send_upload_data_btn()
        self.upldhandle.click_index()

        LoggIn.logg_out("点击index首页切换,点击摘要输入框,输入内容摘要")
        self.common.wait_time(2)
        self.upldhandle.click_index()
        self.common.wait_time(2)
        self.upldhandle.click_index()
        self.upldhandle.input_content()

        LoggIn.logg_out("导入视频按钮")
        self.common.wait_time(2)
        self.upldhandle.import_video_btn()

        LoggIn.logg_out("关闭上传视频弹窗按钮")
        self.common.wait_time(2)
        self.upldhandle.click_alter_ele()

        #查看处理过程按钮
        self.common.wait_time(2)
        self.upldhandle.click_sucess_process()

        LoggIn.logg_out("视频上传完毕")
        self.common.wait_time(2)