Пример #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()
Пример #2
0
 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_same_name(self):
        account_page = AccountPage(self.driver)
        alert_page = AlertPage(self.driver)
        readExcel = ReadExcel(self.account_test_data_dir)
        account_test_data = readExcel.get_value_by_row(0,2)
        account_page.test_add_bank_account(account_test_data)

        # self.driver.switch_to_alert()
        alert_danger_msg = alert_page.get_alert_msg()
        self.assertEqual(alert_danger_msg, account_test_data[6])
Пример #4
0
    def test_partset_name_repeat_invalid(self):
        """测试 股东名称重复,保存失败,提示‘股东名称不能重复’"""
        page = PartnersetPage(self.driver)
        alertPage = AlertPage(self.driver)
        readExcel = ReadExcel(self.partnerset_test_data_dir)

        partnerset_test_data = readExcel.get_value_by_row(0, 3)
        page.add_partnerset(partnerset_test_data)
        page.submit('save')
        time.sleep(1)

        result = alertPage.get_alert_msg()
        self.assertEqual(result, partnerset_test_data[3])
Пример #5
0
    def test_actual_paid_empty_valid(self):
        """测试 实缴金额为空,保存成功"""
        page = PartnersetPage(self.driver)
        alertPage = AlertPage(self.driver)
        readExcel = ReadExcel(self.partnerset_test_data_dir)

        partnerset_test_data = readExcel.get_value_by_row(0, 2)
        page.add_partnerset(partnerset_test_data)
        page.submit('save')
        time.sleep(1)

        result = alertPage.get_alert_msg()
        self.assertEqual(result, partnerset_test_data[3])
Пример #6
0
    def test_edit_partnerset_valid(self):
        """测试 编辑股东,编辑成功,提示‘编辑股东成功!'"""
        page = PartnersetPage(self.driver)
        alertPage = AlertPage(self.driver)
        readExcel = ReadExcel(self.partnerset_test_data_dir)

        partnerset_edit_test_data = readExcel.get_value_by_row(1, 1)
        page.eidt_partnerset(partnerset_edit_test_data)
        page.edit_item('//*[@id="departmentName"]')
        page.submit('save')
        time.sleep(1)

        result = alertPage.get_alert_msg()
        self.assertEqual(result, partnerset_edit_test_data[3])
Пример #7
0
    def test_name_repeat(self):
        """8.往来信息-测试往来名称重复,保存失败"""
        settingPage = SettingPage(self.driver, CompInfo.BASE_URL)
        page = ContactPage(self.driver)
        readExcel = ReadExcel(self.add_contact_data_dir)
        alertPage = AlertPage(self.driver)

        settingPage.go_to_contact_page()
        add_contact_data = readExcel.get_value_by_row(0, 7)
        page.add_contact(add_contact_data)
        page.submit('save')

        result = alertPage.get_alert_msg()
        self.assertEqual(result, add_contact_data[7])
        print('result=>', result)
Пример #8
0
    def test_contact_property_is_personal(self):
        """6.往来信息-测试 添加一个性质为个人的往来,添加成功"""
        settingPage = SettingPage(self.driver, CompInfo.BASE_URL)
        page = ContactPage(self.driver)
        alertPage = AlertPage(self.driver)
        readExcel = ReadExcel(self.add_contact_data_dir)

        settingPage.go_to_contact_page()
        add_contact_data = readExcel.get_value_by_row(0, 5)
        page.add_contact(add_contact_data)
        page.submit('save')

        result = alertPage.get_alert_msg()
        self.assertEqual(result, add_contact_data[7])
        print('result=>', result)
Пример #9
0
    def test_add_a_partner_valid(self):
        """测试 添加一名股东,添加成功,提示‘新增股东成功!’"""
        page = PartnersetPage(self.driver)
        alertPage = AlertPage(self.driver)
        readExcel = ReadExcel(self.partnerset_test_data_dir)
        settingPage = SettingPage(self.driver, CompInfo.BASE_URL)
        settingPage.go_to_partnerset_page()
        time.sleep(2)

        partnerset_test_data = readExcel.get_value_by_row(0, 4)
        page.add_partnerset(partnerset_test_data)
        page.submit('save')
        time.sleep(1)

        result = alertPage.get_alert_msg()
        self.assertEqual(result, partnerset_test_data[3])
Пример #10
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()
Пример #11
0
    def test_cash(self):
        """测试现金流量表行次值,期初现金流量表为0"""
        readExcel = ReadExcel(self, revenue_and_expenditure_data_dir)
        dangerPage = DangerPage(self.driver)
        alertPage = AlertPage(self.driver)
        page = RecordTransactionPage(
            self.driver,
            CompInfo.BASE_URL,
        )
        page.go

        alert_danger_msg = alert_page.get_alert_msg()
        self.assertEqual(alert_danger_msg, account_test_data[6])
Пример #12
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()
Пример #13
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()