class TestNewBillAllocationBoe(): boeNum = globals() def setup_class(self): self.login = LoginDepend('basHost', 'user') self.newBillAllocationBoePage = NewBillAllocationBoePage( self.login.driver) def teardown_class(self): self.newBillAllocationBoePage.driver.quit() @allure.story("票据调拨单(新)业务报账界面单据提交") @allure.step("票据调拨单(新)业务报账界面单据提交步骤") @allure.severity("blocker") @pytest.mark.dependency(name='submit') def test_newBillAllocationBoe(self): logger.info(" ----- 单据提交流程开始 ----- ") with allure.step("点击选择资金票据页面"): self.newBillAllocationBoePage.selectTabType('资金票据') with allure.step("进入票据调拨报账单(新)单据提交页面"): self.newBillAllocationBoePage.boeRntry('票据调拨报账单(新)') global boeNum boeNum = self.newBillAllocationBoePage.getBoeNum() with allure.step("选择业务类型"): self.newBillAllocationBoePage.input_operationType('UI通用') with allure.step("输入备注"): self.newBillAllocationBoePage.input_boeAbstract('测试票据调拨单(新)') with allure.step("选择收票方"): self.newBillAllocationBoePage.selectReceiveVendor('UI供应商1') postalOrder = record.readDataFromRecord( type='postalOrderData')['postalOrder1'] with allure.step("关联票据"): self.newBillAllocationBoePage.associateBill(postalOrder) with allure.step("点击单据提交"): self.newBillAllocationBoePage.click_boeSubmitButton() with allure.step("点击单据关闭按钮"): self.newBillAllocationBoePage.click_close() with allure.step("进行单据生成校验"): self.newBillAllocationBoePage.click_more() self.newBillAllocationBoePage.input_boeNumQuery(boeNum) self.newBillAllocationBoePage.click_queryButton() with allure.step("断言结果:{}".format( self.newBillAllocationBoePage.checkBoeNumExistIsOrNot( boeNum))): assert self.newBillAllocationBoePage.checkBoeNumExistIsOrNot( boeNum) == True @allure.story("票据调拨单(新)费用报销界面业务审批") @allure.step("票据调拨单(新)费用报销界面业务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_businessApprove(self): logger.info(" ----- 单据业务审批开始 ----- ") global boeNum self.businessApprove = BusinessApprove(boeNum) content = self.businessApprove.boeBusinessApprove() logger.info(" ----- 单据业务审批开始 ----- ") assert content == '审批成功' @allure.story("票据调拨单(新)共享中心界面财务审批") @allure.step("票据调拨单(新)共享中心界面财务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_sharingCenterApprove(self): logger.info(" ----- 单据财务审批开始 ----- ") global boeNum self.sharingCenterApprove = SharingCenterApprove(boeNum) self.sharingCenterApprove.sharingCenterApproveChuShen() self.sharingCenterApprove.sharingCenterApproveFuShen() logger.info(" ----- 单据财务审批结束 ----- ")
class TestNewSalaryOtherBoe(): boeNum = globals() def setup_class(self): self.publicLogin = LoginDepend('basHost', 'user') self.newSalaryOtherBoePage = NewSalaryOtherBoePage(self.publicLogin.driver) def teardown_class(self): self.newSalaryOtherBoePage.driver.quit() @allure.story("五险一金报账单(新)业务报账界面单据提交") @allure.step("五险一金报账单(新)业务报账界面单据提交步骤") @allure.severity("blocker") @pytest.mark.dependency(name='submit') def test_newSalaryOtherBoe(self): logger.info(" ----- 单据提交流程开始 ----- ") with allure.step("点击选择收入收款页面"): self.newSalaryOtherBoePage.selectTabType('薪酬报账') with allure.step("进入收入报账单单据提交页面"): self.newSalaryOtherBoePage.boeRntry('五险一金报账单(新)') global boeNum boeNum = self.newSalaryOtherBoePage.getBoeNum() with allure.step("选择业务类型"): self.newSalaryOtherBoePage.input_operationType('UI工资发放') with allure.step("输入备注"): self.newSalaryOtherBoePage.input_boeAbstract('测试五险一金报账单(新)') with allure.step("选择关联薪资"): self.newSalaryOtherBoePage.select_salary() sleep(1) with allure.step("选择收款账户"): self.newSalaryOtherBoePage.selectVendorAccount('1109123456789001', accountName='UI供应商') with allure.step("输入支付金额"): self.newSalaryOtherBoePage.input_paymentAmount('200.20') with allure.step("点击单据提交"): self.newSalaryOtherBoePage.click_boeSubmitButton() with allure.step("点击单据关闭按钮"): self.newSalaryOtherBoePage.click_close() with allure.step("进行单据生成校验"): self.newSalaryOtherBoePage.click_more() self.newSalaryOtherBoePage.input_boeNumQuery(boeNum) self.newSalaryOtherBoePage.click_queryButton() with allure.step("断言结果:{}".format(self.newSalaryOtherBoePage.checkBoeNumExistIsOrNot(boeNum))): assert self.newSalaryOtherBoePage.checkBoeNumExistIsOrNot(boeNum) == True logger.info(" ----- 单据提交流程结束 ----- ") @allure.story("五险一金报账单(新)费用报销界面业务审批") @allure.step("五险一金报账单(新)费用报销界面业务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_businessApprove(self): logger.info(" ----- 单据业务审批开始 ----- ") global boeNum self.businessApprove = BusinessApprove(boeNum) content = self.businessApprove.boeBusinessApprove() logger.info(" ----- 单据业务审批开始 ----- ") assert content == '审批成功' @allure.story("五险一金报账单(新)共享中心界面财务审批") @allure.step("五险一金报账单(新)共享中心界面财务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_sharingCenterApprove(self): logger.info(" ----- 单据财务审批开始 ----- ") global boeNum self.sharingCenterApprove = SharingCenterApprove(boeNum) self.sharingCenterApprove.sharingCenterApproveChuShen() self.sharingCenterApprove.sharingCenterApproveFuShen() logger.info(" ----- 单据财务审批结束 ----- ")
class TestNewDomesticTravelBoe(): boeNum = globals() def setup_class(self): self.login = LoginDepend('easHost', 'user') self.newDomesticTravelBoePage = NewDomesticTravelBoePage( self.login.driver) def teardown_class(self): self.newDomesticTravelBoePage.driver.quit() @allure.story("差旅报账单费用报销界面单据提交") @allure.step("差旅报账单费用报销界面单据提交步骤") @allure.severity("blocker") @pytest.mark.dependency(name='submit') def test_newDomesticTravel(self, newDomesticTravelBoe_testdata): try: logger.info(" ----- 单据流程开始 ----- ") with allure.step("打开费用报销单据选择页面"): sleep(3) self.newDomesticTravelBoePage.open_boeReimburse() with allure.step("打开的单据类型为:{} ,选择的单据业务类型为: {}".format( '差旅报账单', newDomesticTravelBoe_testdata['operationType'])): try: self.newDomesticTravelBoePage.open_boe( '差旅报账单', newDomesticTravelBoe_testdata['operationType']) except: sleep(3) logger.error(" Don't find Boe, Try again") self.newDomesticTravelBoePage.open_boe( '差旅报账单', newDomesticTravelBoe_testdata['operationType']) global boeNum boeNum = self.newDomesticTravelBoePage.getBoeNum() with allure.step("输入业务类型"): self.newDomesticTravelBoePage.input_operationType( newDomesticTravelBoe_testdata['operationType']) with allure.step("输入备注"): self.newDomesticTravelBoePage.input_boeAbstract( newDomesticTravelBoe_testdata['boeAbstract']) with allure.step("增加发票"): self.newDomesticTravelBoePage.click_addInvoiceButton() self.newDomesticTravelBoePage.click_invoiceType() # 差旅火车票新增 invoiceFactory.get_invoice( self.login.driver, '火车票', 'boeInvoicePage').getTickets( # datetime.datetime.now().strftime("%Y-%m-%d") '2021-02-21', newDomesticTravelBoe_testdata['trainInvoice'] ['invoicePersonType'], newDomesticTravelBoe_testdata['trainInvoice'] ['invoicePersonName'], newDomesticTravelBoe_testdata['trainInvoice'] ['invoiceFromCity'], newDomesticTravelBoe_testdata['trainInvoice'] ['invoiceToCity'], newDomesticTravelBoe_testdata['trainInvoice'] ['invoiceSiteType'], newDomesticTravelBoe_testdata['trainInvoice'] ['invoiceTicketFee'], newDomesticTravelBoe_testdata['trainInvoice'] ['invoiceIsReplace']) with allure.step("选择部门"): self.newDomesticTravelBoePage.selectDepartment( newDomesticTravelBoe_testdata['deptCode'], newDomesticTravelBoe_testdata['deptName']) with allure.step("输入项目"): self.newDomesticTravelBoePage.input_projectId( newDomesticTravelBoe_testdata['projectName']) with allure.step("点击单据提交"): self.newDomesticTravelBoePage.click_boeSubmitButton() with allure.step("点击单据关闭按钮"): self.newDomesticTravelBoePage.click_close() with allure.step("进行单据生成校验"): self.newDomesticTravelBoePage.click_myBoeList() self.newDomesticTravelBoePage.click_moreButton() self.newDomesticTravelBoePage.input_boeNo(boeNum) self.newDomesticTravelBoePage.click_boeNoSelectButton() status = self.newDomesticTravelBoePage.selectResultIsOrNot( boeNum) logger.info(" ----- 单据提交流程结束 ----- ") assert status == True except Exception as e: logger.error("出现异常,异常信息为:{}".format(type(e))) code = 'wrong' timeNow = getNowTime() self.newDomesticTravelBoePage.screenshot(code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) self.newDomesticTravelBoePage.driver.quit() assert 1 == 0 else: logger.info("测试用例执行成功") code = 'success' timeNow = getNowTime() self.newDomesticTravelBoePage.screenshot(code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) assert 1 == 1 @allure.story("差旅报账单费用报销界面业务审批") @allure.step("差旅报账单费用报销界面业务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_businessApprove(self): logger.info(" ----- 单据业务审批开始 ----- ") global boeNum self.businessApprove = BusinessApprove(boeNum) content = self.businessApprove.boeBusinessApprove() logger.info(" ----- 单据业务审批结束 ----- ") assert content == '审批成功' @allure.story("差旅报账单共享中心界面财务审批") @allure.step("差旅报账单共享中心界面财务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_sharingCenterApprove(self): logger.info(" ----- 单据财务审批开始 ----- ") global boeNum self.sharingCenterApprove = SharingCenterApprove(boeNum) self.sharingCenterApprove.sharingCenterApproveChuShen() self.sharingCenterApprove.sharingCenterApproveFuShen() logger.info(" ----- 单据财务审批结束 ----- ")
class TestNewPurchasePrepaymentBoe(): boeNum = globals() def setup_class(self): self.login = LoginDepend('basHost', 'user') self.newPurchasePrepaymentBoePage = NewPurchasePrepaymentBoePage( self.login.driver) def teardown_class(self): self.newPurchasePrepaymentBoePage.driver.quit() @allure.story("采购预付单业务报账界面单据提交") @allure.step("采购预付单业务报账界面单据提交步骤") @allure.severity("blocker") @pytest.mark.dependency(name='submit') def test_newPurchasePrepaymentBoe(self): try: logger.info(" ----- 单据提交流程开始 ----- ") with allure.step("点击选择采购付款页面"): self.newPurchasePrepaymentBoePage.selectTabType('采购付款') with allure.step("进入采购预付单单据提交页面"): self.newPurchasePrepaymentBoePage.boeRntry('采购预付') global boeNum boeNum = self.newPurchasePrepaymentBoePage.getBoeNum() with allure.step("选择业务类型"): self.newPurchasePrepaymentBoePage.input_operationType('UI通用') with allure.step("输入备注"): self.newPurchasePrepaymentBoePage.input_boeAbstract('测试采购预付单') with allure.step("选择供应商"): self.newPurchasePrepaymentBoePage.selectVendor( 'UIGYS', vendorName='UI供应商') # with allure.step("选择关联合同"): # self.newPurchasePrepaymentBoePage.selectContract('123456789') with allure.step("输入采购订单"): self.newPurchasePrepaymentBoePage.input_loanOrderNumber( 'UI' + "".join(random.choice(string.digits) for _ in range(6))) with allure.step("选择预付类型"): self.newPurchasePrepaymentBoePage.input_loanOperationSubType( 'UI通用01') with allure.step("输入预付金额"): self.newPurchasePrepaymentBoePage.input_loanExpenseAmount( '100.00') with allure.step("选择支付方式"): self.newPurchasePrepaymentBoePage.selectPaymentMethod('UI挂账') with allure.step("点击单据提交"): self.newPurchasePrepaymentBoePage.click_boeSubmitButton() with allure.step("点击单据关闭按钮"): self.newPurchasePrepaymentBoePage.click_close() with allure.step("进行单据生成校验"): self.newPurchasePrepaymentBoePage.click_more() self.newPurchasePrepaymentBoePage.input_boeNumQuery(boeNum) self.newPurchasePrepaymentBoePage.click_queryButton() with allure.step("断言结果:{}".format( self.newPurchasePrepaymentBoePage.checkBoeNumExistIsOrNot( boeNum))): assert self.newPurchasePrepaymentBoePage.checkBoeNumExistIsOrNot( boeNum) == True except Exception as e: logger.error("出现异常,异常信息为:{}".format(type(e))) code = 'wrong' timeNow = getNowTime() self.newPurchasePrepaymentBoePage.screenshot(code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) self.newPurchasePrepaymentBoePage.driver.quit() assert 1 == 0 else: logger.info("测试用例执行成功") code = 'success' timeNow = getNowTime() self.newPurchasePrepaymentBoePage.screenshot(code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) boeNumPath = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'boeNum.json') writeBoeNum(boeNumPath, boeNum) assert 1 == 1 @allure.story("采购预付单费用报销界面业务审批") @allure.step("采购预付单费用报销界面业务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_businessApprove(self): logger.info(" ----- 单据业务审批开始 ----- ") global boeNum self.businessApprove = BusinessApprove(boeNum) content = self.businessApprove.boeBusinessApprove() logger.info(" ----- 单据业务审批开始 ----- ") assert content == '审批成功' @allure.story("采购预付单共享中心界面财务审批") @allure.step("采购预付单共享中心界面财务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_sharingCenterApprove(self): logger.info(" ----- 单据财务审批开始 ----- ") global boeNum self.sharingCenterApprove = SharingCenterApprove(boeNum) self.sharingCenterApprove.sharingCenterApproveChuShen() self.sharingCenterApprove.sharingCenterApproveFuShen() logger.info(" ----- 单据财务审批结束 ----- ")
class TestCostEstimateBoe(): boeNum = globals() def setup_class(self): self.login = LoginDepend('basHost', 'user') self.costEstimateBoePage = CostEstimateBoePage(self.login.driver) def teardown_class(self): self.costEstimateBoePage.driver.quit() @allure.story("成本暂估单(旧)业务报账界面单据提交") @allure.step("成本暂估单(旧)业务报账界面单据提交步骤") @allure.severity("blocker") @pytest.mark.dependency(name='submit') def test_costEstimateBoe(self): try: logger.info(" ----- 单据提交流程开始 ----- ") with allure.step("点击选择采购付款页面"): self.costEstimateBoePage.selectTabType('采购付款') with allure.step("进入成本暂估单(旧)单据提交页面"): self.costEstimateBoePage.boeRntry('成本暂估(旧)') global boeNum boeNum = self.costEstimateBoePage.getBoeNum() with allure.step("选择业务类型"): self.costEstimateBoePage.input_operationType('UI通用') with allure.step("输入备注"): self.costEstimateBoePage.input_boeAbstract('测试成本暂估单(旧)') with allure.step("选择供应商"): self.costEstimateBoePage.selectVendor('UIGYS', vendorName='UI供应商') # with allure.step("选择关联合同"): # self.costEstimateBoePage.selectContract('hc00000020') with allure.step("输入订单编号"): self.costEstimateBoePage.input_costOrderNumber('hcOrder001') with allure.step("选择业务小类"): self.costEstimateBoePage.input_costOperationSubType('UI通用01') with allure.step("输入总金额"): self.costEstimateBoePage.input_costExpenseAmount('100.00') with allure.step("选择责任部门"): self.costEstimateBoePage.selectCc('UIDP', 'UI部门') with allure.step("选择项目"): self.costEstimateBoePage.input_costProject('UI项目') with allure.step("输入备注"): self.costEstimateBoePage.input_costRemark('测试成本暂估单(旧)') with allure.step("点击单据提交"): self.costEstimateBoePage.click_boeSubmitButton() with allure.step("点击单据关闭按钮"): self.costEstimateBoePage.click_close() with allure.step("进行单据生成校验"): self.costEstimateBoePage.click_more() self.costEstimateBoePage.input_boeNumQuery(boeNum) self.costEstimateBoePage.click_queryButton() with allure.step("断言结果:{}".format( self.costEstimateBoePage.checkBoeNumExistIsOrNot(boeNum))): assert self.costEstimateBoePage.checkBoeNumExistIsOrNot( boeNum) == True except Exception as e: logger.error("出现异常,异常信息为:{}".format(type(e))) code = 'wrong' timeNow = getNowTime() self.costEstimateBoePage.screenshot(code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) self.costEstimateBoePage.driver.quit() assert 1 == 0 else: logger.info("测试用例执行成功") code = 'success' timeNow = getNowTime() self.costEstimateBoePage.screenshot(code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) assert 1 == 1 @allure.story("成本暂估单(旧)费用报销界面业务审批") @allure.step("成本暂估单(旧)费用报销界面业务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_businessApprove(self): logger.info(" ----- 单据业务审批开始 ----- ") global boeNum self.businessApprove = BusinessApprove(boeNum) content = self.businessApprove.boeBusinessApprove() logger.info(" ----- 单据业务审批开始 ----- ") assert content == '审批成功' @allure.story("成本暂估单(旧)共享中心界面财务审批") @allure.step("成本暂估单(旧)共享中心界面财务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_sharingCenterApprove(self): logger.info(" ----- 单据财务审批开始 ----- ") global boeNum self.sharingCenterApprove = SharingCenterApprove(boeNum) self.sharingCenterApprove.sharingCenterApproveChuShen() self.sharingCenterApprove.sharingCenterApproveFuShen() logger.info(" ----- 单据财务审批结束 ----- ")
class TestNewDailyExpenseBoe(): boeNum = globals() def setup_class(self): self.login = LoginDepend('easHost', 'user') self.newDailyExpenseBoePage = NewDailyExpenseBoePage(self.login.driver) def teardown_class(self): self.newDailyExpenseBoePage.driver.quit() @allure.story("日常费用报账单费用报销界面单据提交") @allure.step("日常费用报账单费用报销界面单据提交步骤") @allure.severity("blocker") @pytest.mark.dependency(name='submit') def test_newDailyExpense(self, newDailyExpenseBoe_testdata): try: logger.info(" ----- 单据流程开始 ----- ") with allure.step("打开费用报销单据选择页面"): sleep(3) self.newDailyExpenseBoePage.open_boeReimburse() with allure.step("打开的单据类型为:{} ,选择的单据业务类型为: {}".format('日常费用报账单', newDailyExpenseBoe_testdata['operationType'])): try: self.newDailyExpenseBoePage.open_boe('日常费用报账单', newDailyExpenseBoe_testdata['operationType']) except: sleep(3) logger.error(" Don't find Boe, Try again") self.newDailyExpenseBoePage.open_boe('日常费用报账单', newDailyExpenseBoe_testdata['operationType']) global boeNum boeNum = self.newDailyExpenseBoePage.getBoeNum() with allure.step("输入业务类型"): self.newDailyExpenseBoePage.input_operationType(newDailyExpenseBoe_testdata['operationType']) with allure.step("输入备注"): self.newDailyExpenseBoePage.input_boeAbstract(newDailyExpenseBoe_testdata['boeAbstract']) # with allure.step("选择关联发票"): # self.newDailyExpenseBoePage.selectRelatedInvoice(newDailyExpenseBoe_testdata['relatedInvoice']) with allure.step("点击新增发票"): self.newDailyExpenseBoePage.click_addInvoiceButton() self.newDailyExpenseBoePage.click_invoiceType() invoiceFactory.get_invoice(self.login.driver, '增值税普通发票', 'boeInvoicePage').getTickets( date = datetime.datetime.now().strftime('%Y-%m-%d'), invoiceNo = ''.join(random.choice(string.digits) for _ in range(12)), invoiceCode = ''.join(random.choice(string.digits) for _ in range(8)), feeTotal = '100.00', tax = '0.00', checkCode = '123456') with allure.step("输入业务类型"): try: self.newDailyExpenseBoePage.selectOperationSubType(newDailyExpenseBoe_testdata['operationSubType']) except: sleep(1) self.newDailyExpenseBoePage.selectOperationSubType(newDailyExpenseBoe_testdata['operationSubType']) with allure.step("选择部门"): self.newDailyExpenseBoePage.selectDepartment(newDailyExpenseBoe_testdata['deptCode'], newDailyExpenseBoe_testdata['deptName']) with allure.step("输入项目"): self.newDailyExpenseBoePage.input_projectId(newDailyExpenseBoe_testdata['projectName']) with allure.step("点击单据提交"): self.newDailyExpenseBoePage.click_boeSubmitButton() with allure.step("点击单据关闭按钮"): self.newDailyExpenseBoePage.click_close() with allure.step("进行单据生成校验"): self.newDailyExpenseBoePage.click_myBoeList() self.newDailyExpenseBoePage.click_moreButton() self.newDailyExpenseBoePage.input_boeNo(boeNum) self.newDailyExpenseBoePage.click_boeNoSelectButton() status = self.newDailyExpenseBoePage.selectResultIsOrNot(boeNum) logger.info(" ----- 单据提交流程结束 ----- ") assert status == True except Exception as e: logger.error("出现异常,异常信息为:{}".format(type(e))) code = 'wrong' timeNow = getNowTime() self.newDailyExpenseBoePage.screenshot(code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) self.newDailyExpenseBoePage.driver.quit() assert 1 == 0 else: logger.info("测试用例执行成功") code = 'success' timeNow = getNowTime() self.newDailyExpenseBoePage.screenshot(code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) assert 1 == 1 @allure.story("日常费用报账单费用报销界面业务审批") @allure.step("日常费用报账单费用报销界面业务审批步骤") @pytest.mark.dependency(depends=["submit"] ) def test_businessApprove(self): logger.info(" ----- 单据业务审批开始 ----- ") global boeNum self.businessApprove = BusinessApprove(boeNum) content = self.businessApprove.boeBusinessApprove() logger.info(" ----- 单据业务审批开始 ----- ") assert content == '审批成功' @allure.story("日常费用报账单共享中心界面财务审批") @allure.step("日常费用报账单共享中心界面财务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_sharingCenterApprove(self): logger.info(" ----- 单据财务审批开始 ----- ") global boeNum self.sharingCenterApprove = SharingCenterApprove(boeNum) self.sharingCenterApprove.sharingCenterApproveChuShen() self.sharingCenterApprove.sharingCenterApproveFuShen() logger.info(" ----- 单据财务审批结束 ----- ")
class TestEmployeeRepaymentBoe(object): boeNum = globals() def setup_class(self): boeNumPath = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'boeNum.json') self.login = LoginDepend('easHost', 'user') self.employeeRepaymentBoePage = EmployeeRepaymentBoePage( self.login.driver) self.loadBoeNum = readBoeNum(boeNumPath) def teardown_class(self): self.employeeRepaymentBoePage.driver.quit() @allure.story("员工还款单费用报销界面单据提交") @allure.step("员工还款单费用报销界面单据提交步骤") @allure.severity("blocker") @pytest.mark.dependency(name='submit') def test_employeeRepayment(self, employeeRepaymentBoe_testdata): try: logger.info(" ----- 单据流程开始 ----- ") with allure.step("打开借款还款单据选择页面"): sleep(3) self.employeeRepaymentBoePage.open_boeBorrow() with allure.step("打开的单据类型为:{} ,选择的单据业务类型为: {}".format( '员工还款单', employeeRepaymentBoe_testdata['operationType'])): try: self.employeeRepaymentBoePage.open_boe( '员工还款单', employeeRepaymentBoe_testdata['operationType']) except: sleep(3) logger.error(" Don't find Boe, Try again") self.employeeRepaymentBoePage.open_boe( '员工还款单', employeeRepaymentBoe_testdata['operationType']) global boeNum boeNum = self.employeeRepaymentBoePage.getBoeNum() self.boeFee = self.employeeRepaymentBoePage.selectWriteOffBoe( self.loadBoeNum) with allure.step("输入业务类型"): self.employeeRepaymentBoePage.input_operationType( employeeRepaymentBoe_testdata['operationType']) with allure.step("输入备注"): self.employeeRepaymentBoePage.input_boeAbstract( employeeRepaymentBoe_testdata['boeAbstract']) with allure.step("输入还款方式"): self.employeeRepaymentBoePage.selectReplaymentType( employeeRepaymentBoe_testdata['operationSubType']) with allure.step("输入还款金额"): # self.employeeRepaymentBoePage.input_expenseAmount(self.boeFee) self.employeeRepaymentBoePage.input_expenseAmount('100..00') with allure.step("输入收款账户"): self.employeeRepaymentBoePage.selectCollectionAccount( employeeRepaymentBoe_testdata['favoriteId']) with allure.step("输入还款日期"): self.employeeRepaymentBoePage.selectLoanRepaymentDate( datetime.datetime.now().strftime("%Y-%m-%d")) with allure.step("输入还困说明"): self.employeeRepaymentBoePage.input_remark( employeeRepaymentBoe_testdata['remark']) with allure.step("点击单据提交"): self.employeeRepaymentBoePage.click_boeSubmitButton() with allure.step("点击单据关闭按钮"): self.employeeRepaymentBoePage.click_close() with allure.step("进行单据生成校验"): self.employeeRepaymentBoePage.click_myBoeList() self.employeeRepaymentBoePage.click_moreButton() self.employeeRepaymentBoePage.input_boeNo(boeNum) self.employeeRepaymentBoePage.click_boeNoSelectButton() status = self.employeeRepaymentBoePage.selectResultIsOrNot( boeNum) logger.info(" ----- 单据提交流程结束 ----- ") assert status == True except Exception as e: logger.error("出现异常,异常信息为:{}".format(type(e))) code = 'wrong' timeNow = getNowTime() self.employeeRepaymentBoePage.screenshot(code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) self.employeeRepaymentBoePage.driver.quit() assert 1 == 0 else: logger.info("测试用例执行成功") code = 'success' timeNow = getNowTime() self.employeeRepaymentBoePage.screenshot(code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) assert 1 == 1 @allure.story("员工还款单费用报销界面业务审批") @allure.step("员工还款单费用报销界面业务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_businessApprove(self): logger.info(" ----- 单据业务审批开始 ----- ") global boeNum self.businessApprove = BusinessApprove(boeNum) content = self.businessApprove.boeBusinessApprove() logger.info(" ----- 单据业务审批开始 ----- ") assert content == '审批成功' @allure.story("员工还款单共享中心界面财务审批") @allure.step("员工还款单共享中心界面财务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_sharingCenterApprove(self): logger.info(" ----- 单据财务审批开始 ----- ") global boeNum self.sharingCenterApprove = SharingCenterApprove(boeNum) self.sharingCenterApprove.sharingCenterApproveChuShen() self.sharingCenterApprove.sharingCenterApproveFuShen() logger.info(" ----- 单据财务审批结束 ----- ")
class TestCostEstimateBoe(): boeNum = globals() def setup_class(self): self.login = LoginDepend('basHost', 'user') self.newPurchasingBillBoePage = NewPurchasingBillBoePage( self.login.driver) def teardown_class(self): # self.newPurchasingBillBoePage.driver.quit() pass @allure.story("采购报账单业务报账界面单据提交") @allure.step("采购报账单业务报账界面单据提交步骤") @allure.severity("blocker") @pytest.mark.dependency(name='submit') def test_newPurchasingBillBoe(self): try: logger.info(" ----- 单据提交流程开始 ----- ") with allure.step("点击选择采购付款页面"): self.newPurchasingBillBoePage.selectTabType('采购付款') with allure.step("进入采购报账单单据提交页面"): self.newPurchasingBillBoePage.boeRntry('采购报账') global boeNum boeNum = self.newPurchasingBillBoePage.getBoeNum() with allure.step("选择业务类型"): self.newPurchasingBillBoePage.input_operationType('UI通用') with allure.step("输入备注"): self.newPurchasingBillBoePage.input_boeAbstract('测试采购报账单') with allure.step("选择供应商"): self.newPurchasingBillBoePage.selectVendor('UIGYS', vendorName='UI供应商') # with allure.step("选择关联合同"): # self.newPurchasingBillBoePage.selectContract('hc00000022') with allure.step("输入项目"): self.newPurchasingBillBoePage.input_project('UI项目') with allure.step("选择成本中心"): self.newPurchasingBillBoePage.selectExpenseDept( 'UIDP', deptName='UI部门') # with allure.step("建立关联"): # self.newPurchasingBillBoePage.click_makeRelated() # self.newPurchasingBillBoePage.relateAcceptancesheetAndInvoice('ysd005', '88800001') with allure.step("输入支付金额"): self.newPurchasingBillBoePage.selectAccountReceivable('质保金付款') with allure.step("点击单据提交"): self.newPurchasingBillBoePage.click_boeSubmitButton() with allure.step("点击单据关闭按钮"): self.newPurchasingBillBoePage.click_close() with allure.step("进行单据生成校验"): self.newPurchasingBillBoePage.click_more() self.newPurchasingBillBoePage.input_boeNumQuery(boeNum) self.newPurchasingBillBoePage.click_queryButton() with allure.step("断言结果:{}".format( self.newPurchasingBillBoePage.checkBoeNumExistIsOrNot( boeNum))): assert self.newPurchasingBillBoePage.checkBoeNumExistIsOrNot( boeNum) == True except Exception as e: logger.error("出现异常,异常信息为:{}".format(type(e))) code = 'wrong' timeNow = getNowTime() self.newPurchasingBillBoePage.screenshot(code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) self.newPurchasingBillBoePage.driver.quit() assert 1 == 0 else: logger.info("测试用例执行成功") code = 'success' timeNow = getNowTime() self.newPurchasingBillBoePage.screenshot(code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) assert 1 == 1 @allure.story("采购报账单费用报销界面业务审批") @allure.step("采购报账单费用报销界面业务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_businessApprove(self): logger.info(" ----- 单据业务审批开始 ----- ") global boeNum self.businessApprove = BusinessApprove(boeNum) content = self.businessApprove.boeBusinessApprove() logger.info(" ----- 单据业务审批开始 ----- ") assert content == '审批成功' @allure.story("采购报账单共享中心界面财务审批") @allure.step("采购报账单共享中心界面财务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_sharingCenterApprove(self): logger.info(" ----- 单据财务审批开始 ----- ") global boeNum self.sharingCenterApprove = SharingCenterApprove(boeNum) self.sharingCenterApprove.sharingCenterApproveChuShen() self.sharingCenterApprove.sharingCenterApproveFuShen() logger.info(" ----- 单据财务审批结束 ----- ")
class TestNewCostEstimateBoe(): boeNum = globals() def setup_class(self): self.login = LoginDepend('basHost', 'user') self.newCostEstimateBoePage = NewCostEstimateBoePage(self.login.driver) def teardown_class(self): self.newCostEstimateBoePage.driver.quit() @allure.story("成本暂估单(新)业务报账界面单据提交") @allure.step("成本暂估单(新)业务报账界面单据提交步骤") @allure.severity("blocker") @pytest.mark.dependency(name='submit') def test_newCostEstimateBoe(self): try: logger.info(" ----- 单据提交流程开始 ----- ") with allure.step("点击选择采购付款页面"): self.newCostEstimateBoePage.selectTabType('采购付款') with allure.step("进入成本暂估单(新)单据提交页面"): self.newCostEstimateBoePage.boeRntry('成本暂估(新)') global boeNum boeNum = self.newCostEstimateBoePage.getBoeNum() with allure.step("选择业务类型"): self.newCostEstimateBoePage.input_operationType('UI通用') with allure.step("输入备注"): self.newCostEstimateBoePage.input_boeAbstract('测试成本暂估单(新)') with allure.step("选择项目"): self.newCostEstimateBoePage.input_project('UI项目') with allure.step("选择供应商"): self.newCostEstimateBoePage.selectVendor('UIGYS', vendorName='UI供应商') # with allure.step("选择关联合同"): # self.newCostEstimateBoePage.selectContract('hc00000020') with allure.step("选择成本中心"): self.newCostEstimateBoePage.selectCc('UICBZX', ccName='UI成本中心') acceptanceNo = record.readDataFromRecord( type='acceptanceLedgerData')['acceptanceNo'] with allure.step("关联验收单"): self.newCostEstimateBoePage.relateAcceptanceLedger( acceptanceNo) with allure.step("点击单据提交"): self.newCostEstimateBoePage.click_boeSubmitButton() with allure.step("点击单据关闭按钮"): self.newCostEstimateBoePage.click_close() with allure.step("进行单据生成校验"): self.newCostEstimateBoePage.click_more() self.newCostEstimateBoePage.input_boeNumQuery(boeNum) self.newCostEstimateBoePage.click_queryButton() with allure.step("断言结果:{}".format( self.newCostEstimateBoePage.checkBoeNumExistIsOrNot( boeNum))): assert self.newCostEstimateBoePage.checkBoeNumExistIsOrNot( boeNum) == True except Exception as e: logger.error("出现异常,异常信息为:{}".format(type(e))) code = 'wrong' timeNow = getNowTime() self.newCostEstimateBoePage.screenshot(code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) self.newCostEstimateBoePage.driver.quit() assert 1 == 0 else: logger.info("测试用例执行成功") code = 'success' timeNow = getNowTime() self.newCostEstimateBoePage.screenshot(code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) assert 1 == 1 @allure.story("成本暂估单(新)费用报销界面业务审批") @allure.step("成本暂估单(新)费用报销界面业务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_businessApprove(self): logger.info(" ----- 单据业务审批开始 ----- ") global boeNum self.businessApprove = BusinessApprove(boeNum) content = self.businessApprove.boeBusinessApprove() logger.info(" ----- 单据业务审批开始 ----- ") assert content == '审批成功' @allure.story("成本暂估单(新)共享中心界面财务审批") @allure.step("成本暂估单(新)共享中心界面财务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_sharingCenterApprove(self): logger.info(" ----- 单据财务审批开始 ----- ") global boeNum self.sharingCenterApprove = SharingCenterApprove(boeNum) self.sharingCenterApprove.sharingCenterApproveChuShen() self.sharingCenterApprove.sharingCenterApproveFuShen() logger.info(" ----- 单据财务审批结束 ----- ")
class TestNewIncomeStatementBoe(): boeNum = globals() def setup_class(self): self.publicLogin = LoginDepend('basHost', 'user') self.newIncomeStatementBoePage = NewIncomeStatementBoePage( self.publicLogin.driver) def teardown_class(self): self.newIncomeStatementBoePage.driver.quit() @allure.story("收入报账单业务报账界面单据提交") @allure.step("差旅申请单业务报账界面单据提交步骤") @allure.severity("blocker") @pytest.mark.dependency(name='submit') def test_newIncomeStatementBoe(self, newIncomeStatementBoe_testdata): try: logger.info(" ----- 单据提交流程开始 ----- ") with allure.step("点击选择收入收款页面"): self.newIncomeStatementBoePage.selectTabType('收入收款') with allure.step("进入收入报账单单据提交页面"): self.newIncomeStatementBoePage.boeRntry('收入报账') global boeNum boeNum = self.newIncomeStatementBoePage.getBoeNum() with allure.step("选择业务类型"): self.newIncomeStatementBoePage.input_operationType( newIncomeStatementBoe_testdata['operationType']) with allure.step("输入备注"): self.newIncomeStatementBoePage.input_boeAbstract( newIncomeStatementBoe_testdata['boeAbstract']) with allure.step("选择客户"): self.newIncomeStatementBoePage.selectVendor( newIncomeStatementBoe_testdata['vendor']['vendorCode'], vendorName=newIncomeStatementBoe_testdata['vendor'] ['vendorName']) # with allure.step("选择关联合同"): # self.newIncomeStatementBoePage.selectContract(newIncomeStatementBoe_testdata['contract']) with allure.step("输入订单编号"): self.newIncomeStatementBoePage.input_orderNumber( newIncomeStatementBoe_testdata['orderNumber']) with allure.step("选择业务类型"): self.newIncomeStatementBoePage.input_operationSubType( newIncomeStatementBoe_testdata['operationSubType']) with allure.step("选择利润中心"): self.newIncomeStatementBoePage.selectExpenseDept( newIncomeStatementBoe_testdata['expenseDept']['deptCode'], deptName=newIncomeStatementBoe_testdata['expenseDept'] ['deptName']) with allure.step("输入金额"): self.newIncomeStatementBoePage.input_incomeDetailExpenseAmount( newIncomeStatementBoe_testdata['expenseAmount']) with allure.step("输入税额"): self.newIncomeStatementBoePage.input_incomeDetailTaxAmount( newIncomeStatementBoe_testdata['taxAmount']) with allure.step("点击单据提交"): self.newIncomeStatementBoePage.click_boeSubmitButton() with allure.step("点击单据关闭按钮"): self.newIncomeStatementBoePage.click_close() with allure.step("进行单据生成校验"): self.newIncomeStatementBoePage.click_more() self.newIncomeStatementBoePage.input_boeNumQuery(boeNum) self.newIncomeStatementBoePage.click_queryButton() with allure.step("断言结果:{}".format( self.newIncomeStatementBoePage.checkBoeNumExistIsOrNot( boeNum))): assert self.newIncomeStatementBoePage.checkBoeNumExistIsOrNot( boeNum) == True logger.info(" ----- 单据提交流程结束 ----- ") except Exception as e: logger.error("出现异常,异常信息为:{}".format(type(e))) code = 'wrong' timeNow = getNowTime() self.newIncomeStatementBoePage.screenshot(code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) self.newIncomeStatementBoePage.driver.quit() assert 1 == 0 else: logger.info("测试用例执行成功") code = 'success' timeNow = getNowTime() self.newIncomeStatementBoePage.screenshot(code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) assert 1 == 1 @allure.story("收入报账单费用报销界面业务审批") @allure.step("收入报账单费用报销界面业务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_businessApprove(self): logger.info(" ----- 单据业务审批开始 ----- ") global boeNum self.businessApprove = BusinessApprove(boeNum) content = self.businessApprove.boeBusinessApprove() logger.info(" ----- 单据业务审批开始 ----- ") assert content == '审批成功' @allure.story("收入报账单共享中心界面财务审批") @allure.step("收入报账单共享中心界面财务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_sharingCenterApprove(self): logger.info(" ----- 单据财务审批开始 ----- ") global boeNum self.sharingCenterApprove = SharingCenterApprove(boeNum) self.sharingCenterApprove.sharingCenterApproveChuShen() self.sharingCenterApprove.sharingCenterApproveFuShen() logger.info(" ----- 单据财务审批结束 ----- ")
class TestApplyTravelBoe(object): boeNum = globals() def setup_class(self): self.login = LoginDepend('easHost', 'user') self.applyTravelBoePage = ApplyTravelBoePage(self.login.driver) def teardown_class(self): self.applyTravelBoePage.driver.quit() @allure.story("差旅申请单费用报销界面单据提交") @allure.step("差旅申请单费用报销界面单据提交步骤") @allure.severity("blocker") @pytest.mark.dependency(name='submit') def test_applyTravel(self, applyTravelBoe_testdata): try: logger.info(" ----- 单据流程开始 ----- ") with allure.step("打开事项申请单据选择页面"): sleep(3) self.applyTravelBoePage.open_boeApply() with allure.step("打开的单据类型为:{} ,选择的单据业务类型为: {}".format('差旅申请单', applyTravelBoe_testdata['operationType'])): try: self.applyTravelBoePage.open_boe('差旅申请单', applyTravelBoe_testdata['operationType']) except: logger.error(" Don't find Boe, Try again") sleep(3) self.comFeeApplyBoePage.open_boe('通用费用申请单', applyTravelBoe_testdata['operationType']) global boeNum boeNum = self.applyTravelBoePage.getBoeNum() with allure.step("输入业务类型"): self.applyTravelBoePage.input_operationType(applyTravelBoe_testdata['operationType']) with allure.step("输入备注"): self.applyTravelBoePage.input_boeAbstract(applyTravelBoe_testdata['boeAbstract']) with allure.step("输入金额"): self.applyTravelBoePage.input_applyAmount(applyTravelBoe_testdata['applyAmount']) with allure.step("输入开始时间:{}".format(applyTravelBoe_testdata['beginDateStr'])): self.applyTravelBoePage.input_beginDateStr(applyTravelBoe_testdata['beginDateStr']) with allure.step("输入结束时间:{}".format(applyTravelBoe_testdata['endDateStr'])): self.applyTravelBoePage.input_endDateStr(applyTravelBoe_testdata['endDateStr']) with allure.step("输入出差任务"): self.applyTravelBoePage.select_travelTask(applyTravelBoe_testdata['travelTask']) with allure.step("输入出发城市"): self.applyTravelBoePage.input_fromCity(applyTravelBoe_testdata['fromCity']) with allure.step("输入到达城市"): self.applyTravelBoePage.input_toCity(applyTravelBoe_testdata['toCity']) with allure.step("输入交通工具"): self.applyTravelBoePage.select_transportation(applyTravelBoe_testdata['transportation']) with allure.step("点击单据提交"): self.applyTravelBoePage.click_boeSubmitButton() with allure.step("点击单据关闭按钮"): self.applyTravelBoePage.click_close() with allure.step("进行单据生成校验"): self.applyTravelBoePage.click_myBoeList() self.applyTravelBoePage.click_moreButton() self.applyTravelBoePage.input_boeNo(boeNum) self.applyTravelBoePage.click_boeNoSelectButton() status = self.applyTravelBoePage.selectResultIsOrNot(boeNum) logger.info(" ----- 单据提交流程结束 ----- ") assert status == True except Exception as e: logger.error("出现异常,异常信息为:{}".format(type(e))) code = 'wrong' timeNow = getNowTime() self.applyTravelBoePage.screenshot(code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) self.applyTravelBoePage.driver.quit() assert 1 == 0 else: logger.info("测试用例执行成功") code = 'success' timeNow = getNowTime() self.applyTravelBoePage.screenshot(code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) assert 1 == 1 @allure.story("差旅申请单费用报销界面业务审批") @allure.step("差旅申请单费用报销界面业务审批步骤") @pytest.mark.dependency(depends=["submit"] ) def test_businessApprove(self): logger.info(" ----- 单据业务审批开始 ----- ") global boeNum self.businessApprove = BusinessApprove(boeNum) content = self.businessApprove.boeBusinessApprove() logger.info(" ----- 单据业务审批开始 ----- ") assert content == '审批成功' @allure.story("差旅申请单共享中心界面财务审批") @allure.step("差旅申请单共享中心界面财务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_sharingCenterApprove(self): logger.info(" ----- 单据财务审批开始 ----- ") global boeNum self.sharingCenterApprove = SharingCenterApprove(boeNum) self.sharingCenterApprove.sharingCenterApproveChuShen() self.sharingCenterApprove.sharingCenterApproveFuShen() logger.info(" ----- 单据财务审批结束 ----- ")
class TestNewWithholdingAmortization(): boeNum = globals() def setup_class(self): self.login = LoginDepend('basHost', 'user') self.newWithholdingAmortizationPage = NewWithholdingAmortizationPage( self.login.driver) def teardown_class(self): self.newWithholdingAmortizationPage.driver.quit() @allure.story("预提申请单(新)业务报账界面单据提交") @allure.step("预提申请单(新)业务报账界面单据提交步骤") @allure.severity("blocker") @pytest.mark.dependency(name='submit') def test_newWithholdingAmortization(self): logger.info(" ----- 单据提交流程开始 ----- ") with allure.step("点击选择财务记账页面"): self.newWithholdingAmortizationPage.selectTabType('财务记账') with allure.step("进入预提申请单(新)单据提交页面"): self.newWithholdingAmortizationPage.boeRntry('预提申请单(新)') global boeNum boeNum = self.newWithholdingAmortizationPage.getBoeNum() with allure.step("选择业务类型"): self.newWithholdingAmortizationPage.input_operationType('UI通用') with allure.step("输入备注"): self.newWithholdingAmortizationPage.input_boeAbstract('测试预提申请单(新)') with allure.step("选择客商"): self.newWithholdingAmortizationPage.input_vendor('UI供应商1') with allure.step("选择预提规则"): self.newWithholdingAmortizationPage.selectYuTiRule('按月平均计算') # with allure.step("选择合同"): # self.newWithholdingAmortizationPage.selectContract('hc00000022') with allure.step("输入预提类型"): self.newWithholdingAmortizationPage.input_costOperationSubType( 'UI通用01') with allure.step("选择责任部门"): self.newWithholdingAmortizationPage.selectCostExpenseDept( 'UIDP', deptName='UI部门') with allure.step("输入项目"): self.newWithholdingAmortizationPage.input_costProject('UI项目') with allure.step("输入金额"): self.newWithholdingAmortizationPage.input_costExpenseAmount( '100.00') with allure.step("选择开始时间"): self.newWithholdingAmortizationPage.select_costBeginDateStr( datetime.datetime.now().strftime("%Y-%m-%d")) with allure.step("输入期限(月)"): self.newWithholdingAmortizationPage.input_costTheTerm('3') with allure.step("选择贷方科目"): self.newWithholdingAmortizationPage.input_voucherAccount('UI科目1') with allure.step("自动计算"): self.newWithholdingAmortizationPage.click_autoCalculation() with allure.step("点击单据提交"): self.newWithholdingAmortizationPage.click_boeSubmitButton() with allure.step("点击单据关闭按钮"): self.newWithholdingAmortizationPage.click_close() with allure.step("进行单据生成校验"): self.newWithholdingAmortizationPage.click_more() self.newWithholdingAmortizationPage.input_boeNumQuery(boeNum) self.newWithholdingAmortizationPage.click_queryButton() with allure.step("断言结果:{}".format( self.newWithholdingAmortizationPage.checkBoeNumExistIsOrNot( boeNum))): assert self.newWithholdingAmortizationPage.checkBoeNumExistIsOrNot( boeNum) == True @allure.story("预提申请单(新)费用报销界面业务审批") @allure.step("预提申请单(新)费用报销界面业务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_businessApprove(self): logger.info(" ----- 单据业务审批开始 ----- ") global boeNum self.businessApprove = BusinessApprove(boeNum) content = self.businessApprove.boeBusinessApprove() logger.info(" ----- 单据业务审批开始 ----- ") assert content == '审批成功' @allure.story("预提申请单(新)共享中心界面财务审批") @allure.step("预提申请单(新)共享中心界面财务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_sharingCenterApprove(self): logger.info(" ----- 单据财务审批开始 ----- ") global boeNum self.sharingCenterApprove = SharingCenterApprove(boeNum) self.sharingCenterApprove.sharingCenterApproveChuShen() self.sharingCenterApprove.sharingCenterApproveFuShen() logger.info(" ----- 单据财务审批结束 ----- ")
class TestNewObsoleteRedLetterInvoiceApplictationBoe(): boeNum = globals() def setup_class(self): self.publicLogin = LoginDepend('basHost', 'user') self.newObsoleteRedLetterInvoiceApplictationBoePage = NewObsoleteRedLetterInvoiceApplictationBoePage( self.publicLogin.driver) def teardown_class(self): self.newObsoleteRedLetterInvoiceApplictationBoePage.driver.quit() @allure.story("作废/红字发票申请单(新)业务报账界面单据提交") @allure.step("作废/红字发票申请单(新)业务报账界面单据提交步骤") @allure.severity("blocker") @pytest.mark.dependency(name='submit') def test_newObsoleteRedLetterInvoiceApplictationBoePage(self): try: logger.info(" ----- 单据提交流程开始 ----- ") with allure.step("点击选择收入收款页面"): self.newObsoleteRedLetterInvoiceApplictationBoePage.selectTabType( '收入收款') with allure.step("进入作废/红字发票申请单(新)单据提交页面"): self.newObsoleteRedLetterInvoiceApplictationBoePage.boeRntry( '作废/红字发票申请单(新)') global boeNum boeNum = self.newObsoleteRedLetterInvoiceApplictationBoePage.getBoeNum( ) with allure.step("选择业务类型"): self.newObsoleteRedLetterInvoiceApplictationBoePage.input_operationType( 'UI红字发票') with allure.step("输入备注"): self.newObsoleteRedLetterInvoiceApplictationBoePage.input_boeAbstract( '测试作废/红字发票申请单(新)') boeNumPath = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'invoiceNum.json') self.invoiceNum = readInvoiceNum(boeNumPath) with allure.step("选择关联发票"): self.newObsoleteRedLetterInvoiceApplictationBoePage.relateTargetInvoice( self.invoiceNum) with allure.step("点击单据提交"): self.newObsoleteRedLetterInvoiceApplictationBoePage.click_boeSubmitButton( ) with allure.step("点击单据关闭按钮"): self.newObsoleteRedLetterInvoiceApplictationBoePage.click_close( ) with allure.step("进行单据生成校验"): self.newObsoleteRedLetterInvoiceApplictationBoePage.click_more( ) self.newObsoleteRedLetterInvoiceApplictationBoePage.input_boeNumQuery( boeNum) self.newObsoleteRedLetterInvoiceApplictationBoePage.click_queryButton( ) with allure.step("断言结果:{}".format( self.newObsoleteRedLetterInvoiceApplictationBoePage. checkBoeNumExistIsOrNot(boeNum))): assert self.newObsoleteRedLetterInvoiceApplictationBoePage.checkBoeNumExistIsOrNot( boeNum) == True logger.info(" ----- 单据提交流程结束 ----- ") except Exception as e: logger.error("出现异常,异常信息为:{}".format(type(e))) code = 'wrong' timeNow = getNowTime() self.newObsoleteRedLetterInvoiceApplictationBoePage.screenshot( code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) self.newObsoleteRedLetterInvoiceApplictationBoePage.driver.quit() assert 1 == 0 else: logger.info("测试用例执行成功") code = 'success' timeNow = getNowTime() self.newObsoleteRedLetterInvoiceApplictationBoePage.screenshot( code, timeNow) allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot", attachment_type=allure.attachment_type.PNG) assert 1 == 1 @allure.story("作废/红字发票申请单(新)费用报销界面业务审批") @allure.step("作废/红字发票申请单(新)费用报销界面业务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_businessApprove(self): logger.info(" ----- 单据业务审批开始 ----- ") global boeNum self.businessApprove = BusinessApprove(boeNum) content = self.businessApprove.boeBusinessApprove() logger.info(" ----- 单据业务审批开始 ----- ") assert content == '审批成功' @allure.story("作废/红字发票申请单(新)共享中心界面财务审批") @allure.step("作废/红字发票申请单(新)共享中心界面财务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_sharingCenterApprove(self): logger.info(" ----- 单据财务审批开始 ----- ") global boeNum self.sharingCenterApprove = SharingCenterApprove(boeNum) invoiceNum = ''.join(random.choice(string.digits) for _ in range(8)) invoiceDataDict = { 'invoiceNo': ''.join(random.choice(string.digits) for _ in range(12)), 'invoiceCode': invoiceNum, 'invoiceDate': datetime.datetime.now().strftime('%Y-%m-%d'), 'invoiceFee': '-1000.00', 'invoiceTypeCode': '增值税普通发票', 'checkCode': '123456' } self.sharingCenterApprove.sharingCenterApproveChuShen( modify=True, **invoiceDataDict) self.sharingCenterApprove.sharingCenterApproveFuShen() logger.info(" ----- 单据财务审批结束 ----- ")
class TestInternationalTravelBoe(): boeNum = globals() def setup_class(self): self.login = LoginDepend('easHost', 'user') self.internationalTravelBoePage = InternationalTravelBoePage( self.login.driver) def teardown_class(self): # self.internationalTravelBoePage.driver.quit() pass def test_internationalTravel(self): sleep(1) self.internationalTravelBoePage.open_boeReimburse() sleep(1) self.internationalTravelBoePage.open_boe('差旅报账单(国际)', '差旅') sleep(1) # 切换窗口 logger.info("当前窗口为:{}".format( self.internationalTravelBoePage.getCurrentWindowHandle())) logger.info("所有窗口为:{}".format( self.internationalTravelBoePage.getWindowHandles())) windowsList = self.internationalTravelBoePage.getWindowHandles() self.internationalTravelBoePage.switchToWin(windowsList[1]) logger.info("当前窗口为:{}".format( self.internationalTravelBoePage.getCurrentWindowHandle())) sleep(1) global boeNum boeNum = self.internationalTravelBoePage.getBoeNum() logger.info("当前提单单据号为:{}".format(boeNum)) self.internationalTravelBoePage.input_operationType('差旅') self.internationalTravelBoePage.input_boeAbstract('测试差旅报账单(国际)') # 费用归属区 self.internationalTravelBoePage.selectDepartment('AD', 'A部门') self.internationalTravelBoePage.input_projectId('hc项目1') # 城市间交通费 sleep(1) self.internationalTravelBoePage.click_cityTrafficExpenseAddButton() self.internationalTravelBoePage.select_isDomesticItineraryTraffic('是') self.internationalTravelBoePage.input_operationSubTypeIdTraffic('差旅交通') self.internationalTravelBoePage.select_travelerEmpIdTraffic() self.internationalTravelBoePage.input_beginDateStrTraffic('15') self.internationalTravelBoePage.input_fromCityTraffic('长沙') sleep(1) self.internationalTravelBoePage.input_toCityTraffic('北京') sleep(1) self.internationalTravelBoePage.select_transportationTraffic( '二等座(高铁/动车)') self.internationalTravelBoePage.select_useCurrencyCodeTraffic('CNY') self.internationalTravelBoePage.input_useCurrencyAmountTraffic( '100.10') self.internationalTravelBoePage.input_rateValueTraffic('1.11') self.internationalTravelBoePage.input_totalPriceTraffic('10.10') self.internationalTravelBoePage.input_fuelSurchargeTraffic('10.00') # 住宿 self.internationalTravelBoePage.click_hotelExpenseAddButton() self.internationalTravelBoePage.input_operationSubTypeIdHotel('差旅住宿') self.internationalTravelBoePage.input_beginDateStrHotel('15') self.internationalTravelBoePage.input_endDateStrHotel('20') self.internationalTravelBoePage.input_sitePlaceHotel('北京') sleep(1) self.internationalTravelBoePage.input_hotelDayHotel('5') self.internationalTravelBoePage.select_useCurrencyCodeHotel('CNY') self.internationalTravelBoePage.input_useCurrencyAmountHotel('500.50') self.internationalTravelBoePage.input_rateValueHotel('1.11') # 补贴 self.internationalTravelBoePage.input_operationSubTypeIdSubsidy('差旅补贴') self.internationalTravelBoePage.input_subsidyDaySubsidy('5') self.internationalTravelBoePage.input_sitePlaceSubsidy('北京') sleep(1) self.internationalTravelBoePage.select_useCurrencyCodeSubsidy('CNY ') self.internationalTravelBoePage.input_useCurrencyAmountSubsidy( '500.55') self.internationalTravelBoePage.input_rateValueSubsidy('1.11') # 其他 self.internationalTravelBoePage.input_operationSubTypeIdOther('差旅其他') self.internationalTravelBoePage.select_useCurrencyCodeOther('CNY') self.internationalTravelBoePage.input_useCurrencyAmountOther('500.55') self.internationalTravelBoePage.input_rateValueOther('1.11') self.internationalTravelBoePage.input_remarkOther('测试') # 总金额 totalAmountTraffic = self.internationalTravelBoePage.get_totalAmountTraffic( ) logger.info("城市间交通费报账金额为:{}".format(totalAmountTraffic)) totalAmountHotel = self.internationalTravelBoePage.get_totalAmountHotel( ) logger.info("住宿费报账金额为:{}".format(totalAmountHotel)) totalAmountSubsidy = self.internationalTravelBoePage.get_totalAmountSubsidy( ) logger.info("补贴金额为:{}".format(totalAmountSubsidy)) totalAmountOther = self.internationalTravelBoePage.get_totalAmountOther( ) logger.info("其他金额为:{}".format(totalAmountOther)) totalAmount = Decimal(totalAmountTraffic) + Decimal( totalAmountHotel) + Decimal(totalAmountSubsidy) + Decimal( totalAmountOther) logger.info('总金额为:{}'.format(str(totalAmount))) self.internationalTravelBoePage.input_expenseAmount(str(totalAmount)) # 支付区 self.internationalTravelBoePage.input_paymentAmount(str(totalAmount)) self.internationalTravelBoePage.input_paymentMemo('测试') sleep(1) self.internationalTravelBoePage.click_boeSubmitButton() sleep(3) self.internationalTravelBoePage.click_close() logger.info("单据流程结束") windowsList = self.internationalTravelBoePage.getWindowHandles() self.internationalTravelBoePage.switchToWin(windowsList[0]) def test_businessApprove(self): global boeNum self.businessApprove = BusinessApprove(boeNum) content = self.businessApprove.boeBusinessApprove() assert content == '审批成功' def test_sharingCenterApprove(self): global boeNum self.sharingCenterApprove = SharingCenterApprove(boeNum) self.sharingCenterApprove.sharingCenterApproveChuShen() self.sharingCenterApprove.sharingCenterApproveFuShen()
class TestNewBusinessLedgerBoe(): boeNum = globals() def setup_class(self): self.login = LoginDepend('basHost', 'user') self.newBusinessLedgerBoePage = NewBusinessLedgerBoePage( self.login.driver) def teardown_class(self): self.newBusinessLedgerBoePage.driver.quit() @allure.story("业务记账单(新)业务报账界面单据提交") @allure.step("业务记账单(新)业务报账界面单据提交步骤") @allure.severity("blocker") @pytest.mark.dependency(name='submit') def test_newBusinessLedgerBoe(self): logger.info(" ----- 单据提交流程开始 ----- ") with allure.step("点击选择财务记账页面"): self.newBusinessLedgerBoePage.selectTabType('财务记账') with allure.step("进入业务记账单(新)单据提交页面"): self.newBusinessLedgerBoePage.boeRntry('业务记账(新)') global boeNum boeNum = self.newBusinessLedgerBoePage.getBoeNum() with allure.step("选择业务类型"): self.newBusinessLedgerBoePage.input_operationType('UI通用') with allure.step("输入备注"): self.newBusinessLedgerBoePage.input_boeAbstract( '测试业务记账单(新),测试业务记账单(新),测试业务记账单(新)') with allure.step("输入项目"): self.newBusinessLedgerBoePage.input_costProject('UI项目') with allure.step("输入总金额"): self.newBusinessLedgerBoePage.input_costExpenseAmount('100.00') with allure.step("输入业务类型"): self.newBusinessLedgerBoePage.input_costOperationSubType('UI通用01') with allure.step("选择成本中心"): self.newBusinessLedgerBoePage.selectCostExpenseDept('UIDP', 'UI部门') with allure.step("点击新增明细信息按钮"): self.newBusinessLedgerBoePage.click_addDetailButton() with allure.step("输入项目"): self.newBusinessLedgerBoePage.input_costProject('UI项目', count='1') with allure.step("输入总金额"): self.newBusinessLedgerBoePage.input_costExpenseAmount('100.00', count='1') with allure.step("输入业务类型"): self.newBusinessLedgerBoePage.input_costOperationSubType('UI通用02', count='1') with allure.step("选择成本中心"): self.newBusinessLedgerBoePage.selectCostExpenseDept('UIDP', 'UI部门', count='1') with allure.step("点击单据提交"): self.newBusinessLedgerBoePage.click_boeSubmitButton() with allure.step("点击单据关闭按钮"): self.newBusinessLedgerBoePage.click_close() with allure.step("进行单据生成校验"): self.newBusinessLedgerBoePage.click_more() self.newBusinessLedgerBoePage.input_boeNumQuery(boeNum) self.newBusinessLedgerBoePage.click_queryButton() with allure.step("断言结果:{}".format( self.newBusinessLedgerBoePage.checkBoeNumExistIsOrNot( boeNum))): assert self.newBusinessLedgerBoePage.checkBoeNumExistIsOrNot( boeNum) == True @allure.story("业务记账单(新)费用报销界面业务审批") @allure.step("业务记账单(新)费用报销界面业务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_businessApprove(self): logger.info(" ----- 单据业务审批开始 ----- ") global boeNum self.businessApprove = BusinessApprove(boeNum) content = self.businessApprove.boeBusinessApprove() logger.info(" ----- 单据业务审批开始 ----- ") assert content == '审批成功' @allure.story("业务记账单(新)共享中心界面财务审批") @allure.step("业务记账单(新)共享中心界面财务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_sharingCenterApprove(self): logger.info(" ----- 单据财务审批开始 ----- ") global boeNum self.sharingCenterApprove = SharingCenterApprove(boeNum) self.sharingCenterApprove.sharingCenterApproveChuShen() self.sharingCenterApprove.sharingCenterApproveFuShen() logger.info(" ----- 单据财务审批结束 ----- ")
class TestNewBoeTypeGeneralLedgerBoe(): boeNum = globals() def setup_class(self): self.login = LoginDepend('basHost', 'user') self.newBoeTypeGeneralLedgerBoePage = NewBoeTypeGeneralLedgerBoePage( self.login.driver) def teardown_class(self): self.newBoeTypeGeneralLedgerBoePage.driver.quit() @allure.story("总账单业务报账界面单据提交") @allure.step("总账单业务报账界面单据提交步骤") @allure.severity("blocker") @pytest.mark.dependency(name='submit') def test_newBoeTypeGeneralLedgerBoe(self): logger.info(" ----- 单据提交流程开始 ----- ") with allure.step("点击选择财务记账页面"): self.newBoeTypeGeneralLedgerBoePage.selectTabType('财务记账') with allure.step("进入总账单单据提交页面"): self.newBoeTypeGeneralLedgerBoePage.boeRntry('总账单') global boeNum boeNum = self.newBoeTypeGeneralLedgerBoePage.getBoeNum() with allure.step("选择业务类型"): self.newBoeTypeGeneralLedgerBoePage.input_operationType('UI通用') with allure.step("选择总账记账日期"): self.newBoeTypeGeneralLedgerBoePage.select_glDate( datetime.datetime.now().strftime("%Y-%m-%d")) with allure.step("输入摘要"): self.newBoeTypeGeneralLedgerBoePage.input_voucherRemark('测试') with allure.step("选择会计科目"): self.newBoeTypeGeneralLedgerBoePage.input_voucherAccount('UI科目1') with allure.step("输入金额"): self.newBoeTypeGeneralLedgerBoePage.input_voucherDebitAmount( '100.00') with allure.step("点击新增凭证分录按钮"): self.newBoeTypeGeneralLedgerBoePage.click_addVoucherButton() with allure.step("输入摘要"): self.newBoeTypeGeneralLedgerBoePage.input_voucherRemark('测试', count='1') with allure.step("选择会计科目"): self.newBoeTypeGeneralLedgerBoePage.input_voucherAccount('UI科目2', count='1') with allure.step("输入金额"): self.newBoeTypeGeneralLedgerBoePage.input_voucherCreditAmount( '100.00', count='1') with allure.step("点击单据提交"): self.newBoeTypeGeneralLedgerBoePage.click_boeSubmitButton() with allure.step("点击单据关闭按钮"): self.newBoeTypeGeneralLedgerBoePage.click_close() with allure.step("进行单据生成校验"): self.newBoeTypeGeneralLedgerBoePage.click_more() self.newBoeTypeGeneralLedgerBoePage.input_boeNumQuery(boeNum) self.newBoeTypeGeneralLedgerBoePage.click_queryButton() with allure.step("断言结果:{}".format( self.newBoeTypeGeneralLedgerBoePage.checkBoeNumExistIsOrNot( boeNum))): assert self.newBoeTypeGeneralLedgerBoePage.checkBoeNumExistIsOrNot( boeNum) == True @allure.story("总账单费用报销界面业务审批") @allure.step("总账单费用报销界面业务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_businessApprove(self): logger.info(" ----- 单据业务审批开始 ----- ") global boeNum self.businessApprove = BusinessApprove(boeNum) content = self.businessApprove.boeBusinessApprove() logger.info(" ----- 单据业务审批开始 ----- ") assert content == '审批成功' @allure.story("总账单共享中心界面财务审批") @allure.step("总账单共享中心界面财务审批步骤") @pytest.mark.dependency(depends=["submit"]) def test_sharingCenterApprove(self): logger.info(" ----- 单据财务审批开始 ----- ") global boeNum self.sharingCenterApprove = SharingCenterApprove(boeNum) self.sharingCenterApprove.sharingCenterApproveChuShen() self.sharingCenterApprove.sharingCenterApproveFuShen() logger.info(" ----- 单据财务审批结束 ----- ")