Example #1
0
 def setup_class(self):
     self.driver = driverFactory.get_driver('chrome')
     self.publicloginpage = PublicLoginPage(self.driver)
     self.publicloginpage.goto_publicloginpage(config.getUrlDict()['url']['publicHost'])
     logger.info("链接地址为:{}".format(config.getUrlDict()['url']['publicHost']))
     self.driver.implicitly_wait(1)
     logger.info("测试用户登录场景")
Example #2
0
 def _login(self, host, user):
     self.login.goto_loginpage(config.getUrlDict()['url'][host])
     self.driver.implicitly_wait(1)
     self.login.input_account(config.getUrlDict()[user]['account'])
     self.login.input_password(config.getUrlDict()[user]['password'])
     self.login.click_loginbutton()
     try:
         WebDriverWait(self.login.driver, 3).until(
             EC.visibility_of_element_located(self.login.getIntoButton()))
     except:
         pass
     else:
         self.login.get_into()
     logger.info('成功登录界面:{}'.format(host))
Example #3
0
 def __init__(self, timerType, timerName, driver):
     self._timerType = timerType
     self._timerName = timerName
     self.driver = driver
     logger.info('准备开始运行定时器,运行的目标定时器为:{}'.format(timerName))
     self.driver.get(config.getUrlDict()['url']['timerHost'])
     self._timerManage = TimerManage(self.driver)
Example #4
0
 def _publicLogin(self, host):
     self.publicLoginPage.goto_publicloginpage(
         config.getUrlDict()['url'][host])
     self.driver.implicitly_wait(1)
     self.publicLoginPage.input_account(
         config.getUrlDict()['user']['account'])
     self.publicLoginPage.input_password(
         config.getUrlDict()['user']['password'])
     self.publicLoginPage.click_loginbutton()
     try:
         WebDriverWait(self.publicLoginPage.driver, 5).until(
             EC.visibility_of_element_located(
                 self.publicLoginPage.getIntoButton()))
     except:
         pass
     else:
         self.publicLoginPage.get_into()
