diff --git a/run_main.py b/run_main.py new file mode 100644 index 0000000000000000000000000000000000000000..598021051db492d4738a7baeaf0786e4efd41585 --- /dev/null +++ b/run_main.py @@ -0,0 +1,8 @@ +import pytest + +def run(): + pytest.main(['-vs']) + + +if __name__ == '__main__': + run() \ No newline at end of file diff --git a/testcase/test_scene1/scene1_mainflow.py b/testcase/test_scene1/scene1_mainflow.py index 63c618a7eca753f8a0de0295840ec1d7619a24e7..1df3e964315c05677875b8c24f76213f0f426494 100644 --- a/testcase/test_scene1/scene1_mainflow.py +++ b/testcase/test_scene1/scene1_mainflow.py @@ -26,7 +26,7 @@ from public.tools import * opt = ChromeOptions() # 创建 Chrome 参数对象 # opt.headless = False # 把 Chrome 设置成无界面模式,windows/Linux 皆可 -opt.add_argument('--headless')# 把 Chrome 设置成无界面模式 +# opt.add_argument('--headless')# 把 Chrome 设置成无界面模式 opt.add_argument('--start-maximized') opt.add_argument('--window-size=1280x1024') chrome = webdriver.Chrome(options=opt) @@ -48,7 +48,7 @@ salesman = '杨春刚'#业务员名称 productcode = 10156326#商品编码 productdate = '2023-10-01'#生产日期 expirdate = '2026-09-30'#失效日期 -errmsg = '流程一:采购_采退流程异常,请检查!'#流程异常提示信息 +errmsg1 = '流程一:采购_采退流程异常,请检查!'#流程异常提示信息 class LoginSys():###登录 @@ -420,6 +420,8 @@ class PurchaseReject(PurchaseOrder): chrome.switch_to.frame(chrome.find_element_by_xpath('(//iframe[@class="metro-main-frame"])[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() sleep(3) chrome.switch_to.frame(chrome.find_element_by_xpath('//iframe[contains(@name,"awsui-dialog-iframe")]')) @@ -584,7 +586,7 @@ if __name__ == '__main__': except Exception as e: step6 =ExceptionHandling() traceback.print_exc() - step6.handle(errmsg,e) + step6.handle(errmsg1,e) finally: chrome.quit() diff --git a/testcase/test_scene1/test_scene1_mainflow.py b/testcase/test_scene1/test_scene1_mainflow.py new file mode 100644 index 0000000000000000000000000000000000000000..0913bb90fc394d7f32b32c6a1317d538d60e5713 --- /dev/null +++ b/testcase/test_scene1/test_scene1_mainflow.py @@ -0,0 +1,37 @@ +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) diff --git a/testcase/test_scene3/scene3_mainflow.py b/testcase/test_scene3/scene3_mainflow.py index 193b74ced18cbb966806660343602c393b1ccc22..a4a04453ecc73c94719daf1ac62983e3ac20a838 100644 --- a/testcase/test_scene3/scene3_mainflow.py +++ b/testcase/test_scene3/scene3_mainflow.py @@ -17,7 +17,7 @@ salcust = 1000486#销售客户名称 productcode = 10156326#商品编码 productdate = '2023-10-01'#生产日期 expirdate = '2026-09-30'#失效日期 -errmsg = '流程三:经销商向总代采购,货从供应商发(经销商快采快销场景)流程异常,请检查!'#流程异常提示信息 +errmsg3 = '流程三:经销商向总代采购,货从供应商发(经销商快采快销场景)流程异常,请检查!'#流程异常提示信息 class QuickPurchase():#快速采购单界面操作 def data_add_quickpurchase(self):#填写表单数据 @@ -223,10 +223,11 @@ if __name__ == '__main__': 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(errmsg,e) + step6.handle(errmsg3,e) finally: chrome.quit() diff --git a/testcase/test_scene3/test_scene3_mainflow.py b/testcase/test_scene3/test_scene3_mainflow.py new file mode 100644 index 0000000000000000000000000000000000000000..afdd950d80df485b61b1b5792b66b4399aa54c7a --- /dev/null +++ b/testcase/test_scene3/test_scene3_mainflow.py @@ -0,0 +1,24 @@ +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) diff --git a/testcase/test_scene4/scene4_mainflow.py b/testcase/test_scene4/scene4_mainflow.py index 987745888fbf744d712e0b204b3cb2f7d76eec14..3d8ef29cca8fef8ac048ea2252894b009ab3a233 100644 --- a/testcase/test_scene4/scene4_mainflow.py +++ b/testcase/test_scene4/scene4_mainflow.py @@ -1,5 +1,4 @@ from testcase.test_scene1.scene1_mainflow import * -from key_word.key_cncap import WebKeys SIT_URL = 'http://scdev.cmic.com.cn:8088/beta/'#SIT环境地址 #通行证 @@ -20,7 +19,7 @@ STASHIP_TIME = '00:00:00'#启运时间 ARRIVAL_TIME = '00:00:00'#启运时间 TRANS_MACHINE = '冷冻车'#运输工具 -errmsg = '流程四:调拨出库-入库-红冲流程异常,请检查!'#流程异常提示信息 +errmsg4 = '流程四:调拨出库-入库-红冲流程异常,请检查!'#流程异常提示信息 class TransferOut(): def data_add_allocate(self): @@ -316,10 +315,11 @@ if __name__ == '__main__': 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(errmsg,e) + step7.handle(errmsg4,e) finally: chrome.quit() diff --git a/testcase/test_scene4/test_scene4_mainflow1.py b/testcase/test_scene4/test_scene4_mainflow1.py new file mode 100644 index 0000000000000000000000000000000000000000..2dc0a4ad2695573c16baecbde904fb07932f1c60 --- /dev/null +++ b/testcase/test_scene4/test_scene4_mainflow1.py @@ -0,0 +1,50 @@ +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) diff --git a/testcase/test_scene4/test_scene4_mainflow2.py b/testcase/test_scene4/test_scene4_mainflow2.py new file mode 100644 index 0000000000000000000000000000000000000000..659359a3dabd366dcf3beccbee53b6d2a42e73a6 --- /dev/null +++ b/testcase/test_scene4/test_scene4_mainflow2.py @@ -0,0 +1,43 @@ +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 diff --git a/testcase/test_scene6/__init__.py b/testcase/test_scene6/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/testcase/test_scene6/scene6_mainflow.py b/testcase/test_scene6/scene6_mainflow.py new file mode 100644 index 0000000000000000000000000000000000000000..91780eeab512c68f5496b0d2368d3028a08de054 --- /dev/null +++ b/testcase/test_scene6/scene6_mainflow.py @@ -0,0 +1,27 @@ +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