Esempio n. 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))
Esempio n. 3
0
 def test_employed_empty(self):
     """添加员工-是否雇员为空-红框提示,保存失败"""
     page = AddStuffPage(self.driver)
     readExcel = ReadExcel(self.file_dir)
     excel_data = readExcel.get_value_by_row(0, 4)
     page.add_stuff_base(excel_data)
     result = page.has_danger_is_show()
     self.assertEqual(result, 1)
Esempio n. 4
0
    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])
Esempio n. 5
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])
Esempio n. 6
0
 def test_verify_add_labour(self):
     """添加员工-添加一位非雇员-添加成功"""
     page = AddStuffPage(self.driver)
     readExcel = ReadExcel(self.file_dir)
     excel_data = readExcel.get_value_by_row(0, 6)
     page.add_stuff_base(excel_data)
     time.sleep(5)
     page_url = self.driver.current_url
     print('page_url=>', page_url)
     self.assertIn('stuff-list', page_url)
Esempio n. 7
0
    def run_keyword_excel_cases(self):
        handle_excel = ReadExcel(self.excel_path)

        # 获取 excel 关键词测试用例的条数
        cases_numbers = handle_excel.get_lines() - 1
        print("注册页获取到的关键词测试的测试用例条数为:%s" % cases_numbers)

        # 循环遍历测试用例
        if cases_numbers:
            # 第 0 行是标题行不作为用例执行
            for i in range(1, cases_numbers):
                # 获取测试用例的名称
                testcase_name = handle_excel.get_cell(i, 0)
                # 获取用例是否执行
                is_run = handle_excel.get_cell(i, 1)
                if is_run == 'yes':
                    keyword_method = handle_excel.get_cell(i, 2)
                    operator_element = handle_excel.get_cell(i, 3)
                    send_value = handle_excel.get_cell(i, 4)
                    except_result = handle_excel.get_cell(i, 5)
                    actual_result = handle_excel.get_cell(i, 6)

                    # 反射
                    self.run_keyword_method(keyword_method, operator_element,
                                            send_value)

                    # if except_result is not '':
                    #     except_value = self.run_keyword_method(keyword_method)
                else:
                    print('第 %s 条用例不执行,用例名称是: [%s],无预期结果' % (i, testcase_name))
        else:
            print("略略略~,请检查你是否有写测试用例!")
Esempio n. 8
0
 def test_create_comp_empty_legal_person(self):
     """创建帐套-公司性质为空,红框提醒,保存失败"""
     page = CreateCompPage(self.driver)
     publicPage = PublicPage(self.driver)
     readExcel = ReadExcel(self.create_comp_data_dir)
     excel_date = readExcel.get_value_by_row('创建帐套测试数据', 3)
     for comp_data in excel_date:
         page.set_comp_base_info(comp_data)
     result = publicPage.has_danger_is_show()
     self.assertEqual(result, 1)
     self.assertNotIn('company-list', self.driver.current_url)
Esempio n. 9
0
 def test_create_comp_not_type_comp_detail_info(self):
     """创建帐套-帐套详细信息不填写,保存失败,红框提醒"""
     page = CreateCompPage(self.driver)
     publicPage = PublicPage(self.driver)
     read_excel = ReadExcel(self.create_comp_data_dir)
     excel_data = read_excel.get_value_by_row('创建帐套测试数据', 4)
     for comp_data in excel_data:
         page.set_comp_base_info(comp_data)
         page.set_comp_detail_info(comp_data)
     result = publicPage.has_danger_is_show()
     self.assertEqual(result, 1)
     self.assertNotIn('company-list', self.driver.current_url)
Esempio n. 10
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])
Esempio n. 11
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])
Esempio n. 12
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])
Esempio n. 13
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])
Esempio n. 14
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])
Esempio n. 15
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)
Esempio n. 16
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)
Esempio n. 17
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)
Esempio n. 18
0
 def test_verify_edit_comp_info(self):
     """编辑帐套信息,编辑成功"""
     settingPage = SettingPage(self.driver)
     page = CompBillingPage(self.driver)
     settingPage.go_to_setting_page(CompInfo.BASE_URL)
     read_excel = ReadExcel(self.modify_accounting_book_info_data_dir)
     try:
         accounting_book_info_data = read_excel.get_value_by_row(0, 4)
         page.modify_comp_info(accounting_book_info_data)
         next_comp_name = page.get_comp_name()
         self.assertEqual(next_comp_name, accounting_book_info_data[0])
     except NoSuchElementException as e:
         logging.error('查找的页面元素不存在,异常堆栈信息:' + str(traceback.format_exc()))
     except AssertionError as e:
         logging.info('编辑帐套信息失败,')
