def tearDown(self): """测试环境重置""" DbOperation().delete_waybill_driver(mobile=self.driver_mobile) self.logger.info( '########################### TestConfirmWaybill END ###########################' ) pass
def tearDown(self): """测试环境重置""" DbOperation().delete_wallet_consignor(self.mobile) self.logger.info( '########################### TestWalletConsignorAdd END ###########################' ) pass
def tearDown(self): """测试环境重置""" DbOperation().delete_waybill_driver(mobile=self.owner_driver) self.logger.info( '########################### TestCreateWaybillOwner END ###########################' ) pass
def tearDown(self): """测试环境重置""" DbOperation().delete_waybill_driver(self.mobile) # 删除case中操作的运单 self.logger.info( '########################### TestWaybillReceiptUpload END ###########################' ) pass
def tearDown(self): """测试环境重置""" self.driver.close_app() DbOperation().shipper_bankcard_del(self.shipper_mobile) self.logger.info( '########################### TestAddBankcard END ###########################' ) pass
def test_confirm_waybill(self): # 运单 确认发车 WuLiuYunWaybillTab(self.driver).go_to_waybill_detail() self.driver_tool.getScreenShot('test_confirm_waybill') WaybillConfirmWuliuyun(self.driver).confirm_waybill(type=1) self.driver_tool.getScreenShot('test_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, 'X')
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')
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))
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司机已确认
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')
def test_confirm_receipt_waybill(self): # 运单 回单确认 confirm_receipt = WaybillReceiptConfirmWuliuyun(self.driver) WuLiuYunWaybillTab(self.driver).go_to_waybill_ydd() WuLiuYunWaybillTab(self.driver).go_to_waybill_detail() self.driver_tool.getScreenShot('test_confirm_receipt_waybill') WuLiuYunWaybillDetail(self.driver).operating_waybill() confirm_receipt.add_receipt_image() confirm_receipt.del_receipt_image() confirm_receipt.add_confirm_info() confirm_receipt.confirm_receipt() self.driver_tool.getScreenShot('test_confirm_receipt_waybill') waybill = DbOperation().select_waybill_state(self.driver_mobile)[0] self.assertEqual(waybill, 'S')
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')
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 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 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 test_create_waybill_owner(self): # 新建公司车运单 create_waybill = WaybillCreateWuLiuYun(self.driver) WuLiuYunWaybillTab(self.driver).go_to_create_waybill() self.driver_tool.getScreenShot('test_create_waybill_owner') create_waybill.input_basic_info(car_type='2') create_waybill.input_goods_info() create_waybill.input_driver_info(car_type='2', mobile=self.owner_driver) create_waybill.input_cost_info() create_waybill.commit_waybill_info() self.driver_tool.getScreenShot('test_create_waybill_owner') main_page = WuLiuYunWaybillTab(self.driver).wait_main_page() self.assertTrue(main_page) waybill = DbOperation().select_waybill_state(self.owner_driver)[0] self.assertEqual(waybill, 'W')
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')
def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info( '########################### TestCreateWaybillOwner 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.owner_driver = config['owner_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.owner_driver) pass
def pay_for_driver(self): self.logger.info('### 获取用户钱包余额信息 ###') balance = self.get_wallet_info()['availBalance'] balance = float(balance) if balance != 0: self.logger.info('### 钱包余额为{}###'.format(str(balance))) return else: self.logger.info('### 用户余额为零,创建运单并进行余额支付 ###') waybillId = self.waybill.confirmWayBill() body_dict = {"wayBillId": waybillId, # 运单ID,String,必填 "paymentMethod": "2", # 支付方式,int【贷款付商户=1】、【余额付司机=2】、【白条付司机=3】、【线下支付=4】 "amountType": "1", # 预付款1,油卡2,到付款3,尾款4,9总运费 "amount": "1.00", # 实际支付金额,double "password": self.shipper_wallet_pwd, # 使用线下支付时必填,其他不填; "verifiCode": "", # 可能会有,非必填 "actualPayee": "" # 实际收款人loginId } response = HttpClient().post_json(url=self.url_pay_waybill, header_dict=self.head_dict, body_dict=body_dict) DbOperation().delete_waybill_driver(self.mobile) return response
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 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): """测试环境重置""" DbOperation().update_wallet_card_state(self.mobile) self.logger.info('########################### TestBankCardDelete END ###########################') pass