Example #5
0
 def gotoBillExchangePage(self):
     """
     describe:
         进入支付中心票据台账
     :param : No param
     :return: None
     """
     self.driver.get(config.getUrlDict()['url']['fscBillExchange'])
 def gotoInvoiceQueryPage(self):
     self.driver.get(config.getUrlDict()['url']['invoiceIpoolHost'])
    def sharingCenterApproveChuShen(self, modify=False, **kwargs):

        self._handleTimer = HandleTimer('共享中心', '共享从中台同步单据', self.login.driver)
        self._handleTimer.runTimer()

        self._myAuditListPage.gotoAuditAdjustDirectorPage()
        self._auditAdjustDirectorPage.input_selectBoeNum(self.boeNum)
        self._auditAdjustDirectorPage.click_selectButton()

        try:
            self._auditAdjustDirectorPage.click_selectResult()
        except:
            logger.info('没有找到单据,{}'.format(self.boeNum))
            logger.info('----- Try again -----')
            self._handleTimer = HandleTimer('共享中心', '共享从中台同步单据',
                                            self.login.driver)
            self._handleTimer.runTimer()
            self._auditAdjustDirectorPage.input_selectBoeNum(self.boeNum)
            self._auditAdjustDirectorPage.click_selectButton()
            self._auditAdjustDirectorPage.click_selectResult()

        self._auditAdjustDirectorPage.click_taskTakeToBack()
        self._auditAdjustDirectorPage.click_selectResult()

        # 分配到组
        try:
            self._auditAdjustDirectorPage.choiceGroup(
                config.getUrlDict()['Approval']['approvalGroupC'])
        except:
            sleep(1)
            self._auditAdjustDirectorPage.click_selectResult()
            sleep(1)
            self._auditAdjustDirectorPage.choiceGroup(
                config.getUrlDict()['Approval']['approvalGroupC'])

        # 分配到人
        self._auditAdjustDirectorPage.click_selectResult()
        try:
            self._auditAdjustDirectorPage.choiceOperatorUser(
                config.getUrlDict()['Approval']['approvalUserC'])
        except:
            self._auditAdjustDirectorPage.click_selectResult()
            self._auditAdjustDirectorPage.choiceOperatorUser(
                config.getUrlDict()['Approval']['approvalUserC'])

        self._auditAdjustDirectorPage.gotoAuditList()
        self._myAuditListPage.input_boeNumQuery(self.boeNum)
        self._myAuditListPage.click_boeNumQueryButton()

        try:
            self._myAuditListPage.getIntoBoe()
        except:
            sleep(1)
            self._myAuditListPage.getIntoBoe()
        self._boeCommon.switchWindow()

        parameterList = [i for i in kwargs.keys()]
        logger.info('参数列表为:{}'.format(parameterList))

        if modify == True:

            sleep(3)
            if 'checkCode' in parameterList:
                self._boeCommon.input_dtosCheckCode(kwargs['checkCode'])

            if 'invoiceTypeCode' in parameterList:
                self._boeCommon.input_dtosInvoiceTypeCode(
                    kwargs['invoiceTypeCode'])

            if 'invoiceNo' in parameterList:
                self._boeCommon.input_dtosInvoiceNo(kwargs['invoiceNo'])

            if 'invoiceCode' in parameterList:
                self._boeCommon.input_dtosInvoiceCode(kwargs['invoiceCode'])

            if 'invoiceDate' in parameterList:
                self._boeCommon.input_dtosInvoiceDate(kwargs['invoiceDate'])

            if 'invoiceFee' in parameterList:
                self._boeCommon.input_dtosInvoiceFee(kwargs['invoiceFee'])

            if 'invoiceTax' in parameterList:
                self._boeCommon.input_dtosInvoiceTax(kwargs['invoiceTax'])

            if 'invoiceRemark' in parameterList:
                self._boeCommon.input_dtosInvoiceRemark(
                    kwargs['invoiceRemark'])

            self._boeCommon.click_saveButton()

        self._boeCommon.click_accountMessage()
        self._boeCommon.click_approveButton()

        try:
            if self._boeCommon.getToastBoxText() != '审批成功':
                logger.info('弹窗信息为:{}'.format(
                    self._boeCommon.getToastBoxText()))
                raise Exception('审批不成功')
            else:
                logger.info('弹窗信息为:{}'.format(
                    self._boeCommon.getToastBoxText()))
                logger.info('单据财务审批成功')
        except:
            sleep(1)
            if self._boeCommon.getToastBoxText() != '审批成功':
                logger.info('弹窗信息为:{}'.format(
                    self._boeCommon.getToastBoxText()))
                try:
                    logger.error(self._boeCommon.getBoxMessage())
                except:
                    pass
                finally:
                    raise Exception('审批不成功')
            else:
                logger.info('弹窗信息为:{}'.format(
                    self._boeCommon.getToastBoxText()))
                logger.info('单据财务审批成功')

        self._boeCommon.switchWindow()
    def sharingCenterApproveFuShen(self):

        self._myAuditListPage.gotoAuditAdjustDirectorPage()
        self._auditAdjustDirectorPage.input_selectBoeNum(self.boeNum)
        self._auditAdjustDirectorPage.click_selectButton()

        flag = self._auditAdjustDirectorPage.elementExistIsOrNot(
            *self._auditAdjustDirectorPage.getSelectResult())
        num = 0
        while True:
            if flag == True:
                break
            else:
                self._handleTimer = HandleTimer('共享中心', '生成任务',
                                                self.login.driver)
                self._handleTimer.runTimer()
                self._auditAdjustDirectorPage.input_selectBoeNum(self.boeNum)
                self._auditAdjustDirectorPage.click_selectButton()
                flag = self._auditAdjustDirectorPage.elementExistIsOrNot(
                    *self._auditAdjustDirectorPage.getSelectResult())
            if num == 50:
                break
            else:
                num = num + 1

        sleep(0.5)
        self._auditAdjustDirectorPage.click_selectResult()
        sleep(0.5)
        self._auditAdjustDirectorPage.click_taskTakeToBack()
        sleep(0.5)
        self._auditAdjustDirectorPage.click_selectResult()

        sleep(1)
        # 分配到组
        try:
            self._auditAdjustDirectorPage.choiceGroup(
                config.getUrlDict()['Approval']['approvalGroupF'])
        except:
            sleep(1)
            self._auditAdjustDirectorPage.click_selectResult()
            sleep(1)
            self._auditAdjustDirectorPage.choiceGroup(
                config.getUrlDict()['Approval']['approvalGroupF'])

        self._auditAdjustDirectorPage.click_selectResult()

        # 分配到人
        try:
            self._auditAdjustDirectorPage.choiceOperatorUser(
                config.getUrlDict()['Approval']['approvalUserF'])
        except:
            self._auditAdjustDirectorPage.click_selectResult()
            self._auditAdjustDirectorPage.choiceOperatorUser(
                config.getUrlDict()['Approval']['approvalUserF'])

        self._auditAdjustDirectorPage.gotoAuditList()
        self._myAuditListPage.input_boeNumQuery(self.boeNum)
        self._myAuditListPage.click_boeNumQueryButton()

        try:
            self._myAuditListPage.getIntoBoe()
        except:
            sleep(1)
            self._myAuditListPage.getIntoBoe()
        self._boeCommon.switchWindow()

        self._boeCommon.click_accountMessage()
        self._boeCommon.click_approveButton()
        self._boeCommon.switchWindow()

        self.login.driver.quit()
Example #9
0
 def gotoAuditAdjustDirectorPage(self):
     sleep(1)
     self.driver.get(config.getUrlDict()['url']['fscAuditAdjustDirector'])
Example #10
0
 def gotoAuditList(self):
     sleep(1)
     self.driver.get(config.getUrlDict()['url']['fscAuditList'])
Example #11
0
def env(request) -> dict:
    request.config.base_data = config.getUrlDict()
    return request.config.base_data