class HomeListTest(unittest.TestCase): """测试 首页 页面""" def setUp(self): self.a = login_B() self.b = PageTitle(self.a) self.c = Home(self.a) def tearDown(self): # sleep(40) # 防止提示验证码发送过快 self.c.close_broser() @BeautifulReport.add_img('HomeListTest_001_Home_fail') def test_001_Check_page(self): """ 用例一 :检查页面是否正常 """ try: self.b.switch_to_HomePage() sleep(1) self.c.click_HomePage() self.assertTrue(self.c.get_Business_income_today_msg()) except (BaseException, AssertionError ) as msg: # BaseException所有异常的基类,AssertionError断言语句失败 self.c.save_img('HomeListTest_001_Home_fail') InsertLog().debug(msg) raise BaseException
class DigitalCurrencyRecordListTest(unittest.TestCase): """报表--数字货币记录 页面""" @classmethod def setUpClass(self): self.a = login_C() self.b = PageTitle(self.a) self.c = DigitalCurrencyRecord(self.a) @classmethod def tearDownClass(self): self.c.close_broser() def DigitalCurrencyRecordList(self): self.b.switch_to_HomePage() sleep(1) self.b.switch_to_ReportFormPage() sleep(1) self.c.click_DigitalCurrencyRecordList() @BeautifulReport.add_img("DigitalCurrency_001_Currency_page_fail") def test_001_Check_Cash_page(self): """ 用例一 :检查数字货币记录页面是否正常 """ try: self.DigitalCurrencyRecordList() self.assertTrue(self.c.get_Digital_record_msg_txt()) except (BaseException, AssertionError) as msg: self.c.save_img('DigitalCurrency_001_Currency_page_fail') InsertLog().debug(msg) raise BaseException @BeautifulReport.add_img("DigitalCurrency_002_input_shop_fail") def test_002_Verify_Input_Shop_Name(self): """ 用例二 :验证数字货币记录>门店名称使用输入的方式查询 """ try: # 传参 需要查询的门店名称 self.DigitalCurrencyRecordList() sleep(1) self.assertTrue(self.c.verify_input_shop_query(shop_name)) except (BaseException, AssertionError) as msg: self.c.save_img('DigitalCurrency_002_input_shop_fail') InsertLog().debug(msg) raise BaseException @BeautifulReport.add_img('DigitalCurrency_003_select_shop_fail') def test_003_Verify_Select_Shop_name(self): """ 用例三 :验证数字货币记录>门店名称使用全选的方式查询 """ try: self.DigitalCurrencyRecordList() self.assertIn(shop_name, self.c.verify_select_shop_query()) except (BaseException, AssertionError) as msg: self.c.save_img('DigitalCurrency_003_select_shop_fail') InsertLog().debug(msg) raise BaseException @BeautifulReport.add_img('DigitalCurrency_004_reset_fail') def test_004_Verify_Reset(self): """ 用例四 :验证数字货币记录>重置功能 """ try: # 传参,先输入开始日期,点击重置 self.DigitalCurrencyRecordList() self.assertIn( '', self.c.verify_reset_function(start_day)) # 重置成功则返回空字符串 except (BaseException, AssertionError) as msg: self.c.save_img('DigitalCurrency_004_reset_fail') InsertLog().debug(msg) raise BaseException @BeautifulReport.add_img('DigitalCurrency_005_Day_fail') def test_005_Verify_Day_Query(self): """ 用例五 :验证数字货币记录>日期查询功能 """ try: # 传参 开始日期和结束日期,只能输入比当前日期前一天的时间 self.DigitalCurrencyRecordList() self.assertIsNotNone(self.c.verify_day_query(start_day, end_day)) except (BaseException, AssertionError) as msg: self.c.save_img('DigitalCurrency_005_Day_fail') InsertLog().debug(msg) raise BaseException @BeautifulReport.add_img('DigitalCurrency_006_order_number_fail') def test_006_Verify_Day_Query(self): """ 用例六 :验证订单号查询功能 """ try: # 传参 订单号 self.DigitalCurrencyRecordList() self.assertTrue(self.c.verify_order_number(order_number)) except (BaseException, AssertionError) as msg: self.c.save_img('DigitalCurrency_006_order_number_fail') InsertLog().debug(msg) raise BaseException @BeautifulReport.add_img('DigitalCurrency_007_cashier_fail') def test_007_Verify_Cashier(self): """ 用例七 :验证收银员查询功能 """ try: self.DigitalCurrencyRecordList() self.assertIsNotNone(self.c.verify_cashier(cashier_name)) except (BaseException, AssertionError) as msg: self.c.save_img('DigitalCurrency_007_cashier_fail') InsertLog().debug(msg) raise BaseException
class StaffListTest(unittest.TestCase): """测试账号列表页面""" @classmethod def setUpClass(self): self.a = login_C() self.b = PageTitle(self.a) self.c = Account(self.a) @classmethod def tearDownClass(self): self.c.close_broser() def AccountListBusiness(self): self.b.switch_to_HomePage() sleep(1) self.b.switch_to_PersonnelPage() sleep(1) self.c.click_account_list() @BeautifulReport.add_img("StaffListTest_001_check_page_fail") def test_001_Check_page(self): """ 用例一 :检查页面是否正常 """ try: self.AccountListBusiness() self.assertTrue(self.c.get_new_account_txt()) except (BaseException, AssertionError) as msg: self.c.save_img('StaffListTest_001_check_page_fail') InsertLog().debug(msg) raise BaseException @BeautifulReport.add_img('StaffListTest_002_shop_check_fail') def test_002_Verify_Select_Shop_name(self): """ 用例二 :验证门店名称使用全选的方式查询 """ try: self.AccountListBusiness() self.assertIsNotNone(self.c.verify_select_shop_query()) except (BaseException, AssertionError) as msg: self.c.save_img('StaffListTest_002_shop_check_fail') InsertLog().debug(msg) raise BaseException @BeautifulReport.add_img('StaffListTest_003_staff_number_fail') def test_003_Verify_Staff_Number(self): """ 用例三 :验证工号查询 """ try: # 传参 需要查询的工号 self.AccountListBusiness() self.assertTrue(self.c.verify_work_number_query(staff_number)) except (BaseException, AssertionError) as msg: self.c.save_img('StaffListTest_003_staff_number_fail') InsertLog().debug(msg) raise BaseException @BeautifulReport.add_img('StaffListTest_004_user_number_fail') def test_004_Verify_User_Number(self): """ 用例四 :验证用户编号查询 """ try: # 传参 需要查询的用户编号 self.AccountListBusiness() self.assertTrue(self.c.verify_user_number_query(user_number)) except (BaseException, AssertionError) as msg: self.c.save_img('StaffListTest_004_user_number_fail') InsertLog().debug(msg) raise BaseException @BeautifulReport.add_img('StaffListTest_005_phone_number_fail') def test_005_Verify_Phone(self): """ 用例五 :验证手机号码查询 """ try: # 传参 需要查询的手机号码 self.AccountListBusiness() self.assertTrue(self.c.verify_telephone_query(phone_number)) except (BaseException, AssertionError) as msg: self.c.save_img('StaffListTest_005_phone_number_fail') InsertLog().debug(msg) raise BaseException @BeautifulReport.add_img('StaffListTest_006_name_search_fail') def test_006_Verify_Name(self): """ 用例六 :验证姓名查询 """ try: # 传参需要查询的姓名 self.AccountListBusiness() self.assertTrue(self.c.verify_name_query(user_name)) except (BaseException, AssertionError) as msg: self.c.save_img('StaffListTest_006_name_search_fail') InsertLog().debug(msg) raise BaseException @BeautifulReport.add_img('StaffListTest_007_reset_fail') def test_007_Verify_Reset(self): """ 用例七 :验证重置功能 """ try: # 传参任意,先输入工号,点击重置 self.AccountListBusiness() self.assertIn( '', self.c.verify_reset_function(user_number)) # 重置成功则返回空字符串 except (BaseException, AssertionError) as msg: self.c.save_img('StaffListTest_007_reset_fail') InsertLog().debug(msg) raise BaseException @BeautifulReport.add_img('StaffListTest_008_edit_fail') def test_008_Verify_Modify_Success(self): """ 用例八 :验证修改成功 """ try: self.AccountListBusiness() self.assertTrue(self.c.verify_modify_function()) except (BaseException, AssertionError) as msg: self.c.save_img('StaffListTest_008_edit_fail') InsertLog().debug(msg) raise BaseException @BeautifulReport.add_img('StaffListTest_009_add_account_fail') def test_009_Add_Account(self): """ 用例九 :新增账号 """ try: # 传参国家和对应的手机号码,姓名,登陆密码,支付密码 self.AccountListBusiness() self.assertTrue( self.c.add_account(nation, newphone, name, loginpwd, paymentpwd)) except (BaseException, AssertionError) as msg: self.c.save_img('StaffListTest_009_add_account_fail') InsertLog().debug(msg) raise BaseException