Exemplo n.º 1
0
    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
Exemplo n.º 2
0
    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
Exemplo n.º 3
0
    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
Exemplo n.º 4
0
    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
    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
    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
Exemplo n.º 7
0
                elif publciLoginPage_testdata["casename"] == '登陆成功':
                    WebDriverWait(self.publicloginpage.driver, 5).until(
                        EC.visibility_of_element_located(self.publicloginpage.getIntoButton()))
                    self.publicloginpage.get_into()
                    self.publicloginpage.driver.refresh()
                    assert 1 == 1

            except Exception as e:

                logger.error("出现异常,异常信息为:{}".format(type(e)))
                code = 'wrong'
                timeNow = getNowTime()
                self.publicloginpage.screenshot(code, timeNow)
                allure.attach.file(getPicturePath(code,timeNow),name=timeNow + code + "screenshot",
                                   attachment_type=allure.attachment_type.PNG)
                assert 1 == 0
            else:

                logger.info("测试用例执行成功")
                code = 'success'
                timeNow = getNowTime()
                self.publicloginpage.screenshot(code, timeNow)
                allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot",
                                   attachment_type=allure.attachment_type.PNG)



if __name__ == '__main__':
    # pytest.main(['-sv','test_publciLoginPage.py'])
    print(getPicturePath('success', getNowTime()))
    def test_newMultiDomesticTravel(self, newMultiDomesticTravelBoe_testdata):
        try:
            logger.info(" ----- 单据流程开始 ----- ")
            with allure.step("打开费用报销单据选择页面"):
                sleep(3)
                self.newMultiDomesticTravelBoePage.open_boeReimburse()
            with allure.step("打开的单据类型为:{} ,选择的单据业务类型为: {}".format('多人差旅报账单', newMultiDomesticTravelBoe_testdata['operationType'])):
                try:
                    self.newMultiDomesticTravelBoePage.open_boe('多人差旅报账单', newMultiDomesticTravelBoe_testdata['operationType'])
                except:
                    sleep(3)
                    logger.error(" Don't find Boe, Try again")
                    self.newMultiDomesticTravelBoePage.open_boe('多人差旅报账单', newMultiDomesticTravelBoe_testdata['operationType'])

            global boeNum
            boeNum = self.newMultiDomesticTravelBoePage.getBoeNum()

            with allure.step("输入业务类型"):
                self.newMultiDomesticTravelBoePage.input_operationType(newMultiDomesticTravelBoe_testdata['operationType'])
            with allure.step("输入备注"):
                self.newMultiDomesticTravelBoePage.input_boeAbstract(newMultiDomesticTravelBoe_testdata['boeAbstract'])

            with allure.step("增加出行人员"):
                self.newMultiDomesticTravelBoePage.add_travelers(newMultiDomesticTravelBoe_testdata['travelers'])
            with allure.step("输入项目"):
                self.newMultiDomesticTravelBoePage.select_projectId(newMultiDomesticTravelBoe_testdata['projectName'])

            self.newMultiDomesticTravelBoePage.clearPersonCard()

            with allure.step("新增发票操作"):
                self.newMultiDomesticTravelBoePage.click_addInvoiceButton()
                self.newMultiDomesticTravelBoePage.click_invoiceType()
                # 差旅火车票新增
                invoiceFactory.get_invoice(self.login.driver, '火车票', 'boeInvoicePage').getTickets(
                    # datetime.datetime.now().strftime("%Y-%m-%d")
                    '2021-02-22',
                    '内部人员',
                    'UI01',
                    '长沙',
                    '杭州',
                    '二等座(高铁/动车)',
                    '500.00',
                    '否')

                self.newMultiDomesticTravelBoePage.click_addInvoiceButton()
                self.newMultiDomesticTravelBoePage.click_invoiceType()
                # 差旅火车票新增
                invoiceFactory.get_invoice(self.login.driver, '火车票', 'boeInvoicePage').getTickets(
                    # datetime.datetime.now().strftime("%Y-%m-%d")
                    '2021-02-22',
                    '内部人员',
                    'UI02',
                    '长沙',
                    '杭州',
                    '二等座(高铁/动车)',
                    '500.00',
                    '否')

            # self.newMultiDomesticTravelBoePage.click_addInvoiceButton()
            # self.newMultiDomesticTravelBoePage.click_invoiceType()
            # invoiceFactory.get_invoice(self.login.driver, '增值税普通发票', 'boeInvoicePage').getTickets(
            #     '2021-1-27', '811000000002', '81100002', '100.10', '0.10', '123456')

            with allure.step("点击单据提交"):
                self.newMultiDomesticTravelBoePage.click_boeSubmitButton()
            with allure.step("点击单据关闭按钮"):
                self.newMultiDomesticTravelBoePage.click_close()

            with allure.step("进行单据生成校验"):
                self.newMultiDomesticTravelBoePage.click_myBoeList()
                self.newMultiDomesticTravelBoePage.click_moreButton()
                self.newMultiDomesticTravelBoePage.input_boeNo(boeNum)
                self.newMultiDomesticTravelBoePage.click_boeNoSelectButton()
                status = self.newMultiDomesticTravelBoePage.selectResultIsOrNot(boeNum)

            logger.info(" ----- 单据提交流程结束 ----- ")
            assert status == True

        except Exception as e:
            logger.error("出现异常,异常信息为:{}".format(type(e)))
            code = 'wrong'
            timeNow = getNowTime()
            self.newMultiDomesticTravelBoePage.screenshot(code, timeNow)
            allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot",
                               attachment_type=allure.attachment_type.PNG)
            self.newMultiDomesticTravelBoePage.driver.quit()
            assert 1 == 0

        else:
            logger.info("测试用例执行成功")
            code = 'success'
            timeNow = getNowTime()
            self.newMultiDomesticTravelBoePage.screenshot(code, timeNow)
            allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot",
                               attachment_type=allure.attachment_type.PNG)
            assert 1 == 1
    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
Exemplo n.º 10
0
 def screenshot(self, code, timeNow):
     self.driver.get_screenshot_as_file(getPicturePath(code, timeNow))
     logger.info("进行截图操作")
Exemplo n.º 11
0
    def test_employeeLoad(self, employeeLoadBoe_testdata):
        try:
            logger.info(" ----- 单据流程开始 ----- ")
            with allure.step("打开借款还款单据选择页面"):
                sleep(3)
                self.employeeLoansBoePage.open_boeBorrow()
            with allure.step("打开的单据类型为:{} ,选择的单据业务类型为: {}".format(
                    '员工借款单', employeeLoadBoe_testdata['operationType'])):
                try:
                    self.employeeLoansBoePage.open_boe(
                        '员工借款单', employeeLoadBoe_testdata['operationType'])
                except:
                    sleep(3)
                    logger.error(" Don't find Boe, Try again")
                    self.employeeLoansBoePage.open_boe(
                        '员工借款单', employeeLoadBoe_testdata['operationType'])

            global boeNum
            boeNum = self.employeeLoansBoePage.getBoeNum()

            with allure.step("输入业务类型"):
                self.employeeLoansBoePage.input_operationType(
                    employeeLoadBoe_testdata['operationType'])
            with allure.step("输入备注"):
                self.employeeLoansBoePage.input_boeAbstract(
                    employeeLoadBoe_testdata['boeAbstract'])

            with allure.step("输入业务类型"):
                self.employeeLoansBoePage.input_operationSubTypeId(
                    employeeLoadBoe_testdata['operationSubTypeId'])
            with allure.step("输入总金额"):
                self.employeeLoansBoePage.input_expenseAmount(
                    employeeLoadBoe_testdata['expenseAmount'])
            with allure.step("输入项目"):
                self.employeeLoansBoePage.input_projectId(
                    employeeLoadBoe_testdata['projectName'])

            with allure.step("点击单据提交"):
                self.employeeLoansBoePage.click_boeSubmitButton()
            with allure.step("点击单据关闭按钮"):
                self.employeeLoansBoePage.click_close()

            with allure.step("进行单据生成校验"):
                self.employeeLoansBoePage.click_myBoeList()
                self.employeeLoansBoePage.click_moreButton()
                self.employeeLoansBoePage.input_boeNo(boeNum)
                self.employeeLoansBoePage.click_boeNoSelectButton()
                status = self.employeeLoansBoePage.selectResultIsOrNot(boeNum)

            logger.info(" ----- 单据提交流程结束 ----- ")
            assert status == True
        except Exception as e:
            logger.error("出现异常,异常信息为:{}".format(type(e)))
            code = 'wrong'
            timeNow = getNowTime()
            self.employeeLoansBoePage.screenshot(code, timeNow)
            allure.attach.file(getPicturePath(code, timeNow),
                               name=timeNow + code + "screenshot",
                               attachment_type=allure.attachment_type.PNG)
            self.employeeLoansBoePage.driver.quit()
            assert 1 == 0

        else:
            logger.info("测试用例执行成功")
            code = 'success'
            timeNow = getNowTime()
            self.employeeLoansBoePage.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
    def test_newPurchasingAdvicePaymentBoe(self):

        try:

            logger.info(" ----- 单据提交流程开始 ----- ")

            with allure.step("点击选择采购付款页面"):
                self.newPurchasingAdvicePaymentBoePage.selectTabType('采购付款')
            with allure.step("进入采购付款单单据提交页面"):
                self.newPurchasingAdvicePaymentBoePage.boeRntry('采购付款')

            global boeNum
            boeNum = self.newPurchasingAdvicePaymentBoePage.getBoeNum()

            with allure.step("选择业务类型"):
                self.newPurchasingAdvicePaymentBoePage.input_operationType(
                    'UI通用')
            with allure.step("输入备注"):
                self.newPurchasingAdvicePaymentBoePage.input_boeAbstract(
                    '测试采购付款单')

            with allure.step("选择供应商"):
                self.newPurchasingAdvicePaymentBoePage.selectVendor(
                    'UIGYS', vendorName='UI供应商')
            # with allure.step("选择关联合同"):
            #     self.newPurchasingAdvicePaymentBoePage.selectContract('hc00000021')

            with allure.step("关联挂账款"):
                self.newPurchasingAdvicePaymentBoePage.selectAccountReceivable(
                    self.prepaidBoeNum)

            with allure.step("点击单据提交"):
                self.newPurchasingAdvicePaymentBoePage.click_boeSubmitButton()
            with allure.step("点击单据关闭按钮"):
                self.newPurchasingAdvicePaymentBoePage.click_close()

            with allure.step("进行单据生成校验"):
                self.newPurchasingAdvicePaymentBoePage.click_more()
                self.newPurchasingAdvicePaymentBoePage.input_boeNumQuery(
                    boeNum)
                self.newPurchasingAdvicePaymentBoePage.click_queryButton()

            with allure.step("断言结果:{}".format(
                    self.newPurchasingAdvicePaymentBoePage.
                    checkBoeNumExistIsOrNot(boeNum))):
                assert self.newPurchasingAdvicePaymentBoePage.checkBoeNumExistIsOrNot(
                    boeNum) == True

        except Exception as e:
            logger.error("出现异常,异常信息为:{}".format(type(e)))
            code = 'wrong'
            timeNow = getNowTime()
            self.newPurchasingAdvicePaymentBoePage.screenshot(code, timeNow)
            allure.attach.file(getPicturePath(code, timeNow),
                               name=timeNow + code + "screenshot",
                               attachment_type=allure.attachment_type.PNG)
            self.newPurchasingAdvicePaymentBoePage.driver.quit()
            assert 1 == 0

        else:
            logger.info("测试用例执行成功")
            code = 'success'
            timeNow = getNowTime()
            self.newPurchasingAdvicePaymentBoePage.screenshot(code, timeNow)
            allure.attach.file(getPicturePath(code, timeNow),
                               name=timeNow + code + "screenshot",
                               attachment_type=allure.attachment_type.PNG)
            assert 1 == 1
    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
Exemplo n.º 14
0
    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
Exemplo n.º 15
0
    def test_login(self, publciLoginPage_testdata):
        ''' --------------------测试登陆时不同场景-------------------- '''

        logger.info("测试用例名字为:{}".format(publciLoginPage_testdata["casename"]))

        allure.title(publciLoginPage_testdata["casename"])
        with allure.step("第一步,登录页面初始化"):
            self.publicloginpage.refresh()

        with allure.step("第二步,输入账号/密码"):
            self.publicloginpage.input_account(publciLoginPage_testdata["account"])
            logger.debug("输入账户为:{}".format(publciLoginPage_testdata["account"]))
            self.publicloginpage.input_password(publciLoginPage_testdata["password"])
            logger.debug("输入密码为:{}".format(publciLoginPage_testdata["password"]))

        with allure.step("第三步,点击登录按钮"):
            self.publicloginpage.click_loginbutton()

        with allure.step("第四步,判断断言信息"):

            try:

                if (publciLoginPage_testdata["casename"] == '账号密码不匹配') or (publciLoginPage_testdata["casename"] =='当前登录用户名或密码错误'):
                    WebDriverWait(self.publicloginpage.driver, 5).until(
                        EC.visibility_of_element_located(self.publicloginpage.getMessageBox()))
                    msg = self.publicloginpage.get_errortext()
                    assert (publciLoginPage_testdata["casename"] in msg)

                elif publciLoginPage_testdata["casename"] == '请输入账户名称':
                    WebDriverWait(self.publicloginpage.driver, 5).until(
                        EC.text_to_be_present_in_element(self.publicloginpage.getAccountInputErrorBox(),publciLoginPage_testdata["casename"]))
                    msg = self.publicloginpage.get_accounterrortext()
                    assert publciLoginPage_testdata["casename"] == msg

                elif publciLoginPage_testdata["casename"] == '请输入密码':
                    WebDriverWait(self.publicloginpage.driver, 5).until(
                        EC.text_to_be_present_in_element(self.publicloginpage.getPasswordInputErrorBox(),publciLoginPage_testdata["casename"]))
                    msg = self.publicloginpage.get_passworderrortext()
                    assert publciLoginPage_testdata["casename"] == msg

                elif publciLoginPage_testdata["casename"] == '登陆成功':
                    WebDriverWait(self.publicloginpage.driver, 5).until(
                        EC.visibility_of_element_located(self.publicloginpage.getIntoButton()))
                    self.publicloginpage.get_into()
                    self.publicloginpage.driver.refresh()
                    assert 1 == 1

            except Exception as e:

                logger.error("出现异常,异常信息为:{}".format(type(e)))
                code = 'wrong'
                timeNow = getNowTime()
                self.publicloginpage.screenshot(code, timeNow)
                allure.attach.file(getPicturePath(code,timeNow),name=timeNow + code + "screenshot",
                                   attachment_type=allure.attachment_type.PNG)
                assert 1 == 0
            else:

                logger.info("测试用例执行成功")
                code = 'success'
                timeNow = getNowTime()
                self.publicloginpage.screenshot(code, timeNow)
                allure.attach.file(getPicturePath(code, timeNow), name=timeNow + code + "screenshot",
                                   attachment_type=allure.attachment_type.PNG)
    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
