Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
test
autotest-airtest-web-sc
Commits
0a2fc41a
Commit
0a2fc41a
authored
Nov 14, 2023
by
17322369953
Browse files
guke先推送部分
parent
a160c685
Changes
29
Expand all
Hide whitespace changes
Inline
Side-by-side
guke/test_purchase_management/__init__.py
0 → 100644
View file @
0a2fc41a
guke/test_purchase_management/base_test_new_purchase_op.py
0 → 100644
View file @
0a2fc41a
# pytest -s test_purchase_management/test_new_purchase_op.py::TestNewPurchase::test_new_purchase --alluredir ./report --clean-alluredir
# pytest -s test_purchase_management/test_new_purchase_op.py::TestNewPurchase::test_new_purchase --count=2
# “00122国药集团四川省医疗器械有限公司”向“1018063 成都安进科技有限公司”;采购“10022230 玻璃火罐222";
# 商品从仓库“103303北京公司-顺义库”出库到仓库“122466 四川骨科分仓”入库。
import
pytest
import
allure
import
time
from
selenium
import
webdriver
from
selenium.common
import
NoSuchElementException
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.common.action_chains
import
ActionChains
from
selenium.webdriver.support
import
expected_conditions
as
ec
from
selenium.webdriver.support.ui
import
WebDriverWait
from
common.read_config
import
ReadConfig
from
common.verifycode
import
VerifyCode
from
common.logger
import
log
from
common
import
constant
from
test_purchase_management.page_purchase_op
import
PagePurchaseOP
@
allure
.
feature
(
"采购测试"
)
class
TestNewPurchase
:
'''每执行一个案例都进行登录与退出'''
@
pytest
.
fixture
(
scope
=
'function'
,
autouse
=
True
)
def
house_work
(
self
,
browser
):
# 驱动器从fixture传来
self
.
driver
=
browser
# 从配置文件中获取url
self
.
url
=
ReadConfig
().
get
(
'HOST'
,
'URL'
)
# 引入本页面的操作元素
self
.
page
=
PagePurchaseOP
(
self
.
driver
)
# 打开页面
self
.
page
.
open_page
(
self
.
url
)
# 登录
self
.
login_process
()
def
login_process
(
self
):
account_element
=
self
.
page
.
get_account
()
# 密码
password_element
=
self
.
page
.
get_password
()
# 验证码
verify_input_element
=
self
.
page
.
get_verify_code
()
# 输入账号密码,账号密码从配置文件中来
self
.
page
.
input_text
(
account_element
,
ReadConfig
().
get
(
'ACCOUNT-PURCHASE'
,
'ACCOUNT'
))
self
.
page
.
input_text
(
password_element
,
ReadConfig
().
get
(
'ACCOUNT-PURCHASE'
,
'PASSWORD'
))
# 登录时,最多尝试5次,5次失败,该案例失败
i
=
5
while
i
>
0
:
# 获取验证码
# 先获取验证码图片元素
verify_code_element
=
self
.
page
.
get_verify_image
()
# 获取验证码中的文字信息
verify_code_text
=
VerifyCode
(
verify_code_element
,
self
.
driver
).
indentify_verify_image_guke
()
# 填充验证码文字
self
.
page
.
input_text
(
verify_input_element
,
verify_code_text
)
# 获取登录按钮
login_button_element
=
self
.
page
.
get_login_button
()
# 点击登录
self
.
page
.
single_click
(
login_button_element
)
# 判断登录是否成功,登录成功会切换到另外一个页面,通过页面title来判断是否切换成功
if
self
.
page
.
get_window_title
()
!=
constant
.
LOGIN_SUCCESS
:
# 表示不登录成功,此时将1减去1
i
-=
1
else
:
# 表示登录成功,跳出循环
log
.
info
(
'登录成功,开始执行案例'
)
break
if
i
<=
0
:
log
.
info
(
'本案例执行时登录失败'
)
assert
False
@
pytest
.
mark
.
start
def
test_new_purchase
(
self
):
# 睡眠时间
sleep_time
=
2
# 入库公司
enter_company
=
'00103'
# 供应商
supplier_content
=
'1003207'
# 协议合同内容
protocol_content
=
''
# 商品名字
product_name
=
'测试商品HCL-0721'
# 商品编码
product_code
=
'10155572'
# 商品信息
merchandise_content
=
'10005528'
# 订购数量
purchase_sum
=
10
# 仓库模糊搜索内容
ware_content
=
'103356'
# 业务员内容
businessman_content
=
""
# 仓库编码内容
ware_name
=
'自管库-总库'
# 开始
# 登录完成,开始下单
# 定位采购管理元素
purchase_management_button
=
self
.
page
.
get_purchase_management
()
# 鼠标移动到采购管理按钮
self
.
page
.
move_to_element
(
purchase_management_button
)
# 定位到隐藏的采购按钮
purchase_button
=
self
.
page
.
get_purchase
()
# 鼠标移动到采购按钮
self
.
page
.
move_to_element
(
purchase_button
)
# 定位到采购申请op
purchase_op_button
=
self
.
page
.
get_purchase_op
()
# 鼠标移动到采购申请op
self
.
page
.
move_to_element
(
purchase_op_button
)
# 点击采购申请op
purchase_op_button
.
click
()
# 后续所有操作在采购iframe下先进入到采购iframe
iframe_purchase
=
self
.
page
.
get_iframe_purchase
()
# 转到这个iframe下
self
.
page
.
switch_to_iframe
(
iframe_purchase
)
# 点击新建
new_create_button
=
self
.
page
.
get_new
()
self
.
page
.
single_click
(
new_create_button
)
# 后续操作在一对话框形式的iframe里,切换到这个子iframe
sub_iframe_dialog
=
self
.
page
.
get_sub_iframe_dialog
()
self
.
page
.
switch_to_iframe
(
sub_iframe_dialog
)
# 获取查询公司请求元素
company_request
=
self
.
page
.
get_company_request
()
# 点击请求进入查询
self
.
page
.
single_click
(
company_request
)
# 获取对话框中的搜索输入条件
company_input
=
self
.
page
.
get_company_input
()
# 输入公司编码
self
.
page
.
input_text
(
company_input
,
enter_company
)
# 公司信息输入后,点击搜索
company_search
=
self
.
page
.
get_company_search
()
self
.
page
.
single_click
(
company_search
)
# 查询后表信息处理,数据详情记录在公司表里,公司表在公司dialog中,先去这个dialog
# 获取公司dialog
company_dialog
=
self
.
page
.
get_company_dialog
()
# 从dialog中获取表信息
company_table
=
self
.
page
.
get_table_from_dialog
(
company_dialog
)
# company_table = self.page.get_company_table()
# 在获取该表的行信息
company_table_rows
=
self
.
page
.
get_all_rows_from_tale
(
company_table
)
# 遍历该表所有的行
for
i
,
curr_row
in
enumerate
(
company_table_rows
):
# 获取当前行的列
columns
=
self
.
page
.
get_all_columns_from_row
(
curr_row
)
# 遍历列内容,这里只是先打印出日志,便于查看问题
#for j, curr_column in enumerate(columns):
# log.info('查询出的公司信息表,的第 %s 行,第 %s 列的内容为 %s' % (i, j, self.page.get_text(curr_column)))
# 挑选出一列,公司编码与输入编码一样的公司信息,因为前端是模糊查询,有可能是公司编码,有可能是公司名称,匹配第一条即可
if
(
enter_company
in
self
.
page
.
get_text
(
columns
[
2
]))
or
(
enter_company
in
self
.
page
.
get_text
(
columns
[
1
])):
'''选中当前的行'''
self
.
page
.
single_click
(
curr_row
)
'''点击确认'''
company_table_ensure
=
self
.
page
.
get_company_table_ensure
()
self
.
page
.
single_click
(
company_table_ensure
)
'''选中后退出,不再查询'''
break
# try:
# # 处理清空提示信息
# clear_mind_element = driver.find_element(By.XPATH, '/html/body/div[41]/div/div/div[3]/button[2]')
# clear_mind_element.click()
# except NoSuchElementException:
# pass
# 切换到仓库信息
ware_info
=
self
.
page
.
get_ware_info
()
self
.
page
.
single_click
(
ware_info
)
# 点击仓库请求按钮
ware_request
=
self
.
page
.
get_ware_request
()
self
.
page
.
single_click
(
ware_request
)
# 输入仓库数据
ware_input
=
self
.
page
.
get_ware_input
()
self
.
page
.
input_text
(
ware_input
,
ware_content
)
# 搜索仓库信息
ware_search
=
self
.
page
.
get_ware_search
()
self
.
page
.
single_click
(
ware_search
)
# 仓库dialog
ware_dialog
=
self
.
page
.
get_ware_dialog
()
# 确定仓库信息的表
ware_table
=
self
.
page
.
get_ware_table
()
# 获取该表下的行数据集
ware_table_rows
=
self
.
page
.
get_all_rows_from_tale
(
ware_table
)
log
.
info
(
"仓库表的行:%s"
%
ware_table_rows
)
# 遍历仓库表行
for
i
,
current_row
in
enumerate
(
ware_table_rows
):
# 获取当前行的列
columns
=
self
.
page
.
get_all_columns_from_row
(
current_row
)
# 遍历列内容,这里只是先打印出日志,便于查看问题
#for j, curr_column in enumerate(columns):
# log.info('查询出仓库表,的第 %s 行,第 %s 列的内容为 %s' % (i, j, self.page.get_text(curr_column)))
# 挑选出一列,因为前端是模糊查询,有可能是仓库编码,有可能是仓库名称,匹配第一条即可
if
(
ware_content
in
self
.
page
.
get_text
(
columns
[
1
]))
or
(
ware_content
in
self
.
page
.
get_text
(
columns
[
2
])):
'''选中当前行'''
self
.
page
.
single_click
(
current_row
)
'''点击确认'''
# ware_table_ensure = self.page.get_ware_table_ensure()
ware_table_ensure
=
self
.
page
.
get_ensure_from_dialog
(
ware_dialog
)
self
.
page
.
single_click
(
ware_table_ensure
)
'''选中后退出,不再查询'''
break
# 获取供应商
# 触发请求供应商按钮
supplier_request
=
self
.
page
.
get_supplier_request
()
self
.
page
.
single_click
(
supplier_request
)
# 输入供应商信息
supplier_input
=
self
.
page
.
get_supplier_input
()
self
.
page
.
input_text
(
supplier_input
,
supplier_content
)
# 开始查询,点击搜索按钮查询
supplier_search
=
self
.
page
.
get_supplier_search
()
self
.
page
.
single_click
(
supplier_search
)
# 获取供应商dialog
supplier_dialog
=
self
.
page
.
get_supplier_dialog
()
# 获取查询结果,先获取结果表
supplier_table
=
self
.
page
.
get_table_from_dialog
(
supplier_dialog
)
# 获取供应商表中的所有行
supplier_table_rows
=
self
.
page
.
get_all_rows_from_tale
(
supplier_table
)
# 遍历供应商
for
i
,
current_row
in
enumerate
(
supplier_table_rows
):
# 获取当前供应商的列信息
columns
=
self
.
page
.
get_all_columns_from_row
(
current_row
)
# 遍历列内容,这里只是先打印出日志,便于查看问题
#for j, curr_column in enumerate(columns):
# log.info('查询出供应商表,的第 %s 行,第 %s 列的内容为 %s' % (i, j, self.page.get_text(curr_column)))
# 挑选出一列,因为前端是模糊查询,有可能是供应商编码,有可能是供应商名称,匹配第一条即可
if
(
supplier_content
in
self
.
page
.
get_text
(
columns
[
1
]))
or
(
supplier_content
in
self
.
page
.
get_text
(
columns
[
2
])):
'''选中当前行'''
self
.
page
.
single_click
(
current_row
)
'''点击确认'''
supplier_table_ensure
=
self
.
page
.
get_ensure_from_dialog
(
supplier_dialog
)
self
.
page
.
single_click
(
supplier_table_ensure
)
'''选中后退出,不再查询'''
break
# 客户协议
# 客户协议请求按钮
protocol_request
=
self
.
page
.
get_protocol_request
()
self
.
page
.
single_click
(
protocol_request
)
# 输入协议内容
protocol_input
=
self
.
page
.
get_protocol_input
()
self
.
page
.
input_text
(
protocol_input
,
protocol_content
)
# 开始搜索协议
protocol_search
=
self
.
page
.
get_protocol_search
()
self
.
page
.
single_click
(
protocol_search
)
# 获取协议dialog
protocol_dialog
=
self
.
page
.
get_protocol_dialog
()
# 获取协议表
protocol_table
=
self
.
page
.
get_table_from_dialog
(
protocol_dialog
)
# 获取这个表中的行
protocol_table_rows
=
self
.
page
.
get_all_rows_from_tale
(
protocol_table
)
# 遍历行
for
i
,
curr_row
in
enumerate
(
protocol_table_rows
):
# 获取当前协议的所有列
columns
=
self
.
page
.
get_all_columns_from_row
(
curr_row
)
#for j, curr_column in enumerate(columns):
# 遍历列内容,这里只是先打印出日志,便于查看问题
# log.info('查询出合同协议表,的第 %s 行,第 %s 列的内容为 %s' % (i, j, self.page.get_text(curr_column)))
# 挑选一列,模糊搜索,匹配合同/协议号,合同号,项目编码,项目名称,业态编码,对方编码,产品线编码
if
((
protocol_content
in
self
.
page
.
get_text
(
columns
[
1
]))
or
(
protocol_content
in
self
.
page
.
get_text
(
columns
[
2
]))
or
(
protocol_content
in
self
.
page
.
get_text
(
columns
[
3
]))
or
(
protocol_content
in
self
.
page
.
get_text
(
columns
[
4
]))
or
(
protocol_content
in
self
.
page
.
get_text
(
columns
[
5
]))
or
(
protocol_content
in
self
.
page
.
get_text
(
columns
[
6
]))
or
(
protocol_content
in
self
.
page
.
get_text
(
columns
[
8
]))):
# 选中当前行
self
.
page
.
single_click
(
curr_row
)
# 获取协议确定按钮,点击确定
protocol_ensure
=
self
.
page
.
get_ensure_from_dialog
(
protocol_dialog
)
self
.
page
.
single_click
(
protocol_ensure
)
break
# 填写业务员
# 获取业务员请求按钮,点击请求业务员信息
businessman_request
=
self
.
page
.
get_businessman_request
()
self
.
page
.
single_click
(
businessman_request
)
# 输入业务员信息
businessman_input
=
self
.
page
.
get_businessman_input
()
self
.
page
.
input_text
(
businessman_input
,
businessman_content
)
# 点击搜索业务员信息
businessman_search
=
self
.
page
.
get_businessman_search
()
self
.
page
.
single_click
(
businessman_search
)
# 获取业务员dialog
businessman_dialog
=
self
.
page
.
get_businessman_dialog
()
# 获取表信息
businessman_table
=
self
.
page
.
get_table_from_dialog
(
businessman_dialog
)
# 获取表信息里面的当前行
businessman_rows
=
self
.
page
.
get_all_rows_from_tale
(
businessman_table
)
# 遍历业务员
for
i
,
current_row
in
enumerate
(
businessman_rows
):
# 获取当前供应商的列信息
columns
=
self
.
page
.
get_all_columns_from_row
(
current_row
)
# 遍历列内容,这里只是先打印出日志,便于查看问题
#for j, curr_column in enumerate(columns):
# log.info('查询出业务员表,的第 %s 行,第 %s 列的内容为 %s' % (i, j, self.page.get_text(curr_column)))
# 挑选出一列,模糊查询,匹配业务员编码,业务员名称,部门编码,部门名称,保证业务类型是‘IS’
if
((
businessman_content
in
self
.
page
.
get_text
(
columns
[
1
]))
or
(
businessman_content
in
self
.
page
.
get_text
(
columns
[
2
]))
or
(
businessman_content
in
self
.
page
.
get_text
(
columns
[
3
]))
or
(
businessman_content
in
self
.
page
.
get_text
(
columns
[
4
])))
and
(
'IS'
==
self
.
page
.
get_text
(
columns
[
5
])):
'''选中当前行'''
self
.
page
.
single_click
(
current_row
)
'''点击确认'''
ensure
=
self
.
page
.
get_ensure_from_dialog
(
businessman_dialog
)
self
.
page
.
single_click
(
ensure
)
'''选中后退出,不再查询'''
break
# 商品录入
# 点击商品录入按钮
merchandise
=
self
.
page
.
get_merchandise
()
self
.
page
.
single_click
(
merchandise
)
# 获取商品dialog
merchandise_dialog
=
self
.
page
.
get_merchandise_dialog
()
# 输入商品信息
#merchandise_input = self.page.get_input_from_dialog(merchandise_dialog)
merchandise_input
=
self
.
page
.
get_merchandise_input
()
self
.
page
.
input_text
(
merchandise_input
,
merchandise_content
)
# 点击搜索
#merchandise_search = self.page.get_search_from_dialog(merchandise_dialog)
merchandise_search
=
self
.
page
.
get_merchandise_search
()
self
.
page
.
single_click
(
merchandise_search
)
# 获取搜索出来的表信息
merchandise_table
=
self
.
page
.
get_table_from_dialog
(
merchandise_dialog
)
# 获取表的全部行
merchandise_table_rows
=
self
.
page
.
get_all_rows_from_tale
(
merchandise_table
)
# 遍历行
for
i
,
current_row
in
enumerate
(
merchandise_table_rows
):
# 获取当前供应商的列信息
columns
=
self
.
page
.
get_all_columns_from_row
(
current_row
)
# 遍历列内容,这里只是先打印出日志,便于查看问题
#for j, curr_column in enumerate(columns):
# log.info('查询出商品表,的第 %s 行,第 %s 列的内容为 %s' % (i, j, self.page.get_text(curr_column)))
# 挑选出一列,模糊查询,匹配商品编码,商品名称,规格型号,厂家物料编码
if
((
merchandise_content
in
self
.
page
.
get_text
(
columns
[
2
]))
or
(
businessman_content
in
self
.
page
.
get_text
(
columns
[
3
]))
or
(
businessman_content
in
self
.
page
.
get_text
(
columns
[
4
]))
or
(
businessman_content
in
self
.
page
.
get_text
(
columns
[
6
]))):
'''选中当前行'''
self
.
page
.
single_click
(
current_row
)
'''点击确认'''
ensure
=
self
.
page
.
get_ensure_from_dialog
(
merchandise_dialog
)
self
.
page
.
single_click
(
ensure
)
'''选中后退出,不再查询'''
break
# 保存
save_button
=
self
.
page
.
get_save
()
self
.
page
.
single_click
(
save_button
)
# 获取采购单号
order_no
=
self
.
page
.
get_order_no
()
log
.
info
(
"订单号:%s"
%
self
.
page
.
get_text
(
order_no
))
guke/test_purchase_management/page_purchase_op.py
0 → 100644
View file @
0a2fc41a
from
test_login.page_login
import
PageLogin
from
selenium.webdriver.remote.webdriver
import
By
class
PagePurchaseOP
(
PageLogin
):
# 采购管理元素
_purchase_management_locator
=
(
By
.
XPATH
,
'//div[@class="menuNavItem" and @sysname="采购管理"]'
)
# 采购元素
_purchase_locator
=
(
By
.
XPATH
,
'//div[@class="sec-menu" and @navname="采购"]'
)
# 采退元素
_return_locator
=
(
By
.
XPATH
,
'//div[@class="sec-menu" and @navname="采退"]'
)
# 采购订单op
_purchase_op_locator
=
(
By
.
XPATH
,
'//div[@class="third-menu" and @navname="采购订单(OP)"]'
)
# 采购iframe
_iframe_purchase_locator
=
(
By
.
XPATH
,
'//iframe[@class="metro-main-frame" and contains(@src,"purchases")]'
)
# 新建按钮
_new_locator
=
(
By
.
XPATH
,
'//span[text() = "新建"]'
)
# 对话框iframe,填写订单信息需要
_sub_iframe_dialog_locator
=
(
By
.
XPATH
,
'//iframe[contains(@name,"dialog-iframe")]'
)
# 请求查询公司信息按钮元素
_company_request_locator
=
(
By
.
XPATH
,
'//input[starts-with(@id,"el-id-") and contains(@id,"-106")]/../span/span/i'
)
# 公司信息输入元素
_company_input_locator
=
(
By
.
XPATH
,
'//input[@placeholder = "模糊检索:公司名称,公司编码"]'
)
# 公司信息搜索元素
_company_search_locator
=
(
By
.
XPATH
,
'//input[@placeholder = "模糊检索:公司名称,公司编码"]/../span/span/i'
)
# 公司表dialog body
_company_dialog_locator
=
(
By
.
XPATH
,
'//div[starts-with(@id,"el-id-") and contains(@id,"-21") and @class="el-dialog__body"]'
)
# 公司表-----这个只能找绝对路径了,开发太狠了
# _company_table_locator = (
# By.XPATH, '/html/body/div[6]/div/div/div/div[1]/div[2]/div[1]/div/div/div/div[1]/div[3]/div/div[1]/div/table')
_company_table_locator
=
(
By
.
CLASS_NAME
,
"el-table__body"
)
# 公司确定按钮
_company_table_ensure_locator
=
(
By
.
XPATH
,
'//span[@class="ensureBtn"]/button/span[text() = "确定"]'
)
# 仓库信息
_ware_info_locator
=
(
By
.
ID
,
'tab-a58f571e-7488-4c22-bec0-67428972871d'
)
# 主体信息
_main_info_locator
=
(
By
.
ID
,
'tab-7667cf55-c391-4f2c-a5ba-c0f6d27b6d3a'
)
# 请求查询仓库元素
_ware_request_locator
=
(
By
.
XPATH
,
'//input[starts-with(@id,"el-id-") and contains(@id,"-107")]/../span/span/i'
)
# 仓库输入元素
_ware_input_locator
=
(
By
.
XPATH
,
'//input[@placeholder = "模糊检索:仓库名称,仓库编码"]'
)
# 仓库搜索元素
_ware_search_locator
=
(
By
.
XPATH
,
'//input[@placeholder = "模糊检索:仓库名称,仓库编码"]/../span/span/i'
)
# 仓库表-----这个只能找绝对路径了,开发太狠了
# _ware_table_locator = (
# By.XPATH, '/html/body/div[8]/div/div/div/div[1]/div[2]/div[1]/div/div/div/div[1]/div[3]/div/div[1]/div/table')
# 仓库表,通过dialog定位
# _ware_table_locator = (By.XPATH, '//div[@role = "dialog" and @aria-label = "选择仓库"]/*/table[@class = "el-table__body"]')
_ware_dialog_locator
=
(
By
.
XPATH
,
'//div[starts-with(@id,"el-id-") and contains(@id,"-26") and @class="el-dialog__body"]'
)
_ware_table_locator
=
'By.XPATH, "//table[@class = "el-table__body""'
# 仓库表确认元素---这中确定看着可以统一
_ware_table_ensure_locator
=
(
By
.
XPATH
,
'//span[@class="ensureBtn"]/button/span[text() = "确定"]'
)
# 查询供应商请求元素
_supplier_request_locator
=
(
By
.
XPATH
,
'//input[starts-with(@id,"el-id-") and contains(@id,"-108")]/../span/span/i'
)
# 供应商输入信息
_supplier_input_locator
=
(
By
.
XPATH
,
'//input[@placeholder = "模糊检索:供应商名称,供应商编码"]'
)
# 供应商搜索元素
_supplier_search_locator
=
(
By
.
XPATH
,
'//input[@placeholder = "模糊检索:供应商名称,供应商编码"]/../span/span/i'
)
# 供应商表元素-----这个只能找绝对路径了,开发太狠了
_supplier_table_locator
=
(
By
.
XPATH
,
'/html/body/div[10]/div/div/div/div[1]/div[2]/div[1]/div/div/div/div[1]/div[3]/div/div[1]/div/table'
)
# 供应商dialog
_supplier_dialog_locator
=
(
By
.
XPATH
,
'//div[starts-with(@id,"el-id-") and contains(@id,"-31") and @class="el-dialog__body"]'
)
# 供应商表确定元素---这中确定看着可以统一
_supplier_table_ensure_locator
=
(
By
.
XPATH
,
'./span[@class="ensureBtn"]/button/span[text() = "确定"]'
)
_dialog_ensure_locator
=
'./*/span[@class="ensureBtn"]/button/span[text() = "确定"]'
# 协议请求元素
_protocol_request_locator
=
(
By
.
XPATH
,
'//input[starts-with(@id,"el-id-") and contains(@id,"-109")]/../span/span/i'
)
# 协议输入元素
_protocol_input_locator
=
(
By
.
XPATH
,
'//input[@placeholder = "模糊检索:合同/协议号,合同号,项目编码,项目名称,业态编码,对方编码,产品线编码"]'
)
# 协议搜索元素
_protocol_search_locator
=
(
By
.
XPATH
,
'//input[@placeholder = "模糊检索:合同/协议号,合同号,项目编码,项目名称,业态编码,对方编码,产品线编码"]/../span/span/i'
)
# 协议dialog元素
_protocol_dialog_locator
=
(
By
.
XPATH
,
'//div[starts-with(@id,"el-id-") and contains(@id,"-36") and @class="el-dialog__body"]'
)
# 业务员请求元素
_businessman_request_locator
=
(
By
.
XPATH
,
'//input[starts-with(@id,"el-id-") and contains(@id,"-110")]/../span/span/i'
)
# 业务员输入元素
_businessman_input_locator
=
(
By
.
XPATH
,
'//input[@placeholder="模糊检索:业务员编码,业务员名称,部门编码,部门名称"]'
)
# 业务员搜索元素
_businessman_search_locator
=
(
By
.
XPATH
,
'//input[@placeholder="模糊检索:业务员编码,业务员名称,部门编码,部门名称"]/../span/span/i'
)
# 业务员dialog元素
_businessman_dialog_locator
=
(
By
.
XPATH
,
'//div[starts-with(@id,"el-id-") and contains(@id,"-41") and @class="el-dialog__body"]'
)
# 商品录入按钮
_merchandise_locator
=
(
By
.
XPATH
,
'//span[text()="商品录入"]'
)
# 商品dialog
_merchandise_dialog_locator
=
(
By
.
XPATH
,
'//div[starts-with(@id,"el-id-") and contains(@id,"-124") and @class="el-dialog__body"]'
)
# 商品输入元素
_merchandise_input_locator
=
(
By
.
XPATH
,
'//input[@placeholder="模糊检索:商品编码,商品名称,规格型号,厂家物料编码"]'
)
# 商品搜索元素
_merchandise_search_locator
=
(
By
.
XPATH
,
'//input[@placeholder="模糊检索:商品编码,商品名称,规格型号,厂家物料编码"]/../span/span/i'
)
# dialog中的输入元素
_dialog_input_locator
=
'./*/input[@class="el-input__inner" and @placeholder="模糊检索:商品编码,商品名称,规格型号,厂家物料编码"]'
# dialog中的搜索元素
_dialog_search_locator
=
'./*/span[@class="el-input__prefix-inner"]/i'
"""表格中输入元素"""
_input_in_table_locator
=
'input'
# 保存按钮
# _save_locator = (By.XPATH, '//*[@id="process-toolbar"]/button[4]/span/text()')
_save_locator
=
(
By
.
XPATH
,
'//*[@id="process-toolbar"]/*/span[text()="保存"]'
)
# 订单号
_order_no_locator
=
(
By
.
XPATH
,
'//*[@id="0b83dfe6-67bc-46bf-b271-5e768a59e415"]/div/div[2]/span'
)
# 商品明细表
_detail_table
=
(
By
.
XPATH
,
'//*[@id="a55ef0dd-0262-4caa-b701-684a33007ac5"]/div/div[2]/div/div/div[2]/div[2]/div[1]/div[2]/table'
)
# _detail_table = (
# By.XPATH, '//*[@id="a55ef0dd-0262-4caa-b701-684a33007ac5"]/*/table[@class="vxe-table--body"]')
'''获取采购管理元素'''
def
get_purchase_management
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_purchase_management_locator
)
'''获取采购元素'''
def
get_purchase
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_purchase_locator
)
'''获取采退元素'''
def
get_return
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_return_locator
)
'''获取采购订单op元素'''
def
get_purchase_op
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_purchase_op_locator
)
'''获取采购iframe元素'''
def
get_iframe_purchase
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_iframe_purchase_locator
)
'''获取新建按钮元素'''
def
get_new
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_new_locator
)
'''获取对话框iframe元素'''
def
get_sub_iframe_dialog
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_sub_iframe_dialog_locator
)
'''获取查询公司请求按钮'''
def
get_company_request
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_company_request_locator
)
'''获取公司输入信息元素'''
def
get_company_input
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_company_input_locator
)
'''获取公司搜索按钮元素'''
def
get_company_search
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_company_search_locator
)
'''获取公司表元素'''
def
get_company_table
(
self
):
# return self.get_element_wait_presence(self._company_table_locator)
# 首先获取公司dialog
company_dialog
=
self
.
get_company_dialog
()
'''再从公司dialog中获取公司表'''
return
self
.
get_table_from_dialog
(
company_dialog
)
'''获取公司表确定按钮'''
def
get_company_table_ensure
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_company_table_ensure_locator
)
'''获取仓库信息'''
def
get_ware_info
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_ware_info_locator
)
'''获取主体信息'''
def
get_main_info
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_main_info_locator
)
'''获取请求查询仓库元素'''
def
get_ware_request
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_ware_request_locator
)
'''获取仓库输入元素'''
def
get_ware_input
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_ware_input_locator
)
'''获取仓库搜索元素'''
def
get_ware_search
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_ware_search_locator
)
'''获取仓库dialog'''
def
get_ware_dialog
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_ware_dialog_locator
)
'''获取仓库表元素'''
def
get_ware_table
(
self
):
ware_dialog
=
self
.
get_ware_dialog
()
return
self
.
get_table_from_dialog
(
ware_dialog
)
'''获取仓库表确定按钮'''
def
get_ware_table_ensure
(
self
):
ware_dialog
=
self
.
get_ware_dialog
()
return
ware_dialog
.
find_element
(
By
.
XPATH
,
'//span[@class="ensureBtn"]/button/span[text() = "确定"]'
)
# return self.get_child(ware_dialog, self._ware_table_ensure_locator)
'''获取供应商dialog元素'''
def
get_supplier_dialog
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_supplier_dialog_locator
)
'''从dialog中获取输入元素'''
def
get_input_from_dialog
(
self
,
dialog_element
):
result
=
dialog_element
.
find_element
(
By
.
XPATH
,
self
.
_dialog_input_locator
)
self
.
wait_seconds
(
self
.
time_seconds
)
return
result
'''从dialog中获取搜索元素'''
def
get_search_from_dialog
(
self
,
dialog_element
):
search
=
dialog_element
.
find_element
(
By
.
XPATH
,
self
.
_dialog_search_locator
)
self
.
wait_seconds
(
self
.
time_seconds
)
return
search
'''从dialog中获取表信息'''
def
get_table_from_dialog
(
self
,
dialog_element
):
tables
=
dialog_element
.
find_elements
(
By
.
TAG_NAME
,
"table"
)
self
.
wait_seconds
(
self
.
time_seconds
)
return
tables
[
1
]
'''从dialog中获取确定按钮'''
def
get_ensure_from_dialog
(
self
,
dialog_element
):
ensure
=
dialog_element
.
find_element
(
By
.
XPATH
,
self
.
_dialog_ensure_locator
)
return
ensure
"""从表格中的一个栏位中获取输入元素"""
def
get_input_from_table_field
(
self
,
field
):
element
=
field
.
find_element
(
By
.
XPATH
,
self
.
_input_in_table_locator
)
return
element
'''获取供应商请求元素'''
def
get_supplier_request
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_supplier_request_locator
)
'''获取供应商输入元素'''
def
get_supplier_input
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_supplier_input_locator
)
'''获取供应商搜索元素'''
def
get_supplier_search
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_supplier_search_locator
)
'''获取供应商表元素'''
def
get_supplier_table
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_supplier_table_locator
)
'''获取供应商表确定元素'''
def
get_supplier_table_ensure
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_supplier_table_ensure_locator
)
'''获取公司dialog'''
def
get_company_dialog
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_company_dialog_locator
)
'''获取协议请求元素'''
def
get_protocol_request
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_protocol_request_locator
)
'''获取协议输入元素'''
def
get_protocol_input
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_protocol_input_locator
)
'''获取协议搜索元素'''
def
get_protocol_search
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_protocol_search_locator
)
'''获取协议dialog'''
def
get_protocol_dialog
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_protocol_dialog_locator
)
'''获取业务员请求元素'''
def
get_businessman_request
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_businessman_request_locator
)
'''获取业务员输入元素'''
def
get_businessman_input
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_businessman_input_locator
)
'''获取业务员搜索元素'''
def
get_businessman_search
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_businessman_search_locator
)
'''获取业务员dialog'''
def
get_businessman_dialog
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_businessman_dialog_locator
)
'''商品录入按钮'''
def
get_merchandise
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_merchandise_locator
)
'''商品dialog按钮'''
def
get_merchandise_dialog
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_merchandise_dialog_locator
)
'''商品输入元素'''
def
get_merchandise_input
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_merchandise_input_locator
)
'''商品搜索元素'''
def
get_merchandise_search
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_merchandise_search_locator
)
'''保存按钮元素'''
def
get_save
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_save_locator
)
'''订单号'''
def
get_order_no
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_order_no_locator
)
'''商品明细表'''
def
get_detail_table
(
self
):
return
self
.
get_element_wait_presence
(
self
.
_detail_table
)
guke/test_purchase_management/test_new_purchase_op.py
0 → 100644
View file @
0a2fc41a
This diff is collapsed.
Click to expand it.
guke/test_purchase_management/test_new_yaohuodan.py
0 → 100644
View file @
0a2fc41a
This diff is collapsed.
Click to expand it.
guke/test_purchase_management/test_new_yaohuodan_enter_ware_wms.py
0 → 100644
View file @
0a2fc41a
This diff is collapsed.
Click to expand it.
guke/test_purchase_management/test_new_yaohuodan_exit_ware_wms.py
0 → 100644
View file @
0a2fc41a
This diff is collapsed.
Click to expand it.
guke/test_purchase_management/test_purchase_create.py
0 → 100644
View file @
0a2fc41a
This diff is collapsed.
Click to expand it.
guke/test_purchase_management/test_purchase_return.py
0 → 100644
View file @
0a2fc41a
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment