class TestCancelWaybill(unittest.TestCase): # 物流云APP 取消运单 def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info('########################### TestCancelWaybill START ###########################') config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() app_package = config['appPackage_wuliuyun'] app_activity = config['appActivity_wuliuyun'] # AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver() # 单例调试 self.driver_mobile = config['employ_driver_mobile'] self.driver = AppUiDriver(appPackage=app_package, appActivity=app_activity).get_driver() self.driver_tool = DriverOperation(self.driver) CreateWayBill(self.driver_mobile).saveWayBill() self.driver.start_activity(app_activity=app_activity, app_package=app_package) pass def tearDown(self): """测试环境重置""" DbOperation().delete_waybill_driver(mobile=self.driver_mobile) self.logger.info('########################### TestCancelWaybill END ###########################') pass def test_cancel_waybill(self): # 取消运单 WuLiuYunWaybillTab(self.driver).go_to_waybill_detail() self.driver_tool.getScreenShot('test_cancel_waybill') WuLiuYunWaybillDetail(self.driver).cancel_waybill() self.driver_tool.getScreenShot('test_cancel_waybill') main_page = WuLiuYunWaybillTab(self.driver).wait_main_page() self.assertTrue(main_page) waybill = DbOperation().select_waybill_state(self.driver_mobile)[0] self.assertEqual(waybill, 'Q')
class TestAddBankcard(unittest.TestCase): # 物流云APP 添加银行卡 def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info( '########################### TestAddBankcard START ###########################' ) config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() app_package = config['appPackage_wuliuyun'] app_activity = config['appActivity_wuliuyun'] # AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver() # 单例调试时启动driver self.shipper_mobile = config['shipper_mobile'] self.shipper_card_mobile = config['shipper_card_mobile'] self.shipper_card_number = config['shipper_card_no'] self.shipper_card_bank_name = config['shipper_card_bank_name'] self.shipper_card_bank_branch = config['shipper_card_bank_branch'] self.driver = AppUiDriver(appPackage=app_package, appActivity=app_activity).get_driver() self.driver_tool = DriverOperation(self.driver) DbOperation().shipper_bankcard_del(self.shipper_mobile) self.driver.start_activity(app_activity=app_activity, app_package=app_package) pass def tearDown(self): """测试环境重置""" self.driver.close_app() DbOperation().shipper_bankcard_del(self.shipper_mobile) self.logger.info( '########################### TestAddBankcard END ###########################' ) pass def test_add_bankcard(self): # 个人中心 添加银行卡 add_card = UserBankcardAddWuliuyun(self.driver) WuLiuYunWaybillTab(self.driver).go_to_user_account() UserMainPageWuliuyun(self.driver).go_to_card_page() self.driver_tool.getScreenShot('test_add_bankcard') add_card.add_card_info(card_no=self.shipper_card_number, card_mobile=self.shipper_card_mobile, bank_name=self.shipper_card_bank_name, bank_branch_name=self.shipper_card_bank_branch) add_card.choose_bank_city() add_card.submit_bankcard() add_card.add_card_confirm(self.shipper_card_mobile) bankcard_page = UserBankcardMainWuliuyun( self.driver).wait_bankcard_main_page() self.driver_tool.getScreenShot('test_add_bankcard') self.assertTrue(bankcard_page) card_state = UserBankcardMainWuliuyun(self.driver).find_bankcard() self.assertTrue(card_state)
class TestWalletConsignorAdd(unittest.TestCase): """凯京车主APP 新增委托代收人""" def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info( '########################### TestWalletConsignorAdd START ###########################' ) config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() app_package = config['appPackage_chezhu'] app_activity = config['appActivity_chezhu'] # AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver() self.mobile = config['mobile_register'] self.consignor_name = config['consignor_name'] self.consignor_idNo = config['consignor_idNo'] self.consignor_mobile = config['consignor_mobile'] self.wallet_pwd = config['wallet_pwd_register'] self.driver = AppUiDriver(app_package, app_activity).get_driver() self.driver_tools = DriverOperation(self.driver) DbOperation().delete_wallet_consignor(self.mobile) self.driver.start_activity(app_activity=app_activity, app_package=app_package) pass def tearDown(self): """测试环境重置""" DbOperation().delete_wallet_consignor(self.mobile) self.logger.info( '########################### TestWalletConsignorAdd END ###########################' ) pass def test_bvt_wallet_consignor_add(self): """新增委托代收人""" wallet_consignor = WalletConsignorCheZhu(self.driver) self.driver_tools.getScreenShot('wallet_consignor_add') MainTabCheZhu(self.driver).goto_person_center() PersonCenterCheZhu(self.driver).goto_user_wallet() WalletMainCheZhu(self.driver).go_to_consignor() WalletPasswordCheZhu(self.driver).send_password(self.wallet_pwd) wallet_consignor.go_to_add_consignor() wallet_consignor.add_consignor(name=self.consignor_name, idNo=self.consignor_idNo, mobile=self.consignor_mobile) wait_page = wallet_consignor.wait_consignor_page() self.driver_tools.getScreenShot('wallet_consignor_add') self.assertTrue(wait_page) # 检查操作完成后页面activity是否切换为主列表页 consignor_state = wallet_consignor.find_consignor() self.assertTrue(consignor_state)
class TestCertification(unittest.TestCase): """凯京车主APP 身份认证""" def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info( '########################### TestCertification START ###########################' ) config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() app_package = config['appPackage_chezhu'] app_activity = config['appActivity_chezhu'] # AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver() self.db = DbOperation() self.driver = AppUiDriver(appPackage=app_package, appActivity=app_activity).get_driver() self.mobile = config['mobile_unregister'] self.name = config['name_unregister'] self.idNo = config['idNo_unregister'] self.db.initialize_driver_info(self.mobile) self.driver.start_activity(app_activity=app_activity, app_package=app_package) pass def tearDown(self): """测试环境重置""" self.db.initialize_driver_info(self.mobile) self.logger.info( '########################### TestCertification END ###########################' ) pass def test_bvt_certification(self): """身份认证""" certificate = CertificationCheZhu(self.driver) choosePhoto = ChoosePhotoCheZhu(self.driver) MainTabCheZhu(self.driver).goto_person_center() PersonCenterCheZhu(self.driver).goto_certification_page() certificate.upload_card_front() choosePhoto.choose_id_card_front() certificate.upload_card_back() choosePhoto.choose_id_card_back() certificate.input_id_card_info(self.name, self.idNo) certificate.submit_id_card_info() CarCertificateCheZhu(self.driver).wait_page() driver_info = self.db.select_driver_info(self.mobile) self.assertEqual(self.name, driver_info['name']) self.assertEqual(str(self.idNo), str(driver_info['idNo'])) self.assertEqual('Y', driver_info['isCertifacate'])
class TestCreateWaybillEmploy(unittest.TestCase): # 物流云APP 新建外请车运单 def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info( '########################### TestCreateWaybill START ###########################' ) config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() app_package = config['appPackage_wuliuyun'] app_activity = config['appActivity_wuliuyun'] # AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver() # 单例测试 启动driver self.employ_driver = config['employ_driver_mobile'] self.driver = AppUiDriver(appPackage=app_package, appActivity=app_activity).get_driver() self.driver_tool = DriverOperation(self.driver) self.driver.start_activity(app_activity=app_activity, app_package=app_package) DbOperation().delete_waybill_driver(mobile=self.employ_driver) pass def tearDown(self): """测试环境重置""" DbOperation().delete_waybill_driver(mobile=self.employ_driver) self.logger.info( '########################### TestCreateWaybill END ###########################' ) pass def test_create_waybill_employ(self): # 新建外请车运单 create_waybill = WaybillCreateWuLiuYun(self.driver) WuLiuYunWaybillTab(self.driver).wait_main_page() WuLiuYunWaybillTab(self.driver).go_to_create_waybill() self.driver_tool.getScreenShot('test_create_waybill_employ') create_waybill.input_basic_info(car_type='1') create_waybill.input_goods_info() create_waybill.input_driver_info(car_type='1', mobile=self.employ_driver) create_waybill.input_cost_info() create_waybill.commit_waybill_info() self.driver_tool.getScreenShot('test_create_waybill_employ') main_page = WuLiuYunWaybillTab(self.driver).wait_main_page() self.assertTrue(main_page) waybill = DbOperation().select_waybill_state(self.employ_driver)[0] self.assertEqual(waybill, 'W')
class TestWaybillReceiptUpload(unittest.TestCase): """凯京车主APP 回单上传""" def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info( '########################### TestWaybillReceiptUpload START ###########################' ) config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() # 读取配置文件 app_package = config['appPackage_chezhu'] # APP 包名 app_activity = config['appActivity_chezhu'] # APP 启动activity # AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver() self.mobile = config['mobile_register'] # 认证司机手机号 self.driver = AppUiDriver(app_package, app_activity).get_driver() # 获取appium driver CreateWayBill(self.mobile).arrive_confirm() # 创建运单并确认发车及到达确认 self.driver_tools = DriverOperation(self.driver) self.driver.start_activity( app_activity=app_activity, app_package=app_package) # 重启APP 保证case从主页面开始执行 pass def tearDown(self): """测试环境重置""" DbOperation().delete_waybill_driver(self.mobile) # 删除case中操作的运单 self.logger.info( '########################### TestWaybillReceiptUpload END ###########################' ) pass def test_bvt_waybill_receipt_upload(self): """回单上传操作""" upload_receipt = WaybillReceiptUploadCheZhu(self.driver) MainTabCheZhu(self.driver).close_driver_loan_ads() self.driver_tools.getScreenShot('waybill_receipt_upload') WaybillMainCheZhu(self.driver).go_to_waybill_detail() # 跳转运单回单上传操作页面 self.driver_tools.getScreenShot('waybill_receipt_upload') upload_receipt.add_receipt_image() # 添加回单照片 upload_receipt.add_receipt_info('自动化回单异常') # 添加回单异常信息 upload_receipt.upload_receipt() # 上传回单相关信息 wait_page = MainTabCheZhu(self.driver).wait_main_page() self.driver_tools.getScreenShot('waybill_receipt_upload') self.assertTrue(wait_page) # 检查操作完成后页面activity是否切换为主列表页 waybill_state = DbOperation().select_waybill_state( self.mobile)[0] # 判断运单状态是否变为 H回单已上传 self.assertEqual(waybill_state, 'H')
class TestWalletCash(unittest.TestCase): """凯京车主APP 提现""" def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info( '########################### TestWalletCash START ###########################' ) config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() app_package = config['appPackage_chezhu'] app_activity = config['appActivity_chezhu'] # AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver() self.mobile = config['mobile_register'] self.wallet_pwd = config['wallet_pwd_register'] self.driver = AppUiDriver(app_package, app_activity).get_driver() self.driver_tools = DriverOperation(self.driver) PayForDriver(self.mobile).pay_for_driver() self.driver.start_activity(app_activity=app_activity, app_package=app_package) pass def tearDown(self): """测试环境重置""" self.logger.info( '########################### TestWalletCash END ###########################' ) pass @unittest.skip('skip cash case') def test_bvt_wallet_cash(self): """钱包提现""" wallet = WalletMainCheZhu(self.driver) wallet_cash = WalletCashCheZhu(self.driver) MainTabCheZhu(self.driver).goto_person_center() PersonCenterCheZhu(self.driver).goto_user_wallet() self.driver_tools.getScreenShot('wallet_cash') wallet.go_to_cash() wallet_cash.wallet_cash() WalletPasswordCheZhu(self.driver).send_password(self.wallet_pwd) wallet_cash.cash_confirm() self.driver_tools.getScreenShot('wallet_cash') wait_page = MainTabCheZhu(self.driver).wait_main_page() self.assertTrue(wait_page) # 检查操作完成后页面activity是否切换为主列表页 wallet_balance = int(wallet.get_wallet_balance()) self.assertEqual(wallet_balance, 0)
class TestCarCertification(unittest.TestCase): """凯京车主APP 车辆认证""" def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info( '########################### TestCarCertification START ###########################' ) config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() app_package = config['appPackage_chezhu'] app_activity = config['appActivity_chezhu'] # AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver() self.mobile = config['mobile_unregister'] self.db = DbOperation() self.driver = AppUiDriver(appPackage=app_package, appActivity=app_activity).get_driver() self.db.update_driver_info() self.driver.start_activity(app_activity=app_activity, app_package=app_package) pass def tearDown(self): """测试环境重置""" self.db.initialize_driver_info(self.mobile) self.logger.info( '########################### TestCarCertification END ###########################' ) pass def test_bvt_car_certification(self): """车辆认证""" car_certificate = CarCertificateCheZhu(self.driver) choosePhoto = ChoosePhotoCheZhu(self.driver) MainTabCheZhu(self.driver).goto_person_center() # 进入个人中心 PersonCenterCheZhu(self.driver).goto_certification_page() # 进入认证页面 car_certificate.upload_car_img_first() # 选择行驶证正面照片 choosePhoto.choose_driving_license_front() car_certificate.upload_car_img_second() # 选择行驶证反面照片 choosePhoto.choose_id_card_back() car_certificate.input_car_number() car_certificate.choose_car_info() car_certificate.submit_car_info() WalletOpenCheZhu(self.driver).wait_page() driver_info = self.db.select_driver_info(self.mobile) self.assertEqual('Y', driver_info['isCarCertificate'])
class TestArriveConfirmWaybill(unittest.TestCase): # 物流云APP 运单确认到达 def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info( '########################### TestArriveConfirmWaybill START ###########################' ) config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() app_package = config['appPackage_wuliuyun'] app_activity = config['appActivity_wuliuyun'] # AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver() self.driver_mobile = config['employ_driver_mobile'] self.confirm_amt = '8' self.confirm_info = '到达确认自动化备注' self.driver = AppUiDriver(appPackage=app_package, appActivity=app_activity).get_driver() self.driver_tool = DriverOperation(self.driver) CreateWayBill(self.driver_mobile).confirmWayBill() self.driver.start_activity(app_activity=app_activity, app_package=app_package) pass def tearDown(self): """测试环境重置""" DbOperation().delete_waybill_driver(mobile=self.driver_mobile) self.logger.info( '########################### TestArriveConfirmWaybill END ###########################' ) pass def test_arrive_confirm_waybill(self): # 运单 确认到达 WuLiuYunWaybillTab(self.driver).go_to_waybill_ysz() WuLiuYunWaybillTab(self.driver).go_to_waybill_detail() self.driver_tool.getScreenShot('test_arrive_confirm_waybill') WaybillArriveConfirmWuliuyun(self.driver).go_to_confirm_waybill(type=1) WaybillArriveConfirmWuliuyun(self.driver).arrive_confirm_waybill( amt=self.confirm_amt, info=self.confirm_info) self.driver_tool.getScreenShot('test_arrive_confirm_waybill') main_page = WuLiuYunWaybillTab(self.driver).wait_main_page() self.assertTrue(main_page) waybill = DbOperation().select_waybill_state(self.driver_mobile)[0] self.assertEqual(waybill, 'D')
class TestChangeWaybill(unittest.TestCase): # 物流云APP 运单修改运单 def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info( '########################### TestChangeWaybill START ###########################' ) config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() app_package = config['appPackage_wuliuyun'] app_activity = config['appActivity_wuliuyun'] # AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver() self.driver_mobile = config['employ_driver_mobile'] self.driver = AppUiDriver(appPackage=app_package, appActivity=app_activity).get_driver() self.driver_tool = DriverOperation(self.driver) CreateWayBill(self.driver_mobile).saveWayBill() self.driver.start_activity(app_activity=app_activity, app_package=app_package) pass def tearDown(self): """测试环境重置""" DbOperation().delete_waybill_driver(mobile=self.driver_mobile) self.logger.info( '########################### TestChangeWaybill END ###########################' ) pass def test_change_waybill(self): # 运单 修改运单 change_waybill = WaybillChangeWuLiuYun(self.driver) WuLiuYunWaybillTab(self.driver).go_to_waybill_detail() self.driver_tool.getScreenShot('test_confirm_waybill') WuLiuYunWaybillDetail(self.driver).go_to_change_page(type=0) change_waybill.change_waybill(totalAmt='66', preAmt='1', oilAmt='2', destAmt='3', lastAmt='4') change_waybill.commit_change() self.driver_tool.getScreenShot('test_confirm_waybill') page = WuLiuYunWaybillDetail(self.driver).wait_detail_page() self.assertTrue(page)
class TestUploadReceiptWaybill(unittest.TestCase): # 物流云APP 运单上传回单 def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info( '########################### TestUploadReceiptWaybill START ###########################' ) config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() app_package = config['appPackage_wuliuyun'] app_activity = config['appActivity_wuliuyun'] # AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver() # 测试单例 启动driver self.driver_mobile = config['employ_driver_mobile'] self.driver = AppUiDriver(appPackage=app_package, appActivity=app_activity).get_driver() self.driver_tool = DriverOperation(self.driver) CreateWayBill(self.driver_mobile).arrive_confirm() self.driver.start_activity(app_activity=app_activity, app_package=app_package) pass def tearDown(self): """测试环境重置""" DbOperation().delete_waybill_driver(mobile=self.driver_mobile) self.logger.info( '########################### TestUploadReceiptWaybill END ###########################' ) pass def test_upload_receipt_waybill(self): # 运单 回单上传 upload_receipt = WaybillUploadReceiptWuliuyun(self.driver) WuLiuYunWaybillTab(self.driver).go_to_waybill_ydd() WuLiuYunWaybillTab(self.driver).go_to_waybill_detail() self.driver_tool.getScreenShot('test_receipt_upload_waybill') WuLiuYunWaybillDetail(self.driver).operating_waybill() upload_receipt.upload_receipt_image() upload_receipt.upload_receipt_abnormal_info() upload_receipt.upload_receipt_submit() self.driver_tool.getScreenShot('test_receipt_upload_waybill') receipt_page = upload_receipt.get_receipt_confirm().text self.assertIn('尾款金额', receipt_page) waybill = DbOperation().select_waybill_state(self.driver_mobile)[0] self.assertEqual(waybill, 'H')
class TestWalletPasswordChange(unittest.TestCase): """凯京车主APP 修改钱包密码""" def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info( '########################### TestWalletPasswordChange START ###########################' ) config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() app_package = config['appPackage_chezhu'] app_activity = config['appActivity_chezhu'] # AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver() self.pwd = config['wallet_pwd_register'] self.newpwd = '147369' self.driver = AppUiDriver(app_package, app_activity).get_driver() self.driver_tools = DriverOperation(self.driver) self.driver.start_activity(app_activity=app_activity, app_package=app_package) pass def tearDown(self): """测试环境重置""" self.logger.info( '########################### TestWalletPasswordChange END ###########################' ) pass def test_bvt_wallet_password_change(self): """ 修改钱包密码 """ wallet_pwd = WalletChangePwdCheZhu(self.driver) self.driver_tools.getScreenShot('wallet_password_change') MainTabCheZhu(self.driver).goto_person_center() PersonCenterCheZhu(self.driver).goto_user_wallet() WalletMainCheZhu(self.driver).go_to_change_pwd() wallet_pwd.change_pwd(oldpwd=self.pwd, newpwd=self.newpwd) wallet_pwd.confirm_change_pwd() wait_page = WalletMainCheZhu(self.driver).wait_wallet_page() self.driver_tools.getScreenShot('wallet_password_change') self.assertTrue(wait_page) # 检查操作完成后页面activity是否切换为钱包主页面 WalletMainCheZhu(self.driver).go_to_change_pwd() wallet_pwd.change_pwd(oldpwd=self.newpwd, newpwd=self.pwd) wallet_pwd.confirm_change_pwd()
class TestWaybillConfirm(unittest.TestCase): """凯京车主APP 确认发车""" def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info('########################### TestWaybillConfirm START ###########################') config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() # 获取配置文件 app_package = config['appPackage_chezhu'] app_activity = config['appActivity_chezhu'] # AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver() self.mobile = config['mobile_register'] self.driver = AppUiDriver(app_package, app_activity).get_driver() # 获取appium driver DbOperation().delete_waybill_driver(self.mobile) # 删除已有运单 CreateWayBill(self.mobile).saveWayBill() # 创建运单 self.driver_tools = DriverOperation(self.driver) self.driver.start_activity(app_activity=app_activity, app_package=app_package) # 重启应用 pass def tearDown(self): """测试环境重置""" DbOperation().delete_waybill_driver(self.mobile) # 删除case中操作的运单 self.logger.info('########################### TestWaybillConfirm END ###########################') pass def test_bvt_waybill_confirm(self): """确认发车操作""" MainTabCheZhu(self.driver).close_driver_loan_ads() self.driver_tools.getScreenShot('waybill_confirm') WaybillMainCheZhu(self.driver).go_to_waybill_detail() # 进入运单详情页面 操作确认发车 WaybillConfirmCheZhu(self.driver).upload_transport_img() # 上传运输协议 self.driver_tools.getScreenShot('waybill_confirm') WaybillConfirmCheZhu(self.driver).confirm_waybill() # 确认发车 wait_page = MainTabCheZhu(self.driver).wait_main_page() self.driver_tools.getScreenShot('waybill_confirm') self.assertTrue(wait_page) # 检查操作完成后页面activity是否切换为主列表页 waybill_state = DbOperation().select_waybill_state(self.mobile)[0] self.assertEqual(waybill_state, 'Y') # 判断运单状态是否变为 Y司机已确认
class TestLogout(unittest.TestCase): """凯京车主APP 退出登录""" def setUp(self): """前置条件准备""" config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() app_package = config['appPackage_chezhu'] app_activity = config['appActivity_chezhu'] # AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver() self.logger = Log() self.driver = AppUiDriver(appPackage=app_package, appActivity=app_activity).get_driver() self.driver_operation = DriverOperation(self.driver) self.driver.start_activity(app_activity=app_activity, app_package=app_package) self.logger.info( '########################### TestLogout START ###########################' ) pass def tearDown(self): """测试环境重置""" RedisDb().del_key(name='CHK_ONE_DAY_LOGIN', key='all') self.driver.quit() self.logger.info( '########################### TestLogout END ###########################' ) pass def test_bvt_logout(self): """用户退出登录""" self.driver_operation.getScreenShot('TestLogout') MainTabCheZhu(self.driver).goto_person_center() PersonCenterCheZhu(self.driver).goto_setting_page() SettingCheZhu(self.driver).user_logout() self.driver_operation.getScreenShot('TestLogout') page_wait = LoginCheZhu(self.driver).wait_login_page() self.assertTrue(page_wait)
class TestBankCardDelete(unittest.TestCase): """凯京车主APP 提现银行卡解绑 """ # 暂时无法测试,提现卡绑定状态记录在支付网关无法主动修改 def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info('########################### TestBankCardDelete START ###########################') config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() # 获取配置文件 app_package = config['appPackage_chezhu'] app_activity = config['appActivity_chezhu'] # AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver() self.mobile = config['mobile_register'] self.wallet_pwd = config['wallet_pwd_register'] # 钱包密码 self.driver = AppUiDriver(app_package, app_activity).get_driver() # 获取appium driver self.driver_tools = DriverOperation(self.driver) DbOperation().update_wallet_card_state(self.mobile) # 更新提现卡状态 self.driver.start_activity(app_activity=app_activity, app_package=app_package) pass def tearDown(self): """测试环境重置""" DbOperation().update_wallet_card_state(self.mobile) self.logger.info('########################### TestBankCardDelete END ###########################') pass @unittest.skip('提现卡绑定状态记录在支付网关无法主动修改') def test_bvt_bankcard_delete(self): """提现银行卡解绑""" bankcard = BankCardMainCheZhu(self.driver) MainTabCheZhu(self.driver).goto_person_center() PersonCenterCheZhu(self.driver).goto_account_bankcard() self.driver_tools.getScreenShot('bankcard_delete') bankcard.untie_cash_card() WalletPasswordCheZhu(self.driver).send_password(self.wallet_pwd) WalletPasswordCheZhu(self.driver).confirm_pwd() self.driver_tools.getScreenShot('bankcard_delete') cash_card = bankcard.find_cash_card() self.assertEqual(cash_card, False)
class TestLogout(unittest.TestCase): # 物流云APP 货主退出登录 def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info( '########################### TestLogout START ###########################' ) config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() app_package = config['appPackage_wuliuyun'] app_activity = config['appActivity_wuliuyun'] # AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver() # 单例调试启动driver self.driver = AppUiDriver(appPackage=app_package, appActivity=app_activity).get_driver() self.driver_tool = DriverOperation(self.driver) self.driver.start_activity(app_activity=app_activity, app_package=app_package) pass def tearDown(self): """测试环境重置""" self.driver.quit() self.logger.info( '########################### TestLogout END ###########################' ) pass def test_logout(self): # 货主退出登录 WuLiuYunWaybillTab(self.driver).wait_main_page() WuLiuYunWaybillTab(self.driver).go_to_user_account() self.driver_tool.getScreenShot('test_logout') UserMainPageWuliuyun(self.driver).go_to_setting_page() UserSettingPageWuliuyun(self.driver).logout() self.driver_tool.getScreenShot('test_logout') login_page = LoginWuLiuYun(self.driver).wait_login_page() self.assertTrue(login_page)
class TestWalletOpen(unittest.TestCase): """凯京车主APP 开通钱包""" def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info('########################### TestWalletOpen START ###########################') config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() app_package = config['appPackage_chezhu'] app_activity = config['appActivity_chezhu'] # AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver() self.db = DbOperation() self.driver = AppUiDriver(appPackage=app_package, appActivity=app_activity).get_driver() self.mobile = config['mobile_unregister'] self.db.certificate_driver_info(self.mobile) self.db.delete_wallet_driver(self.mobile) self.driver.start_activity(app_activity=app_activity, app_package=app_package) pass def tearDown(self): """测试环境重置""" self.db.delete_wallet_driver(self.mobile) self.db.initialize_driver_info(self.mobile) self.logger.info('########################### TestWalletOpen END ###########################') pass def test_bvt_wallet_open(self): """开通司机钱包""" wallet = WalletOpenCheZhu(self.driver) MainTabCheZhu(self.driver).goto_person_center() PersonCenterCheZhu(self.driver).goto_user_wallet() wallet.wallet_open() wallet.set_pwd() page_wait = MainTabCheZhu(self.driver).wait_main_page() self.assertTrue(page_wait) wallet_type = DbOperation().select_wallet_state(self.mobile) self.assertEqual('1', str(wallet_type))