Commit d97f8f5a authored by 章 登恒's avatar 章 登恒
Browse files

commit

parent 7f76b992
import pytest
def run():
pytest.main(['-vs'])
if __name__ == '__main__':
run()
\ No newline at end of file
...@@ -26,7 +26,7 @@ from public.tools import * ...@@ -26,7 +26,7 @@ from public.tools import *
opt = ChromeOptions() # 创建 Chrome 参数对象 opt = ChromeOptions() # 创建 Chrome 参数对象
# opt.headless = False # 把 Chrome 设置成无界面模式,windows/Linux 皆可 # opt.headless = False # 把 Chrome 设置成无界面模式,windows/Linux 皆可
opt.add_argument('--headless')# 把 Chrome 设置成无界面模式 # opt.add_argument('--headless')# 把 Chrome 设置成无界面模式
opt.add_argument('--start-maximized') opt.add_argument('--start-maximized')
opt.add_argument('--window-size=1280x1024') opt.add_argument('--window-size=1280x1024')
chrome = webdriver.Chrome(options=opt) chrome = webdriver.Chrome(options=opt)
...@@ -48,7 +48,7 @@ salesman = '杨春刚'#业务员名称 ...@@ -48,7 +48,7 @@ salesman = '杨春刚'#业务员名称
productcode = 10156326#商品编码 productcode = 10156326#商品编码
productdate = '2023-10-01'#生产日期 productdate = '2023-10-01'#生产日期
expirdate = '2026-09-30'#失效日期 expirdate = '2026-09-30'#失效日期
errmsg = '流程一:采购_采退流程异常,请检查!'#流程异常提示信息 errmsg1 = '流程一:采购_采退流程异常,请检查!'#流程异常提示信息
class LoginSys():###登录 class LoginSys():###登录
...@@ -420,6 +420,8 @@ class PurchaseReject(PurchaseOrder): ...@@ -420,6 +420,8 @@ class PurchaseReject(PurchaseOrder):
chrome.switch_to.frame(chrome.find_element_by_xpath('(//iframe[@class="metro-main-frame"])[2]')) chrome.switch_to.frame(chrome.find_element_by_xpath('(//iframe[@class="metro-main-frame"])[2]'))
sleep(2) sleep(2)
#关联原单采退 #关联原单采退
wait.until(ec.visibility_of_element_located((By.XPATH,'//span[text()="关联原单"]')))
sleep(0.5)
chrome.find_element_by_xpath('//span[text()="关联原单"]').click() chrome.find_element_by_xpath('//span[text()="关联原单"]').click()
sleep(3) sleep(3)
chrome.switch_to.frame(chrome.find_element_by_xpath('//iframe[contains(@name,"awsui-dialog-iframe")]')) chrome.switch_to.frame(chrome.find_element_by_xpath('//iframe[contains(@name,"awsui-dialog-iframe")]'))
...@@ -584,7 +586,7 @@ if __name__ == '__main__': ...@@ -584,7 +586,7 @@ if __name__ == '__main__':
except Exception as e: except Exception as e:
step6 =ExceptionHandling() step6 =ExceptionHandling()
traceback.print_exc() traceback.print_exc()
step6.handle(errmsg,e) step6.handle(errmsg1,e)
finally: finally:
chrome.quit() chrome.quit()
from testcase.test_scene1.scene1_mainflow import *
def test_scene1_mainflow():
try:
print('流程一:采购_采退开始!!!')
step1 = LoginSys()
step2 = PurchaseOrder()
step3 = Instore()
step4 = PurchaseReject()
step5 = Outstore()
step1.loginsys(SIT_URL,usr2,pwd2)#登录系统
step2.data_add_purchase()#填写表单数据
step2.button_click1()#1为保存,否则为提交
step2.switch_loggin(usr1,pwd1)#切换登录
step2.approve_order()#1为审核通过,否则为审核驳回
purchord = step2.return_pchno()#获取采购订单号
step3.switch_loggin(usr4,pwd4)
step3.take_over_goods(purchord)#仓库收货:1为收货单据撤回,2为提交,其余为保存
step3.switch_loggin(usr5, pwd5)
step3.goods_check(purchord)#仓库验收:1为保存,否则为提交
step3.switch_loggin(usr4, pwd4)
step3.goods_grounding(purchord)#仓库上架:1为保存,否则为提交
step4.switch_loggin(usr2,pwd2)
step4.relate_order(purchord)#创建采退单1为保存,否则为提交
rejpurchord = step4.return_rejpchno()#获取采退单号
step4.switch_loggin(usr1,pwd1)
step4.approve_order(rejpurchord)#审核/驳回采退单:type=1为审核通过,否则为审核驳回
step4.switch_loggin(usr4,pwd4)
step5.deliver_goods(rejpurchord)#仓库发货
step5.picking_goods(rejpurchord)#仓库拣货
step5.switch_loggin(usr5,pwd5)
step5.outbound_review(rejpurchord)#出库复核
print('流程一:采购_采退结束!!!')
except Exception as e:
step6 =ExceptionHandling()
traceback.print_exc()
step6.handle(errmsg1,e)
...@@ -17,7 +17,7 @@ salcust = 1000486#销售客户名称 ...@@ -17,7 +17,7 @@ salcust = 1000486#销售客户名称
productcode = 10156326#商品编码 productcode = 10156326#商品编码
productdate = '2023-10-01'#生产日期 productdate = '2023-10-01'#生产日期
expirdate = '2026-09-30'#失效日期 expirdate = '2026-09-30'#失效日期
errmsg = '流程三:经销商向总代采购,货从供应商发(经销商快采快销场景)流程异常,请检查!'#流程异常提示信息 errmsg3 = '流程三:经销商向总代采购,货从供应商发(经销商快采快销场景)流程异常,请检查!'#流程异常提示信息
class QuickPurchase():#快速采购单界面操作 class QuickPurchase():#快速采购单界面操作
def data_add_quickpurchase(self):#填写表单数据 def data_add_quickpurchase(self):#填写表单数据
...@@ -223,10 +223,11 @@ if __name__ == '__main__': ...@@ -223,10 +223,11 @@ if __name__ == '__main__':
step2_2.query_click('快速采购订单',owtorder,'vxe-body--column col_19 col--ellipsis dw-click-cell') step2_2.query_click('快速采购订单',owtorder,'vxe-body--column col_19 col--ellipsis dw-click-cell')
step2_2.button_click2() step2_2.button_click2()
step3.push_wms(owtorder) step3.push_wms(owtorder)
print('流程三:经销商向总代采购,货从供应商发(经销商快采快销场景)平台端流程结束!!!')
except (Exception,AssertionError) as e: except (Exception,AssertionError) as e:
step6 =ExceptionHandling() step6 =ExceptionHandling()
traceback.print_exc() traceback.print_exc()
step6.handle(errmsg,e) step6.handle(errmsg3,e)
finally: finally:
chrome.quit() chrome.quit()
......
from testcase.test_scene3.scene3_mainflow import *
def test_scene3_mainflow():
try:
print('流程三:经销商向总代采购,货从供应商发(经销商快采快销场景)平台端流程开始!!!')
# step1 = LoginSys()
step2_1 = QuickPurchase()
step2_2 = PurchaseOrder()
step3 = SalesOrder()
# step1.loginsys(SIT_URL,usr2,pwd2)
step2_2.switch_loggin(usr2,pwd2)
step2_1.data_add_quickpurchase()
owtorder = step2_1.return_owtorder()
step2_2.button_click1()
print("快速采购单提交成功,订单号为:",owtorder)
step2_2.switch_loggin(usr1,pwd1)
step2_2.query_click('快速采购订单',owtorder,'vxe-body--column col_19 col--ellipsis dw-click-cell')
step2_2.button_click2()
step3.push_wms(owtorder)
print('流程三:经销商向总代采购,货从供应商发(经销商快采快销场景)平台端流程结束!!!')
except (Exception,AssertionError) as e:
step6 =ExceptionHandling()
traceback.print_exc()
step6.handle(errmsg3,e)
from testcase.test_scene1.scene1_mainflow import * from testcase.test_scene1.scene1_mainflow import *
from key_word.key_cncap import WebKeys
SIT_URL = 'http://scdev.cmic.com.cn:8088/beta/'#SIT环境地址 SIT_URL = 'http://scdev.cmic.com.cn:8088/beta/'#SIT环境地址
#通行证 #通行证
...@@ -20,7 +19,7 @@ STASHIP_TIME = '00:00:00'#启运时间 ...@@ -20,7 +19,7 @@ STASHIP_TIME = '00:00:00'#启运时间
ARRIVAL_TIME = '00:00:00'#启运时间 ARRIVAL_TIME = '00:00:00'#启运时间
TRANS_MACHINE = '冷冻车'#运输工具 TRANS_MACHINE = '冷冻车'#运输工具
errmsg = '流程四:调拨出库-入库-红冲流程异常,请检查!'#流程异常提示信息 errmsg4 = '流程四:调拨出库-入库-红冲流程异常,请检查!'#流程异常提示信息
class TransferOut(): class TransferOut():
def data_add_allocate(self): def data_add_allocate(self):
...@@ -316,10 +315,11 @@ if __name__ == '__main__': ...@@ -316,10 +315,11 @@ if __name__ == '__main__':
step5.goods_check(smtorder,type=3) # 仓库验收:1为保存,否则为提交 step5.goods_check(smtorder,type=3) # 仓库验收:1为保存,否则为提交
step5.switch_loggin(usr4, pwd4) step5.switch_loggin(usr4, pwd4)
step5.goods_grounding(smtorder) # 仓库上架:1为保存,否则为提交 step5.goods_grounding(smtorder) # 仓库上架:1为保存,否则为提交
print('流程四:调拨出库-入库-红冲流程结束!!!')
except (Exception,AssertionError) as e: except (Exception,AssertionError) as e:
step7 =ExceptionHandling() step7 =ExceptionHandling()
traceback.print_exc() traceback.print_exc()
step7.handle(errmsg,e) step7.handle(errmsg4,e)
finally: finally:
chrome.quit() chrome.quit()
......
from testcase.test_scene4.scene4_mainflow import *
def test_scene4_mainflow1():
try:
print('流程四:调拨出库-红冲流程开始!!!')
# step1 = LoginSys()
step2_1 = TransferOut()
step2_2 = PurchaseOrder()
step3 = Outstore()
step4 = TransferIn()
step5 = Instore1()
step6 = TransferOffSetting()
# step1.loginsys(SIT_URL,usr2,pwd2)
step2_2.switch_loggin(usr2,pwd2)
step2_1.data_add_allocate()#填写主表数据
sttorder = step2_1.return_sttorder()
step2_2.button_click1()#提交
step2_2.switch_loggin(usr1,pwd1)
step2_2.query_click('调拨出库单', sttorder, 'vxe-body--column col_19 col--left col--ellipsis dw-click-cell',qrcond='调拨出库单号')
step2_2.button_click2(msg1='发送成功')#审核
step3.switch_loggin(usr4, pwd4)
step3.deliver_goods(sttorder) # 仓库发货
step3.picking_goods(sttorder) # 仓库拣货
step3.switch_loggin(usr5, pwd5)
step3.outbound_review(sttorder,type=3) # 出库复核
step3.switch_loggin(usr1, pwd1)
step4.transfer_in(sttorder)#检查自动审配订单状态
ottorder = step4.return_ottorder()#获取调拨入库单号
# step5.switch_loggin(usr4, pwd4)
# step5.take_over_goods(ottorder) # 仓库收货:1为收货单据撤回,2为提交,其余为保存
# step5.switch_loggin(usr5, pwd5)
# step5.goods_check(ottorder,type=3) # 仓库验收:1为保存,否则为提交
# step5.switch_loggin(usr4, pwd4)
# step5.goods_grounding(ottorder) # 仓库上架:1为保存,否则为提交
step6.ottorder_cancel()#整单取消调拨入库单
step6.switch_loggin(usr2,pwd2)
step6.ottorder_offset(sttorder)#新建调拨出库红冲单
smtorder = step6.return_smtorder()
step5.switch_loggin(usr4, pwd4)
step5.take_over_goods(smtorder) # 仓库收货:1为收货单据撤回,2为提交,其余为保存
step5.switch_loggin(usr5, pwd5)
step5.goods_check(smtorder,type=3) # 仓库验收:1为保存,否则为提交
step5.switch_loggin(usr4, pwd4)
step5.goods_grounding(smtorder) # 仓库上架:1为保存,否则为提交
print('流程四:调拨出库-红冲流程结束!!!')
except (Exception,AssertionError) as e:
step7 =ExceptionHandling()
traceback.print_exc()
step7.handle(errmsg4,e)
from testcase.test_scene4.scene4_mainflow import *
def test_scene4_mainflow1():
try:
print('流程四:调拨出库-入库流程开始!!!')
# step1 = LoginSys()
step2_1 = TransferOut()
step2_2 = PurchaseOrder()
step3 = Outstore()
step4 = TransferIn()
step5 = Instore1()
step6 = TransferOffSetting()
# step1.loginsys(SIT_URL, usr2, pwd2)
step2_2.switch_loggin(usr2, pwd2)
step2_1.data_add_allocate() # 填写主表数据
sttorder = step2_1.return_sttorder()
step2_2.button_click1() # 提交
step2_2.switch_loggin(usr1, pwd1)
step2_2.query_click('调拨出库单', sttorder, 'vxe-body--column col_19 col--left col--ellipsis dw-click-cell',
qrcond='调拨出库单号')
step2_2.button_click2(msg1='发送成功') # 审核
step3.switch_loggin(usr4, pwd4)
step3.deliver_goods(sttorder) # 仓库发货
step3.picking_goods(sttorder) # 仓库拣货
step3.switch_loggin(usr5, pwd5)
step3.outbound_review(sttorder, type=3) # 出库复核
step3.switch_loggin(usr1, pwd1)
step4.transfer_in(sttorder) # 检查自动审配订单状态
ottorder = step4.return_ottorder() # 获取调拨入库单号
step5.switch_loggin(usr4, pwd4)
step5.take_over_goods(ottorder) # 仓库收货:1为收货单据撤回,2为提交,其余为保存
step5.switch_loggin(usr5, pwd5)
step5.goods_check(ottorder,type=3) # 仓库验收:1为保存,否则为提交
step5.switch_loggin(usr4, pwd4)
step5.goods_grounding(ottorder) # 仓库上架:1为保存,否则为提交
print('流程四:调拨出库-入库流程结束!!!')
except (Exception, AssertionError) as e:
step7 = ExceptionHandling()
traceback.print_exc()
step7.handle(errmsg4, e)
finally:
chrome.quit()
\ No newline at end of file
from testcase.test_scene1.scene1_mainflow import *
SIT_URL = 'http://scdev.cmic.com.cn:8088/beta/'#SIT环境地址
#通行证
usr1,pwd1 = 'bj_01','Gyxc1234'
usr2,pwd2 = 'bj_02','Gyxc1234'
usr3,pwd3 = 'bj_03','Gyxc1234'
usr4,pwd4 = 'bj_04','Gyxc1234'
usr5,pwd5 = 'bj_05','Gyxc1234'
outwarehouse= '103356'#调拨出库仓
inwarehouse= '103396'#调拨入库仓
salesman = '杨春刚'#业务员名称
productcode = 10005528#商品编码
STASHIP_TEMP = 24#启运温度
ARRIVAL_TEMP = 24#到货温度
STASHIP_DATE = '2023-10-01'#启运日期
STASHIP_TIME = '00:00:00'#启运时间
ARRIVAL_TIME = '00:00:00'#启运时间
TRANS_MACHINE = '冷冻车'#运输工具
errmsg6 = '流程六:手术跟台及消耗结算流程异常,请检查!'#流程异常提示信息
if __name__ == '__main__':
step1 = LoginSys()
step1.loginsys(SIT_URL, usr2, pwd2)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment