Skip to content
GitLab
Explore
Projects
Groups
Snippets
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
f557de3c
Commit
f557de3c
authored
1 year ago
by
章 登恒
Browse files
Options
Download
Email Patches
Plain Diff
commit
parent
0d59e4b6
main
master
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
testcase/test_scene1/scene1_mainflow.py
+23
-33
testcase/test_scene1/scene1_mainflow.py
with
23 additions
and
33 deletions
+23
-33
testcase/test_scene1/scene1_mainflow.py
+
23
-
33
View file @
f557de3c
...
...
@@ -151,7 +151,7 @@ class PurchaseOrder():
sleep
(
1
)
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_171" and @f="F_PURUNIT_TXT" and @i=%s])'
%
i
).
click
()
sleep
(
1
)
def
returnpchno
(
self
):
def
return
_
pchno
(
self
):
return
orderno1
def
closetab
(
self
):
chrome
.
switch_to
.
default_content
()
...
...
@@ -177,8 +177,8 @@ class PurchaseOrder():
wait
.
until_not
(
ec
.
presence_of_element_located
(
locator
))
print
(
'订单提交成功'
)
self
.
closetab
()
def
commitorder
(
self
,
type
=
2
):
#1为保存,否则为提交
def
query_commit
(
self
):
order_link
=
chrome
.
find_element_by_xpath
(
'//span[text()="普通采购订单"]'
)
chrome
.
execute_script
(
"arguments[0].click();"
,
order_link
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'(//iframe[@class="metro-main-frame"])[2]'
))
...
...
@@ -191,19 +191,22 @@ class PurchaseOrder():
# locator = (By.CLASS_NAME, 'el-loading-spinner')
# wait.until_not(ec.presence_of_element_located(locator))
# sleep(1)
#
点击采购单
#点击采购单
# chrome.find_element_by_xpath(
# '//span[text()="%s"]//parent::div/parent::td//preceding-sibling::td[1]/div/span' % orderno1).click()
chrome
.
find_element_by_xpath
(
'//td[@class="vxe-body--column col_19 col--last col--ellipsis dw-click-cell"]/div/span'
).
click
()
chrome
.
find_element_by_xpath
(
'//td[@class="vxe-body--column col_19 col--last col--ellipsis dw-click-cell"]/div/span'
).
click
()
sleep
(
1
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'//iframe[contains(@name,"awsui-dialog-iframe")]'
))
sleep
(
0.5
)
def
commit_order
(
self
,
type
=
2
):
#1为保存,否则为提交
self
.
query_commit
()
locator
=
(
By
.
XPATH
,
'//span[text()="提交"]'
)
wait
.
until
(
ec
.
presence_of_element_located
(
locator
))
sleep
(
2
)
# 审批/驳回订单
self
.
button_click1
(
type
)
def
switchloggin
(
self
,
usr
,
pwd
):
def
switch
_
loggin
(
self
,
usr
,
pwd
):
chrome
.
switch_to
.
default_content
()
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//span[text()="退出"]'
).
click
()
...
...
@@ -218,30 +221,8 @@ class PurchaseOrder():
locator
=
(
By
.
XPATH
,
'//span[text()="退出"]'
)
wait
.
until
(
ec
.
presence_of_element_located
(
locator
))
def
approveorder
(
self
,
type
=
1
):
#type=1为审核通过,否则为审核驳回
order_link
=
chrome
.
find_element_by_xpath
(
'//span[text()="普通采购订单"]'
)
chrome
.
execute_script
(
"arguments[0].click();"
,
order_link
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'(//iframe[@class="metro-main-frame"])[2]'
))
sleep
(
2
)
# 输入采购单号并查询
chrome
.
find_element_by_xpath
(
'//label[text()="订单号"]/parent::div/div/div/div/input'
).
send_keys
(
orderno1
)
sleep
(
1
)
chrome
.
find_element_by_xpath
(
'//label[text()="订单号"]/parent::div/div/div/div/input'
).
send_keys
(
Keys
.
ENTER
)
sleep
(
3
)
# locator = (By.CLASS_NAME, 'el-loading-spinner')
# wait.until_not(ec.presence_of_element_located(locator))
# sleep(1)
#点击采购单
# chrome.find_element_by_xpath(
# '//span[text()="%s"]//parent::div/parent::td//preceding-sibling::td[1]/div/span' % orderno1).click()
chrome
.
find_element_by_xpath
(
'//td[@class="vxe-body--column col_19 col--last col--ellipsis dw-click-cell"]/div/span'
).
click
()
sleep
(
1
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'//iframe[contains(@name,"awsui-dialog-iframe")]'
))
locator
=
(
By
.
XPATH
,
'//span[text()="审核通过"]'
)
wait
.
until
(
ec
.
presence_of_element_located
(
locator
))
sleep
(
2
)
#审批/驳回订单
def
button_click2
(
self
,
type
):
#1为审批/其余为驳回订单
if
type
==
1
:
chrome
.
find_element_by_xpath
(
'//span[text()="审核通过"]'
).
click
()
locator
=
(
By
.
XPATH
,
'//textarea[@placeholder="意见留言"]'
)
...
...
@@ -266,6 +247,15 @@ class PurchaseOrder():
print
(
'订单驳回成功'
)
self
.
closetab
()
def
approve_order
(
self
,
type
=
1
):
#type=1为审核通过,否则为审核驳回
self
.
query_commit
()
locator
=
(
By
.
XPATH
,
'//span[text()="审核通过"]'
)
wait
.
until
(
ec
.
presence_of_element_located
(
locator
))
sleep
(
2
)
self
.
button_click2
(
type
)
...
...
@@ -278,5 +268,5 @@ if __name__ == '__main__':
step2
.
data_add
()
#填写表单数据
step2
.
button_click1
(
1
)
#1为保存,否则为提交
# step2.commitorder(1)#1为保存,否则为提交
step2
.
switchloggin
(
usr1
,
pwd1
)
#切换登录
step2
.
approveorder
()
#1为审核通过,否则为审核驳回
\ No newline at end of file
step2
.
switch_loggin
(
usr1
,
pwd1
)
#切换登录
step2
.
approve_order
()
#1为审核通过,否则为审核驳回
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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
Menu
Explore
Projects
Groups
Snippets