コード例 #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
ファイル: account_spec.py プロジェクト: oracle614/e2e-test
    def test_empty_name(self):
        account_page = AccountPage(self.driver)
        danger_page = DangerPage(self.driver)
        readExcel = ReadExcel(self.account_test_data_dir)
        account_test_data = readExcel.get_value_by_row(0,3)
        account_page.test_add_bank_account(account_test_data)

        # self.driver.switch_to_alert()
        text_danger_msg = danger_page.get_text_danger_msg()
        self.assertEqual(text_danger_msg, account_test_data[6])
コード例 #4
0
    def test_partnerset_empty_invalid(self):
        """测试 股东名称为空,保存失败,提示‘请填写名称’"""
        page = PartnersetPage(self.driver)
        dangerPage = DangerPage(self.driver)
        readExcel = ReadExcel(self.partnerset_test_data_dir)

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

        result = dangerPage.get_text_danger_msg()
        self.assertEqual(result, partnerset_test_data[3])
コード例 #5
0
    def test_tax_num_empty(self):
        """纳税人识别号为空,提示‘请填写纳税人识别号’,保存失败"""
        settingPage = SettingPage(self.driver)
        page = CompBillingPage(self.driver)
        dangerPage = DangerPage(self.driver)
        settingPage.go_to_setting_page(CompInfo.BASE_URL)

        read_excel = ReadExcel(self.modify_accounting_book_info_data_dir)
        accounting_book_info_data = read_excel.get_value_by_row(0, 3)
        page.modify_comp_info(accounting_book_info_data)

        text_danger_msg = dangerPage.get_text_danger_msg()
        self.assertEqual(text_danger_msg, accounting_book_info_data[10])
コード例 #6
0
    def test_phone_num_typeError(self):
        """3.往来信息-手机号格式不正确,提示‘手机格式不正确’,保存失败"""
        settingPage = SettingPage(self.driver, CompInfo.BASE_URL)
        page = ContactPage(self.driver)
        dangerPage = DangerPage(self.driver)
        readExcel = ReadExcel(self.add_contact_data_dir)

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

        result = dangerPage.get_text_danger_msg()
        self.assertEqual(result, add_contact_data[7])
        print('result=>', result)
コード例 #7
0
    def test_name_empty(self):
        """2.往来信息-测试往来名称为空,保存失败"""
        settingPage = SettingPage(self.driver, CompInfo.BASE_URL)
        page = ContactPage(self.driver)
        readExcel = ReadExcel(self.add_contact_data_dir)
        dangerPage = DangerPage(self.driver)

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

        result = dangerPage.get_text_danger_msg()
        self.assertEqual(result, add_contact_data[7])
        print('result=>', result)
コード例 #8
0
	def test_empty_username(self):
		""" 登录测试-用户名为空 """
		login_page = LoginPage(CompInfo.BASE_URL, self.driver)
		danger_page = DangerPage(self.driver)
		read_excel = ReadExcel(self.login_test_data_dir)
		if 'dev' in CompInfo.BASE_URL:
			sheet_name = 0
		elif 'stage' in CompInfo.BASE_URL:
			sheet_name = 1
		elif 'firms' in CompInfo.BASE_URL:
			sheet_name = 2
		login_test_data = read_excel.get_value_by_row(sheet_name, 4)
		login_page.login(login_test_data)
		
		input_alert_msg = danger_page.get_input_alert_msg()
		self.assertEqual(input_alert_msg, login_test_data[3], msg='登录测试-用户名为空,失败!')
コード例 #9
0
	def test_wrong_password(self):
		""" 登录测试-密码不正确 """
		login_page = LoginPage(CompInfo.BASE_URL, self.driver)
		danger_page = DangerPage(self.driver)
		read_excel = ReadExcel(self.login_test_data_dir)
		if 'dev' in CompInfo.BASE_URL:
			sheet_name = 0
		elif 'stage' in CompInfo.BASE_URL:
			sheet_name = 1
		elif 'firms' in CompInfo.BASE_URL:
			sheet_name = 2
		login_test_data = read_excel.get_value_by_row(sheet_name, 3)
		login_page.login(login_test_data)
		
		error_msg = danger_page.get_error_msg()
		self.assertEqual(error_msg, login_test_data[3], msg='登录测试-密码不正确,失败!')
コード例 #10
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)
コード例 #11
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()
コード例 #12
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])
コード例 #13
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()
コード例 #14
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()