Esempio n. 19
0
	def test_empty_password(self):
		""" 登录测试-密码为空 """
		login_page = LoginPage(CompInfo.BASE_URL, 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, 5)
		login_page.login(login_test_data)
		
		input_alert_msg = login_page.get_input_error('password')
		self.assertEqual(input_alert_msg, login_test_data[3], msg='登录测试-密码为空,失败!')
Esempio n. 20
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)
Esempio n. 21
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])
Esempio n. 22
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='登录测试-用户名为空,失败!')
Esempio n. 23
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='登录测试-密码不正确,失败!')
Esempio n. 24
0
    def test_contact_input_show(self):
        """4.往来信息-测试性质为单位时-联系人输入框 显示"""
        settingPage = SettingPage(self.driver, CompInfo.BASE_URL)
        page = ContactPage(self.driver)
        publicPage = PublicPage(self.driver)
        readExcel = ReadExcel(self.add_contact_data_dir)

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

        contact_loc = self.driver.find_element_by_id(contact_elem)
        result = publicPage.is_element_present(contact_loc)
        self.assertEqual(result, 1)
        print('result=>', result)
Esempio n. 25
0
 def test_verify_create_comp(self):
     """确认创建帐套功能,创建成功"""
     page = CreateCompPage(self.driver)
     readExcel = ReadExcel(self.create_comp_data_dir)
     comp_data = readExcel.get_value_by_row('创建帐套测试数据', 1)
     compLisPage = CompListPage(self.driver)
     comp_name_list_len = len(compLisPage.get_comp_name_list())
     compLisPage.go_to_create_comp_page()
     if 'create-company' in self.driver.current_url:
         page.set_comp_base_info(comp_data)
         page.set_comp_detail_info(comp_data)
         time.sleep(2)
         new_comp_name_list_len = len(compLisPage.get_comp_name_list())
         self.assertIn('company-list', self.driver.current_url)
         self.assertEqual(comp_name_list_len + 1, new_comp_name_list_len)
     else:
         print('去创建帐套失败!')
         self.assertEqual(0, 1)
Esempio n. 26
0
	def test_verify_login(self):
		"""登录管有帐"""
		login_page = LoginPage(CompInfo.BASE_URL, self.driver)
		if 'dev' in CompInfo.BASE_URL:
			sheet_name = 'dev'
		elif 'stage' in CompInfo.BASE_URL:
			sheet_name = 'stage'
		elif 'firms' in CompInfo.BASE_URL:
			sheet_name = 'pro'
		
		read_excel = ReadExcel(self.login_test_data_dir)
		login_test_data = read_excel.get_value_by_row(sheet_name, 1)
		print('login_test_data=>', login_test_data)
		login_page.login(login_test_data)
		
		page_url = self.driver.current_url
		print('page_url=>', page_url)
		self.assertIn('/app/company-list', page_url, msg='登录验证失败!')
Esempio n. 27
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)
Esempio n. 28
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()
Esempio n. 29
0
    def test_input_comp_name_jump_to_create_page(self):
        # create_ways_page_url = CompInfo.BASE_URL + '/create-ways'
        try:
            create_ways_page_url = CompInfo.BASE_URL + '/create-ways'
            self.driver.get(create_ways_page_url)
            if not PublicPage(self.driver).wait_until_loader_disapeared():
                print('创建帐套方式页面!')

                readExcel = ReadExcel(self.test_data_dir)
                test_data = readExcel.get_value_by_row('创建帐套方式', 1)
                createWaysPage = CreateWaysPage(self.driver)
                for comp_name in test_data:
                    createWaysPage.set_comp_name(comp_name)
                    createWaysPage.confirm_enter()
                time.sleep(2)
                self.assertIn('/create-company', self.driver.current_url)
            else:
                print('---去创建帐套方式页面失败!')
                exit()
        except AssertionError as e:
            logging.info('---测试输入帐套名称点击回车键跳转至创建帐套页面失败,或请求超时!')
Esempio n. 30
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])