Ejemplo n.º 1
0
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")
Ejemplo n.º 3
0
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")
Ejemplo n.º 4
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")
Ejemplo n.º 5
0
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")