class LoadVideoLogin(unittest.TestCase): """登录上传视频的正反例""" def setUp(self): self.dr = BaseDriver().getdriver() self.c = Commonlib(self.dr) self.b = LoadVideoBussiness(self.dr) def tearDown(self): self.c.wait_time(2) self.c.quit_broswer() @parameterized.expand(bulid_data) 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")
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")
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")