示例#1
0
class ShopListTest(unittest.TestCase):
    """测试 门店--门店列表 页面"""

    @classmethod
    def setUpClass(self):
        self.a = login_C()
        self.b = PageTitle(self.a)
        self.c = Shop(self.a)

    @classmethod
    def tearDownClass(self):
        self.c.close_broser()

    def ShopListBusiness(self):
        self.b.switch_to_OrderPage()
        sleep(1)
        self.b.switch_to_ShopPage()
        sleep(1)
        self.c.click_shop_list()

    @BeautifulReport.add_img('ShopListTest_001_page_error')
    def test_001_Check_page(self):
        """
        用例一 :检查页面是否正常
        """
        try:
            self.ShopListBusiness()
            self.assertTrue(self.c.get_newshop_msg())
        except (BaseException, AssertionError) as msg:
            self.c.save_img('001_page_error')
            InsertLog().debug(msg)
            raise BaseException

    @BeautifulReport.add_img('ShopListTest_002_add_shop_fail')
    def test_002_Add_Shop(self):
        """
        用例二 :新增门店
        """
        try:  # 传参 门店名称,门店地址,门店电话
            self.ShopListBusiness()
            self.assertTrue(self.c.add_shop_success(add_shop_name, u'深圳南山', tel))
        except (BaseException, AssertionError) as msg:
            self.c.save_img('ShopListTest_002_add_shop_fail')
            InsertLog().debug(msg)
            raise BaseException

    @BeautifulReport.add_img('ShopListTest_003_search_fail')
    def test_003_Verify_Shop_number(self):
        """
        用例三 :验证门店编号查询
        """
        try:  # 传参 需要查询的门店编号
            sleep(1)
            self.ShopListBusiness()
            self.assertTrue(self.c.verify_shop_number_query(shop_number))
        except (BaseException, AssertionError) as msg:
            self.c.save_img('ShopListTest_003_search_fail')
            InsertLog().debug(msg)
            raise BaseException

    @BeautifulReport.add_img('ShopListTest_004_search_fail')
    def test_004_Verify_Shop_Name(self):
        """
        用例四 :验证门店名称查询
        """
        try:  # 传参 需要查询的门店名称
            self.ShopListBusiness()
            self.assertTrue(self.c.verify_shop_name_query(shop_name))
        except (BaseException, AssertionError) as msg:
            self.c.save_img('ShopListTest_004_search_fail')
            InsertLog().debug(msg)
            raise BaseException

    @BeautifulReport.add_img('ShopListTest_005_search_fail')
    def test_005_Verify_Tel_Phone(self):
        """
        用例五 :验证电话查询
        """
        try:  # 传参 需要查询的电话
            self.ShopListBusiness()
            self.assertTrue(self.c.verify_telephone_query(tel))
        except (BaseException, AssertionError) as msg:
            self.c.save_img('ShopListTest_005_search_fail')
            InsertLog().debug(msg)
            raise BaseException

    @BeautifulReport.add_img('ShopListTest_006_reset_fail')
    def test_006_Verify_Reset(self):
        """
        用例六 :验证重置功能
        """
        try:  # 传参任意,先输入门店名称,点击重置
            test = u'门店'
            self.ShopListBusiness()
            self.assertIn('', self.c.verify_reset_function(test))  # 重置成功则返回''
        except (BaseException, AssertionError) as msg:
            self.c.save_img('ShopListTest_006_reset_fail')
            InsertLog().debug(msg)
            raise BaseException

    @BeautifulReport.add_img('ShopListTest_007_edit_fail')
    def test_007_Verify_Edit_Success(self):
        """
        用例七 :验证编辑成功后返回信息
        """
        try:
            sleep(1)
            self.ShopListBusiness()
            self.assertTrue(self.c.verify_edit_function())
        except (BaseException, AssertionError) as msg:
            self.c.save_img('ShopListTest_007_edit_fail')
            InsertLog().debug(msg)
            raise BaseException

    @BeautifulReport.add_img('ShopListTest_008_delete_fail')
    def test_008_Verify_Delete_Success(self):
        """
        用例八 :验证删除成功后返回信息
        """
        try:
            self.ShopListBusiness()
            self.assertTrue(self.c.verify_delete_function())
        except (BaseException, AssertionError) as msg:
            self.c.save_img('ShopListTest_008_delete_fail')
            InsertLog().debug(msg)
            raise BaseException