Exemplo n.º 17
0
    def test_comFeeApply(self, comFeeApplyBoe_testdata):
        try:
            logger.info(" ----- 单据流程开始 ----- ")
            with allure.step("打开事项申请选择页面"):
                sleep(3)
                self.comFeeApplyBoePage.open_boeApply()
            with allure.step("打开的单据类型为:{} ,选择的单据业务类型为: {}".format(
                    '通用费用申请单', comFeeApplyBoe_testdata['operationType'])):
                try:
                    self.comFeeApplyBoePage.open_boe(
                        '通用费用申请单', comFeeApplyBoe_testdata['operationType'])
                except:
                    sleep(3)
                    logger.error(" Don't find Boe, Try again")
                    self.comFeeApplyBoePage.open_boe(
                        '通用费用申请单', comFeeApplyBoe_testdata['operationType'])

            global boeNum
            boeNum = self.comFeeApplyBoePage.getBoeNum()

            with allure.step("输入业务类型:"):
                self.comFeeApplyBoePage.input_operationType(
                    comFeeApplyBoe_testdata['operationType'])
            with allure.step("输入备注"):
                self.comFeeApplyBoePage.input_boeAbstract(
                    comFeeApplyBoe_testdata['boeAbstract'])

            with allure.step("选择申请类型"):
                self.comFeeApplyBoePage.input_operationSubTypeId(
                    comFeeApplyBoe_testdata['operationSubTypeId'])
            with allure.step("输入申请金额"):
                self.comFeeApplyBoePage.input_expenseAmount(
                    comFeeApplyBoe_testdata['expenseAmount'])
            with allure.step("输入申请说明"):
                self.comFeeApplyBoePage.input_remark(
                    comFeeApplyBoe_testdata['remark'])

            with allure.step("点击单据提交"):
                self.comFeeApplyBoePage.click_boeSubmitButton()
            with allure.step("点击单据关闭按钮"):
                self.comFeeApplyBoePage.click_close()

            with allure.step("进行单据生成校验"):
                self.comFeeApplyBoePage.click_myBoeList()
                self.comFeeApplyBoePage.click_moreButton()
                self.comFeeApplyBoePage.input_boeNo(boeNum)
                self.comFeeApplyBoePage.click_boeNoSelectButton()
                status = self.comFeeApplyBoePage.selectResultIsOrNot(boeNum)

            logger.info(" ----- 单据提交流程结束 ----- ")
            assert status == True

        except Exception as e:
            logger.error("出现异常,异常信息为:{}".format(type(e)))
            code = 'wrong'
            timeNow = getNowTime()
            self.comFeeApplyBoePage.screenshot(code, timeNow)
            allure.attach.file(getPicturePath(code, timeNow),
                               name=timeNow + code + "screenshot",
                               attachment_type=allure.attachment_type.PNG)
            self.comFeeApplyBoePage.driver.quit()
            assert 1 == 0

        else:
            logger.info("测试用例执行成功")
            code = 'success'
            timeNow = getNowTime()
            self.comFeeApplyBoePage.screenshot(code, timeNow)
            allure.attach.file(getPicturePath(code, timeNow),
                               name=timeNow + code + "screenshot",
                               attachment_type=allure.attachment_type.PNG)
            assert 1 == 1