示例#1
0
 def test_record_output_invoice( self ):
     """cai-记多条开票 测试"""
     page = RecordInvoicePage(self.driver, CompInfo.BASE_URL, 'output')
     readExcel = ReadExcel(self.record_invoice_data_dir)
     excel_data = readExcel.get_value_in_order('记所有类别的开票yb')
     dangerPage = DangerPage(self.driver)
     alertPage = AlertPage(self.driver)
     page.go_to_record_invoice_page()
     try:
         for output_invoice_data in excel_data:
             page.record_invoice(output_invoice_data)
             page.submit('save_and_new')
             print('output_invoice_data=>', output_invoice_data)
         time.sleep(3)
         alert_msg = alertPage.get_alert_msg()
         if alert_msg == '保存成功':
             self.assertEqual(alert_msg, '保存成功')
         elif alert_msg == '请完善相关信息' or alert_msg == '':
             print('[test_record_output_invoice]--记开票失败--aler_msg=', alert_msg)
             self.assertEqual(1, 0)
     except Exception as e:
         danger_msg = dangerPage.get_alert_danger_msg()
         if danger_msg == '请完善相关信息':
             print(output_invoice_data[8] + '------记开票失败------')
         else:
             print('[RecordInvoiceSpec]--记开票失败--错误原因', str(e))
         self.driver.quit()
 def test_record_input_invoice(self):
     """cai-记多条收票 测试"""
     readExcel = ReadExcel(self.record_invoice_data_dir)
     excel_data = readExcel.get_value_in_order(0)
     dangerPage = DangerPage(self.driver)
     alertPage = AlertPage(self.driver)
     page = RecordInvoicePage(self.driver, CompInfo.BASE_URL, 'input')
     page.go_to_record_invoice_page()
     try:
         for input_invoice_data in excel_data:
             page.record_input_invoice(input_invoice_data)
             page.submit('save_and_new')
             print('input_invoice_data=>', input_invoice_data)
         time.sleep(3)
         alert_msg = alertPage.get_alert_msg()
         if '发票保存成功' in alert_msg:
             self.assertIn('发票保存成功', alert_msg)
         elif alert_msg == '请完善相关信息' or alert_msg == '':
             print('[test_record_output_invoice]--记收票失败--aler_msg=',
                   alert_msg)
             self.assertEqual(1, 0)
             exit()
     except Exception as e:
         danger_msg = dangerPage.get_alert_danger_msg()
         if danger_msg == '请完善相关信息':
             print(input_invoice_data[8] + '------记收票失败------')
         else:
             print('[RecordInvoiceSpec]--记收票失败--错误原因', str(e))
示例#3
0
    def test_create_comp_empty_comp_name(self):
        """创建帐套-帐套名称为空,红框提醒保存失败"""
        page = CreateCompPage(self.driver)
        dangerPage = DangerPage(self.driver)
        compLisPage = CompListPage(self.driver)
        readExcel = ReadExcel(self.create_comp_data_dir)

        comp_data = readExcel.get_value_by_row('创建帐套测试数据', 2)
        compLisPage.go_to_create_comp_page()
        if 'create-company' in self.driver.current_url:
            page.set_comp_base_info(comp_data)
            page.submit(comp_data[17])
            alert_danger_msg = dangerPage.get_alert_danger_msg()
            self.assertEqual(alert_danger_msg, comp_data[19])
            time.sleep(2)
            self.assertNotIn('company-list', self.driver.current_url)
        else:
            print('去创建帐套失败!')
            self.assertEqual(0, 1)
示例#4
0
 def test_record_income(self):
     """测试记多条收入"""
     read_excel = ReadExcel(self.revenue_and_expenditure_data_dir)
     danger_page = DangerPage(self.driver)
     alert_page = AlertPage(self.driver)
     page = RecordTransactionPage(self.driver, CompInfo.BASE_URL, 'Income')
     page.go_to_record_transaction_page()
     excel_data = read_excel.get_value_in_order('记所有类别收入')
     try:
         for income_test_data in excel_data:
             page.record_income_and_outcome(income_test_data)
             print('income_test_data=>', income_test_data)
         alert_msg = alert_page.get_alert_msg()
         self.assertIn('保存成功', alert_msg)
     except Exception as e:
         danger_msg = danger_page.get_alert_danger_msg()
         if danger_msg == '请填写完整!':
             print(income_test_data[6] + '------记收入失败------')
         else:
             print('[RecordTransactionSpec]--记收入失败--错误原因', str(e))
         self.driver.quit()
示例#5
0
 def test_record_outcome_cash(self):
     """测试记多条支出--现金流量表"""
     readExcel = ReadExcel(self.revenue_and_expenditure_data_dir)
     dangerPage = DangerPage(self.driver)
     alertPage = AlertPage(self.driver)
     page = RecordTransactionPage(self.driver, CompInfo.BASE_URL, 'Outcome')
     page.go_to_record_transaction_page()
     excel_data = readExcel.get_value_in_order(5)
     try:
         for outcome_test_data in excel_data:
             page.record_income_and_outcome(outcome_test_data)
             print('outcome_test_data=>', outcome_test_data)
         alert_msg = alertPage.get_alert_msg()
         self.assertIn('保存成功', alert_msg)
     except Exception as e:
         danger_msg = dangerPage.get_alert_danger_msg()
         if danger_msg == '请填写完整!':
             print('--记 ' + income_test_data[6] + '失败--' + ',错误原因=>',
                   danger_msg)
             self.driver.quit()
         else:
             print('[RecordTransactionSpec]--记支出失败--错误原因', str(e))
         self.driver.quit()
示例#6
0
 def test_record_transfer(self):
     """测试记多条互转"""
     readExcel = ReadExcel(self.revenue_and_expenditure_data_dir)
     dangerPage = DangerPage(self.driver)
     alertPage = AlertPage(self.driver)
     page = RecordTransactionPage(self.driver, CompInfo.BASE_URL,
                                  'accountTransfers')
     excel_data = readExcel.get_value_in_order(4)
     page.go_to_record_transaction_page()
     try:
         for transfer_test_data in excel_data:
             page.record_transfer(transfer_test_data)
             print('transfer_test_data=>', transfer_test_data)
         alert_msg = alertPage.get_alert_msg()
         self.assertIn('保存成功', alert_msg)
     except Exception as e:
         danger_msg = dangerPage.get_alert_danger_msg()
         if danger_msg == '金额不能为0' or danger_msg == '账户不能为空' or danger_msg == '账户不能相同':
             print('--记 ' + income_test_data[5] + '失败--' + ',错误原因=>',
                   danger_msg)
             self.driver.quit()
         else:
             print('[RecordTransactionSpec]--记互转失败--错误原因', str(e))
         self.driver.quit()