示例#2
0
class OrderManagementTest(unittest.TestCase):
    """测试 订单--订单管理 页面"""
    @classmethod
    def setUpClass(self):
        self.a = login_C()
        self.b = PageTitle(self.a)
        self.c = OrderManagement(self.a)

    @classmethod
    def tearDownClass(self):
        self.c.close_broser()

    def OrderManagermentBusiness(self):
        self.b.switch_to_ShopPage()
        sleep(1)
        self.b.switch_to_OrderPage()
        sleep(1)
        self.c.click_OrderManagement()

    @BeautifulReport.add_img("OrderTest_001_page_fail")
    def test_001_Check_page(self):
        """
        用例一 :检查页面是否正常
        """
        try:
            self.OrderManagermentBusiness()
            self.assertTrue(self.c.findElement('Cashier Order'))
        except (BaseException, AssertionError) as msg:
            self.c.save_img('OrderTest_001_page_fail')
            InsertLog().debug(msg)
            raise BaseException

    @BeautifulReport.add_img("OrderTest_002_search_fail")
    def test_002_Verify_Input_Shop_Name(self):
        """
        用例二 :验证门店名称使用输入的方式查询
        """
        try:  # 传参 需要查询的门店名称
            self.OrderManagermentBusiness()
            self.assertTrue(self.c.input_shop_query(shop_name))
        except (BaseException, AssertionError) as msg:
            self.c.save_img('OrderTest_002_search_fail')
            InsertLog().debug(msg)
            raise BaseException

    @BeautifulReport.add_img("OrderTest_003_search_fail")
    def test_003_Verify_Select_Shop_name(self):
        """
        用例三 :验证门店名称使用全选的方式查询
        """
        try:
            self.OrderManagermentBusiness()
            self.assertTrue(self.c.verify_select_shop_query())
        except (BaseException, AssertionError) as msg:
            self.c.save_img('OrderTest_003_search_fail')
            InsertLog().debug(msg)
            raise BaseException

    @BeautifulReport.add_img("OrderTest_004_details_fail")
    def test_004_Verify_Modify_Function(self):
        """
        用例四 :验证详情页面
        """
        try:
            self.OrderManagermentBusiness()
            self.assertTrue(self.c.verify_modify_function())
        except (BaseException, AssertionError) as msg:
            self.c.save_img('OrderTest_004_details_fail')
            InsertLog().debug(msg)
            raise BaseException

    @BeautifulReport.add_img("OrderTest_005_reset_fail")
    def test_005_Verify_Reset(self):
        """
        用例五 :验证重置功能
        """
        try:  # 传参,先输入门店名称,点击重置
            sleep(2)
            self.OrderManagermentBusiness()
            self.assertIn('',
                          self.c.verify_reset_function(shop_name))  # 重置成功则返回''
        except (BaseException, AssertionError) as msg:
            self.c.save_img('OrderTest_005_reset_fail')
            InsertLog().debug(msg)
            raise BaseException
class AssetsSalesListTest(unittest.TestCase):
    """测试 资产 菜单-- 销售账户 页面"""

    @classmethod
    def setUpClass(self):
        self.a = login_C()
        self.b = PageTitle(self.a)
        self.c = SalesAccount(self.a)

    @classmethod
    def tearDownClass(self):
        self.c.close_broser()

    def AssetsListBusiness(self):
        self.b.switch_to_OrderPage()
        sleep(1)
        self.b.switch_to_AssetsPage()
        sleep(1)
        self.c.click_sales_account()

    @BeautifulReport.add_img('AssetsSales_001_funds_sales_account_fail')
    def test_001_Cashier_Account_page(self):
        """
        用例一 :检查页面是否正常
        """
        try:
            self.AssetsListBusiness()
            self.assertTrue(self.c.get_account_history_txt())
        except (BaseException, AssertionError) as msg:
            self.c.save_img('AssetsSales_001_funds_sales_account_fail')
            InsertLog().debug(msg)
            raise BaseException

    @BeautifulReport.add_img('AssetsSales_002_funds_withdrawal_usdt_fail')
    def test_002_Withdrawal_USDT(self):
        """
        用例二 :提现USDT功能
        """
        try:  # 传参提现地址,支付密码
            self.AssetsListBusiness()
            self.assertTrue(self.c.withdrawal_USDT(withdrawal_address, paypwd))
        except (BaseException, AssertionError) as msg:
            self.c.save_img('AssetsSales_002_funds_withdrawal_usdt_fail')
            InsertLog().debug(msg)
            raise BaseException

    @BeautifulReport.add_img('AssetsSales_003_funds_withdrawal_dai_fail')
    def test_003_Withdrawal_DAI(self):
        """
        用例三 :提现DAI功能
        """
        try:  # 传参提现地址,支付密码
            self.AssetsListBusiness()
            self.assertTrue(self.c.withdrawal_DAI(withdrawal_address, paypwd))
        except (BaseException, AssertionError) as msg:
            self.c.save_img('AssetsSales_003_funds_withdrawal_dai_fail')
            InsertLog().debug(msg)
            raise BaseException

    @BeautifulReport.add_img('AssetsSales_004_deposit_fail')
    def test_004_Deposit_Function(self):
        """
        用例四 :检验充值功能
        """
        try:
            self.AssetsListBusiness()
            self.assertTrue(self.c.click_deposit())
        except (BaseException, AssertionError) as msg:
            self.c.save_img('AssetsSales_004_deposit_fail')
            InsertLog().debug(msg)
            raise BaseException

    @BeautifulReport.add_img('AssetsSales_005_reset_fail')
    def test_005_Verify_Reset(self):
        """
        用例五 :验证销售账户>重置功能
        """
        try:  # 传参,先输入开始日期,点击重置
            self.AssetsListBusiness()
            self.assertIn('', self.c.verify_reset_function(start_day))  # 重置成功则返回空字符串
        except (BaseException, AssertionError) as msg:
            self.c.save_img('AssetsSales_005_reset_fail')
            InsertLog().debug(msg)
            raise BaseException

    @BeautifulReport.add_img('AssetsSales_006_Day_fail')
    def test_006_Verify_Day_Query(self):
        """
        用例六 :验证销售账户>日期查询功能
        """
        try:  # 传参 开始日期和结束日期,只能输入比当前日期前一天的时间
            self.AssetsListBusiness()
            self.assertIsNotNone(self.c.verify_day_query(start_day, end_day))
        except (BaseException, AssertionError) as msg:
            self.c.save_img('AssetsSales_006_Day_fail')
            InsertLog().debug(msg)
            raise BaseException