This commit is contained in:
parent
45c8df1cb3
commit
ed01c141f5
|
@ -4,7 +4,7 @@ class CompInfo(object):
|
|||
BASE_URL = 'http://guanplus-app-accountingfirm-web-dev-1.cn-north-1.eb.amazonaws.com.cn'
|
||||
LOGIN_DATA = ['18612198503','Qq123456']
|
||||
# COMP_NAME = 'testyb'
|
||||
COMP_NAME ='dev跨年测试12月启用yb'
|
||||
COMP_NAME ='dev跨年测试1月启用yb'
|
||||
|
||||
# ------------------------------------------------
|
||||
# # stage
|
||||
|
|
14
readme.md
14
readme.md
|
@ -19,3 +19,17 @@ pip命令使用配置: 将python安装文件目录下Scripts配置到系统环
|
|||
# pip3 install openpyxl
|
||||
# pip3 install requests
|
||||
# pip3 install html-testRunner
|
||||
|
||||
|
||||
<!-- 代码规范 -->
|
||||
# class name(类名):
|
||||
# # 驼峰命名方法,首字母大写,单词之间大写字母连接,
|
||||
# # eg:LoginPage()
|
||||
|
||||
# method name(方法名):
|
||||
# # 字母小写,单词之间用下划线 _ 连接
|
||||
# # eg:set_password()
|
||||
|
||||
# variable name(变量名):
|
||||
# # 字母小写,单词之间用下划线 _ 连接
|
||||
# # eg:login_btn_elem
|
||||
|
|
|
@ -65,7 +65,7 @@ if __name__ == '__main__':
|
|||
|
||||
# 记发票
|
||||
# 记所有类别发票
|
||||
# testSuite.addTest(RecordInvoiceSpec('test_record_input_invoice'))
|
||||
testSuite.addTest(RecordInvoiceSpec('test_record_input_invoice'))
|
||||
# testSuite.addTest(RecordInvoiceSpec('test_record_output_invoice'))
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
# 操作按钮 xpath
|
||||
operation_btn_elem = '//*[@id="body"]/accounting-home-page/div[3]/div/div[2]/div[2]/button'
|
||||
# 按钮集合 class
|
||||
btn_drop_item_elem = '.dropdown-menu'
|
||||
# 操作下拉list tagname
|
||||
btn_tag_name_elem = 'button'
|
|
@ -0,0 +1,69 @@
|
|||
from selenium import webdriver
|
||||
from time import sleep
|
||||
from selenium.webdriver.common.action_chains import ActionChains
|
||||
from account_dashboard_elem import *
|
||||
from util.public_page import PublicPage
|
||||
|
||||
# 会计首页
|
||||
# 创建于2017-10-23日
|
||||
# caicai
|
||||
|
||||
|
||||
class AccountDashbaordPage(object):
|
||||
"""会计首页-page"""
|
||||
|
||||
def __init__(self, driver):
|
||||
self.driver = webdriver.Chrome()
|
||||
# self.driver = driver
|
||||
|
||||
# 点击操作按钮
|
||||
def click_operation_btn(self):
|
||||
page_url = self.driver.current_url
|
||||
print('[AccountDashbaordPage]--page_url=>', page_url)
|
||||
if '/app/home-page/accounting' in page_url:
|
||||
try:
|
||||
publicPage = PublicPage(self.driver)
|
||||
btn_loc = self.driver.find_element_by_xpath(operation_btn_elem)
|
||||
publicPage.click_elem(btn_loc)
|
||||
if publicPage.is_element_present(btn_drop_ite_elem):
|
||||
print('[AccountDashbaordPage]click_operation_btn--点击下拉操作 成功--')
|
||||
else:
|
||||
print('[AccountDashbaordPage]click_operation_btn--点击下拉操作 失败--')
|
||||
exit()
|
||||
except Exception as e:
|
||||
print(
|
||||
'[AccountDashbaordPage]click_operation_btn--点击下拉操作 失败--失败原因=>', str(e))
|
||||
exit()
|
||||
elif '/app/home-page/assist' in page_url:
|
||||
print('[AccountDashbaordPage]click_operation_btn--当前页面是助理首页,点击下拉操作 失败')
|
||||
else:
|
||||
print('[AccountDashbaordPage]click_operation_btn--非助理/会计首页,操作失败!')
|
||||
exit()
|
||||
|
||||
# 点击结转、过帐、反过帐、驳回审核按钮
|
||||
def select_operation_item(self, item_index):
|
||||
if item_index == 0:
|
||||
operation_name = '结转'
|
||||
elif item_index == 1:
|
||||
operation_name = '过帐'
|
||||
elif item_index == 2:
|
||||
operation_name = '反过帐'
|
||||
elif item_index == 3:
|
||||
operation_name = '驳回审核'
|
||||
page_url = self.driver.current_url
|
||||
print('[AccountDashbaordPage]--page_url=>', page_url)
|
||||
if '/app/home-page/accounting' in page_url:
|
||||
try:
|
||||
publicPage = PublicPage(self.driver)
|
||||
item_loc = self.driver.find_element_by_css_selector(
|
||||
btn_drop_item_elem).find_elements_by_tag_name(btn_tag_name_elem)[item_index]
|
||||
publicPage.click_elem(btn_loc)
|
||||
except Exception as e:
|
||||
print('[AccountDashbaordPage]select_operation_item--' +
|
||||
operation_name + ' 失败--失败原因=>', str(e))
|
||||
elif '/app/home-page/assist' in page_url:
|
||||
print('[AccountDashbaordPage]select_operation_item--' +
|
||||
operation_name + '失败')
|
||||
else:
|
||||
print('[AccountDashbaordPage]select_operation_item--' +
|
||||
operation_name + '失败!')
|
|
@ -21,8 +21,9 @@ class RecordInvoiceSpec(unittest.TestCase):
|
|||
# 发票测试数据地址
|
||||
record_invoice_data_dir = './test_data/cai/record_invoice_data.xlsx'
|
||||
|
||||
@classmethod
|
||||
def setUpClass(self):
|
||||
# @classmethod
|
||||
# def setUpClass(self):
|
||||
def setUp(self):
|
||||
# self.driver = webdriver.PhantomJS()
|
||||
self.driver = webdriver.Chrome()
|
||||
self.driver.implicitly_wait(30)
|
||||
|
@ -31,8 +32,9 @@ class RecordInvoiceSpec(unittest.TestCase):
|
|||
enterCompPage = EnterCompPage(self.driver)
|
||||
enterCompPage.enter_comp(CompInfo.ENTER_COMP_INFO)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(self):
|
||||
# @classmethod
|
||||
# def tearDownClass(self):
|
||||
def tearDown(self):
|
||||
self.driver.quit()
|
||||
# 纪录完所有数据,收票列表本月收票总额为263,097.00
|
||||
def test_record_input_invoice(self):
|
||||
|
@ -48,7 +50,7 @@ class RecordInvoiceSpec(unittest.TestCase):
|
|||
page.record_input_invoice(input_invoice_data)
|
||||
page.submit('save_and_new')
|
||||
print('input_invoice_data=>', input_invoice_data)
|
||||
time.sleep(3)
|
||||
time.sleep(3)
|
||||
alert_msg = alertPage.get_alert_msg()
|
||||
self.assertIn('发票保存成功', alert_msg)
|
||||
except Exception as e:
|
||||
|
@ -72,7 +74,7 @@ class RecordInvoiceSpec(unittest.TestCase):
|
|||
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)
|
||||
print('output_invoice_data=>', output_invoice_data)
|
||||
time.sleep(3)
|
||||
alert_msg = alertPage.get_alert_msg()
|
||||
self.assertEqual(alert_msg, '保存成功')
|
||||
|
|
|
@ -2,4 +2,16 @@
|
|||
# 添加按钮 xpath
|
||||
add_btn_elem = '//*[@id="body"]/setting/div[2]/div/app-partner-set/div[1]/div/button'
|
||||
# modal 框标题 class
|
||||
modal_title_elem = '.modal-title'
|
||||
modal_title_elem = '.modal-title'
|
||||
|
||||
# 添加股东
|
||||
# 股东名称
|
||||
partner_name_elem = '//*[@id="input-name"]'
|
||||
# 实缴金额
|
||||
actual_paid_elem = '//*[@id="submitAttempt"]/input'
|
||||
# 保存按钮 xpath
|
||||
save_btn_elem = '//*[@id="partnerDetailModal"]/div/div/div[3]/button[1]'
|
||||
# 取消按钮 xpath
|
||||
cancel_btn_elem = '//*[@id="partnerDetailModal"]/div/div/div[3]/button[2]'
|
||||
# 关闭modal框按钮xpath
|
||||
close_modal_btn_elem = '//*[@id="partnerDetailModal"]/div/div/div[1]/button/span'
|
|
@ -0,0 +1,92 @@
|
|||
from selenium import webdriver
|
||||
import time
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/' + '../../..'))
|
||||
import unittest
|
||||
from partner_set_elem import *
|
||||
from util.public_page import PublicPage
|
||||
from ..setting_page import SettingPage
|
||||
|
||||
|
||||
class PartnersetPage(object):
|
||||
|
||||
def __init__(self, driver):
|
||||
self.driver = webdriver.Chrome()
|
||||
# self.driver = driver
|
||||
|
||||
# 点击添加按钮
|
||||
def click_add_btn(self):
|
||||
try:
|
||||
publicPage = PublicPage(self.driver)
|
||||
global add_btn_loc = self.driver.find_element_by_xpath(add_btn_elem)
|
||||
publicPage.click_elem(add_btn_loc)
|
||||
input_loc = self.driver.find_element_by_xpath(partner_name_elem)
|
||||
if publicPage.is_element_present(input_loc):
|
||||
print('[PartnerSetPage]click_add_btn--点击添加按钮 成功!--')
|
||||
else:
|
||||
print('[PartnerSetPage]click_add_btn--点击添加按钮 失败!--')
|
||||
exit()
|
||||
except Exception as e:
|
||||
print('[PartnerSetPage]click_add_btn--点击添加按钮 失败--失败原因是=>', str(e))
|
||||
exit()
|
||||
|
||||
# 设置股东名称
|
||||
def set_partnerset_name(self, partnerset_name):
|
||||
try:
|
||||
publicPage = PublicPage(self.driver)
|
||||
input_loc = self.driver.find_element_by_xpath(partner_name_elem)
|
||||
publicPage.set_value(input_loc, partnerset_name)
|
||||
except Exception as e:
|
||||
print('[PartnerSetPage]set_partnerset_name--设置股东名称 失败--失败原因是=>', str(e))
|
||||
exit()
|
||||
|
||||
# 输入实缴金额
|
||||
def set_actual_paid(self, amount):
|
||||
try:
|
||||
publicPage = PublicPage(self.driver)
|
||||
input_loc = self.driver.find_element_by_xpath(actual_paid_elem)
|
||||
publicPage.set_value(input_loc)
|
||||
except Exception as e:
|
||||
print('[PartnerSetPage]set_actual_paid--设置实缴金额 失败--失败原因是=>', str(e))
|
||||
exit()
|
||||
|
||||
def submit(self, btn_name):
|
||||
try:
|
||||
if btn_name == 'save':
|
||||
btn_elem = save_btn_elem
|
||||
btn_name = '保存按钮'
|
||||
elif btn_name == 'cancel':
|
||||
btn_elem = cancel_btn_elem
|
||||
btn_name = '取消按钮'
|
||||
else:
|
||||
return False
|
||||
btn_loc = self.driver.find_element_by_xpath(btn_elem)
|
||||
publicPage = PublicPage(self.driver)
|
||||
publicPage.click_elem(btn_loc)
|
||||
except Exception as e:
|
||||
print('[PartnerSetPage]submit--点击' +
|
||||
btn_name + ' 失败--失败原因是=>', str(e))
|
||||
exit()
|
||||
|
||||
def close_modal(self):
|
||||
try:
|
||||
publicPage = PublicPage(self.driver)
|
||||
btn_loc = self.driver.find_element_by_xpath(close_modal_btn_elem)
|
||||
publicPage.click_elem(btn_loc)
|
||||
except Exception as e:
|
||||
print('[PartnerSetPage]close_modal--关闭modal框失败 失败--失败原因是=>', str(e))
|
||||
exit()
|
||||
|
||||
def add_partnerset(self,partnerset_info):
|
||||
settingPage = SettingPage(self.driver,CompInfo.BASE_URL)
|
||||
settingPage.go_to_partnerset_page()
|
||||
page_url = self.driver.current_url
|
||||
publicPage = PublicPage(self.driver)
|
||||
if publicPage.is_element_present(add_btn_loc):
|
||||
self.set_partnerset_name(partnerset_info[0])
|
||||
self.set_actual_paid(partnerset_info[1])
|
||||
self.submit('save')
|
||||
else:
|
||||
print('[PartnersetPage]add_partnerset--去股东页面失败--当前页面url=>',page_url)
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
from selenium import webdriver
|
||||
import unittest
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
from util.public_page import PublicPage
|
||||
from partner_set_page import PartnersetPage
|
||||
from partner_set_elem import *
|
||||
from util.read_excel import ReadExcel
|
||||
from util.danger_page import DangerPage
|
||||
from util.alert_page import AlertPage
|
||||
from util.enter_comp_page import EnterCompPage
|
||||
from comp_info import CompInfo
|
||||
from ..setting_page import SettingPage
|
||||
# 往来信息
|
||||
# 创建于 2017-09-28-四
|
||||
# caicai
|
||||
|
||||
|
||||
class PartnersetSpec(unittest.TestCase):
|
||||
''' 添加往来测试'''
|
||||
|
||||
# 添加往来测试数据
|
||||
# partnerset_test_data = './test_data/cai/contact_test_data.xlsx'
|
||||
|
||||
@classmethod
|
||||
def setUpClass(self):
|
||||
self.driver = webdriver.Chrome()
|
||||
# self.driver = webdriver.PhantomJS()
|
||||
self.driver.implicitly_wait(30)
|
||||
self.driver.set_window_size(1280, 800)
|
||||
|
||||
enterCompPage = EnterCompPage(self.driver)
|
||||
enterCompPage.enter_comp(CompInfo.ENTER_COMP_INFO)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(self):
|
||||
self.driver.quit()
|
||||
|
||||
def test_click_add_btn(self):
|
||||
"""测试 添加股东按钮是否有效,点击添加按钮,股东modal框显示"""
|
||||
settingPage = SettingPage(self.driver,CompInfo.BASE_URL)
|
||||
page = PartnersetPage(self.driver)
|
||||
publicPage = PublicPage(self.driver)
|
||||
settingPage.go_to_partnerset_page()
|
||||
try:
|
||||
page.click_add_btn()
|
||||
input_loc = self.driver.find_element_by_xpath(partner_name_elem)
|
||||
result = publicPage.is_element_present(input_loc)
|
||||
self.assertEqual(result, True)
|
||||
except Exception as e:
|
||||
print('[PartnersetSpec]--测试 添加股东按钮是否有效 失败--')
|
||||
|
||||
def test_partnerset_empty(self):
|
||||
page = PartnersetPage(self.driver)
|
||||
publicPage = PublicPage(self.driver)
|
||||
try:
|
||||
page.add_partnerset()
|
||||
|
||||
|
||||
|
||||
|
|
@ -9,14 +9,15 @@ from .setting_elem import *
|
|||
|
||||
class SettingPage(object):
|
||||
|
||||
def __init__(self, driver):
|
||||
def __init__(self, driver,base_url):
|
||||
self.driver = driver
|
||||
self.base_url = base_url
|
||||
|
||||
# 去帐套信息页面(管理员角色)
|
||||
def go_to_setting_page(self, base_url):
|
||||
def go_to_setting_page(self):
|
||||
try:
|
||||
publicPage = PublicPage(self.driver)
|
||||
self.driver.get(base_url + comp_billing_url)
|
||||
self.driver.get(self.base_url + comp_billing_url)
|
||||
time.sleep(3)
|
||||
comp_billing_loc = self.driver.find_element_by_xpath(
|
||||
comp_billing_xpath)
|
||||
|
@ -29,10 +30,10 @@ class SettingPage(object):
|
|||
'[SettingPage] There was an exception when go_to_setting_page= %s', str(e))
|
||||
|
||||
# 去往来信息页面
|
||||
def go_to_contact_page(self, base_url):
|
||||
def go_to_contact_page(self):
|
||||
try:
|
||||
publicPage = PublicPage(self.driver)
|
||||
self.driver.get(base_url + contact_url)
|
||||
self.driver.get(self.base_url + contact_url)
|
||||
time.sleep(3)
|
||||
add_loc = self.driver.find_element_by_xpath(contact_xpath)
|
||||
if publicPage.is_element_present(add_loc):
|
||||
|
@ -44,10 +45,10 @@ class SettingPage(object):
|
|||
'[SettingPage] There was an exception when go_to_contact_page= %s', str(e))
|
||||
|
||||
# 去用户管理页面
|
||||
def go_to_mutil_user_page(self, base_url):
|
||||
def go_to_mutil_user_page(self):
|
||||
try:
|
||||
publicPage = PublicPage(self.driver)
|
||||
self.driver.get(base_url + mutil_user_url)
|
||||
self.driver.get(self.base_url + mutil_user_url)
|
||||
time.sleep(3)
|
||||
start_loc = self.driver.find_element_by_xpath(multi_user_xpath)
|
||||
if publicPage.is_element_present(start_loc):
|
||||
|
@ -59,10 +60,10 @@ class SettingPage(object):
|
|||
'[SettingPage] There was an exception when go_to_mutil_user_page= %s', str(e))
|
||||
|
||||
# 去股东页面
|
||||
def go_to_partner_set_page(self, base_url):
|
||||
def go_to_partnerset_page(self):
|
||||
try:
|
||||
publicPage = PublicPage(self.driver)
|
||||
self.driver.get(base_url + partner_set_url)
|
||||
self.driver.get(self.base_url + partner_set_url)
|
||||
time.sleep(3)
|
||||
add_loc = self.driver.find_element_by_xpath(partner_set_url)
|
||||
if publicPage.is_element_present(start_loc):
|
||||
|
@ -74,10 +75,10 @@ class SettingPage(object):
|
|||
'[SettingPage] There was an exception when go_to_partner_set_page= %s', str(e))
|
||||
|
||||
# 去税率设置页面
|
||||
def go_to_tax_rate_page(self, base_url):
|
||||
def go_to_tax_rate_page(self):
|
||||
try:
|
||||
publicPage = PublicPage(self.driver)
|
||||
self.driver.get(base_url + tax_rate_url)
|
||||
self.driver.get(self.base_url + tax_rate_url)
|
||||
time.sleep(3)
|
||||
tax_loc = self.driver.find_element_by_xpath(tax_rate_url)
|
||||
if publicPage.is_element_present(tax_loc):
|
||||
|
|
|
@ -45,10 +45,10 @@ class SettingSpec(unittest.TestCase):
|
|||
current_url = self.driver.current_url
|
||||
self.assertIn(mutil_user_url,current_url)
|
||||
|
||||
def test_go_to_partner_set_page(self):
|
||||
def test_go_to_partnerset_page(self):
|
||||
"""测试-去股东页面"""
|
||||
page = SettingPage(self.driver)
|
||||
page.go_to_partner_set_page(CompInfo.BASE_URL)
|
||||
page.go_to_partnerset_page(CompInfo.BASE_URL)
|
||||
current_url = self.driver.current_url
|
||||
self.assertIn(partner_set_url,current_url)
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ class RecordTransactionSpec(unittest.TestCase):
|
|||
def tearDownClass(self):
|
||||
self.driver.quit()
|
||||
|
||||
#
|
||||
# 纪录完收入、支出、互转,收支列表本月收入、支出总额为42,650.92 ,70,584.30
|
||||
def test_record_income(self):
|
||||
"""测试记多条收入"""
|
||||
readExcel = ReadExcel(self.revenue_and_expenditure_data_dir)
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue