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

commit

parent 2bc3a596
......@@ -24,14 +24,16 @@ from selenium.webdriver.support.wait import WebDriverWait
from public.mail1 import send_email1
from public.tools import *
opt = ChromeOptions() # 创建 Chrome 参数对象
# opt.headless = False # 把 Chrome 设置成无界面模式,windows/Linux 皆可
# opt.add_argument('--headless')# 把 Chrome 设置成无界面模式
opt.add_argument('--start-maximized')
opt.add_argument('--window-size=1280x1024')
chrome = webdriver.Chrome(options=opt)
# chrome =webdriver.Chrome()
# chrome.maximize_window()
# opt = ChromeOptions() # 创建 Chrome 参数对象
# opt.add_argument('--start-maximized')
# opt.add_argument('--window-size=1280x1024')
# chrome = webdriver.Chrome(options=opt)
chrome =webdriver.Chrome()
chrome.maximize_window()
wait = WebDriverWait(chrome,20,poll_frequency=0.2)
......@@ -216,6 +218,7 @@ class PurchaseOrder():###普通采购单界面操作
def query_click(self,menu_name,orderno,el,qrcond='订单号'):#查询出订单并点击
#打开菜单
sleep(1)
order_link = chrome.find_element_by_xpath('//span[text()="%s"]'%menu_name)
chrome.execute_script("arguments[0].click();", order_link)
sleep(5)
......@@ -236,7 +239,7 @@ class PurchaseOrder():###普通采购单界面操作
# '//span[text()="%s"]//parent::div/parent::td//preceding-sibling::td[1]/div/span' % orderno1).click()
#点击订单,进入表单视图
wait.until(ec.visibility_of_element_located((By.XPATH,'//td[@class="%s"]'%el)))
sleep(0.5)
sleep(2)
chrome.find_element_by_xpath('//td[@class="%s"]'%el).click()
sleep(1)
chrome.switch_to.frame(chrome.find_element_by_xpath('//iframe[contains(@name,"awsui-dialog-iframe")]'))
......
......@@ -35,3 +35,5 @@ def test_scene1_mainflow():
step6 =ExceptionHandling()
traceback.print_exc()
step6.handle(errmsg1,e)
......@@ -2,6 +2,7 @@
from testcase.test_scene1.scene1_mainflow import *
from selenium.webdriver.common.action_chains import ActionChains
SIT_URL = 'http://scdev.cmic.com.cn:8088/beta/'#SIT环境地址
#通行证
usr1,pwd1 = 'bj_01','Gyxc1234'
......@@ -196,8 +197,8 @@ class SalesOrder():
chrome.find_element_by_xpath('//label[text()="关联来源单号"]/parent::div/div/div/div/input').send_keys(orderno)
sleep(0.5)
chrome.find_element_by_xpath('//label[text()="关联来源单号"]/parent::div/div/div/div/input').send_keys(Keys.ENTER)
wait.until(ec.visibility_of_element_located((By.XPATH,'//td[@class="vxe-body--column col_104 col--ellipsis dw-click-cell"]')))
sleep(0.5)
sleep(2)
wait.until(ec.visibility_of_element_located((By.XPATH,'//td[@class="vxe-body--column col_104 col--ellipsis dw-click-cell"]/div/div')))
salesorder = chrome.find_element_by_xpath('//td[@class="vxe-body--column col_104 col--ellipsis dw-click-cell"]/div/div').text
print('生成的销售订单号为:',salesorder)
......
......@@ -22,3 +22,5 @@ def test_scene3_mainflow():
step6 =ExceptionHandling()
traceback.print_exc()
step6.handle(errmsg3,e)
from testcase.test_scene1.scene1_mainflow import *
SIT_URL = 'http://scdev.cmic.com.cn:8088/beta/'#SIT环境地址
#通行证
usr1,pwd1 = 'bj_01','Gyxc1234'
......
......@@ -42,3 +42,4 @@ def test_scene4_mainflow1():
step7 =ExceptionHandling()
traceback.print_exc()
step7.handle(errmsg4,e)
......@@ -40,4 +40,5 @@ def test_scene4_mainflow1():
traceback.print_exc()
step7.handle(errmsg4, e)
finally:
chrome.quit()
\ No newline at end of file
chrome.quit()
......@@ -13,12 +13,12 @@ salesman = '杨春刚'#业务员名称
custname = '北京大学第三医院'#客户名称
productcode = 10005528#商品编码
STASHIP_TEMP = 24#启运温度
ARRIVAL_TEMP = 24#到货温度
STASHIP_DATE = '2023-10-01'#启运日期
ARRIVAL_TEMP = 24 #到货温度
ARRIVAL_DATE = '2023-10-01'#到货日期
ARRIVAL_TIME = '00:00:00'#到货时间
STASHIP_TEMP = 24 #启运温度
STASHIP_DATE = '2023-11-01' #启运日期
STASHIP_TIME = '00:00:00'#启运时间
ARRIVAL_TIME = '00:00:00'#启运时间
TRANS_MACHINE = '冷冻车'#运输工具
errmsg6 = '流程六:手术跟台及消耗结算流程异常,请检查!'#流程异常提示信息
......@@ -85,11 +85,11 @@ class SurgicalOrder():
chrome.find_element_by_xpath('//div[text()="客户信息"]').click()
chrome.find_element_by_xpath('//div[text()="客户名称 "]/following-sibling::div/div/div/div/div/div/div/div/span/span/i').click()
wait.until(ec.visibility_of_element_located((By.XPATH,'//input[@placeholder="模糊检索:客户编码,客户名称"]')))
sleep(0.5)
sleep(1)
chrome.find_element_by_xpath('//input[@placeholder="模糊检索:客户编码,客户名称"]').send_keys(custname)
sleep(0.5)
sleep(1)
chrome.find_element_by_xpath('//input[@placeholder="模糊检索:客户编码,客户名称"]').send_keys(Keys.ENTER)
sleep(0.5)
sleep(1)
btn_div= chrome.find_element_by_xpath('//span/input[@type="radio" and @value="04bb72d56ca59576d0c205f2509d66836"]')
chrome.execute_script("arguments[0].click();", btn_div)
chrome.find_element_by_xpath('(//button[@class="el-button el-button--primary el-button--default"])[2]').click()
......@@ -99,11 +99,11 @@ class SurgicalOrder():
chrome.find_element_by_xpath(
'//div[text()="配销客户名称 "]/following-sibling::div/div/div/div/div/div/div/div/span/span/i').click()
wait.until(ec.visibility_of_element_located((By.XPATH, '//input[@placeholder="模糊检索:客户编码,客商名称"]')))
sleep(0.5)
sleep(1)
chrome.find_element_by_xpath('//input[@placeholder="模糊检索:客户编码,客商名称"]').send_keys(custname)
sleep(0.5)
sleep(1)
chrome.find_element_by_xpath('//input[@placeholder="模糊检索:客户编码,客商名称"]').send_keys(Keys.ENTER)
sleep(0.5)
sleep(1)
btn_div = chrome.find_element_by_xpath(
'//span/input[@type="radio" and @value="0c4d395678c596b20aa6c2a2fef3483d4"]')
chrome.execute_script("arguments[0].click();", btn_div)
......@@ -121,7 +121,7 @@ class SurgicalOrder():
chrome.find_element_by_xpath('//input[@placeholder="模糊检索:仓库编码,仓库名称"]').send_keys(lendin)
sleep(0.5)
chrome.find_element_by_xpath('//input[@placeholder="模糊检索:仓库编码,仓库名称"]').send_keys(Keys.ENTER)
sleep(0.5)
sleep(1)
btn_div = chrome.find_element_by_xpath(
'//span/input[@type="radio" and @value="0eb35527d7e9703e44ad78fe510d37655"]')
chrome.execute_script("arguments[0].click();", btn_div)
......@@ -168,7 +168,7 @@ class SurgicalOrder():
sleep(0.5)
element = chrome.find_element_by_xpath('(//td[@colid="col_79" and @f="F_SALES_VOLUMES" and @i=%s])' % i)
chrome.execute_script("arguments[0].click();", element)
sleep(0.5)
sleep(1)
chrome.find_element_by_class_name('awsui-input-number-right').send_keys('1')
sleep(1)
# 点击其它地方让数量框失焦,让数量真正填入数量框(平台设计如此,不用纠结为啥要此步)
......@@ -178,13 +178,183 @@ class SurgicalOrder():
def return_qltorder(self): # 返回采购单号
return orderno1
class SurgicalDispensing(PurchaseOrder):#配货单
def dispensing(self,orderno):
#打开菜单并进入表单视图
PurchaseOrder.query_click(self,menu_name='手术配货单',orderno=orderno,el='vxe-body--column col_19 col--center col--ellipsis dw-click-cell',qrcond='请领单号')
#自动配货
wait.until(ec.visibility_of_element_located((By.XPATH,'//button[text()="自动配货"]')))
sleep(0.5)
chrome.find_element_by_xpath('//button[text()="自动配货"]').click()
wait.until(ec.presence_of_element_located((By.XPATH,'//span[text()="分配批次"]')))
sleep(1)
#分配批次
chrome.find_element_by_xpath('//span[text()="分配批次"]').click()
wait.until(ec.visibility_of_element_located((By.XPATH,'//p[text()="分配完成"]')))
sleep(1)
#提交
chrome.find_element_by_xpath('//span[text()="提交"]').click()
sleep(2)
chrome.find_element_by_xpath('(//span[text()="确定"])[2]').click()
wait.until(ec.visibility_of_element_located((By.XPATH,'//p[text()="流程结束"]')))
PurchaseOrder.closetab(self)
print('手术请领单配货完成')
class SurgicalLending(PurchaseOrder):#手术借出单
def lending(self,orderno):
# 打开菜单并进入表单视图
PurchaseOrder.query_click(self, menu_name='手术借出单', orderno=orderno,
el='vxe-body--column col_19 col--center col--ellipsis dw-click-cell',
qrcond='请领单号')
###获取订单号###
global orderno2
wait.until(
ec.presence_of_element_located((By.XPATH, '//div[text() = "借出单号 "]/following-sibling::div/span')))
sleep(0.5)
orderno2 = chrome.find_element_by_xpath('//div[text() = "借出单号 "]/following-sibling::div/span').text
print('手术借出单号为:', orderno2)
# 提交订单
wait.until(ec.visibility_of_element_located((By.XPATH,'//span[text()="提交"]')))
sleep(0.5)
chrome.find_element_by_xpath('//span[text()="提交"]').click()
sleep(2)
#确定提交
chrome.find_element_by_xpath('(//span[text()="确定"])[4]').click()
sleep(2)
chrome.find_element_by_xpath('(//span[text()="确定"])[4]').click()
wait.until(ec.presence_of_element_located((By.XPATH, '//p[text()="办理成功"]')))
PurchaseOrder.closetab(self)
print('手术借出单提交成功')
def return_jctorder(self):
return orderno2
def button_click2(self,type=1,msg1='流程结束'):#审批/驳回订单:type=1为审批/其余为驳回订单
wait.until(ec.visibility_of_element_located((By.XPATH, '//span[text()="审核通过"]')))
sleep(1)
if type == 1:#审核流程
#点击审核通过
chrome.find_element_by_xpath('//span[text()="审核通过"]').click()
#点击确定按钮
wait.until(ec.presence_of_element_located((By.XPATH,'//span[text()="确定"]')))
sleep(0.5)
chrome.find_element_by_xpath('//span[text()="确定"]').click()
locator = (By.XPATH, '//textarea[@placeholder="意见留言"]')
wait.until(ec.presence_of_element_located(locator))
sleep(0.5)
#填写审核通过信息
chrome.find_element_by_xpath('//textarea[@placeholder="意见留言"]').send_keys('审核通过')
sleep(0.5)
#点击发送按钮
chrome.find_element_by_xpath('//span[text()="发送"]').click()
#判断审核成功
locator = (By.XPATH, '//p[text()="%s"]'%msg1)
wait.until(ec.presence_of_element_located(locator))
print('订单审核成功')
else:#驳回流程
#点击驳回
chrome.find_element_by_xpath('//span[text()="审核驳回"]').click()
locator = (By.XPATH, '//textarea[@placeholder="意见留言"]')
wait.until(ec.presence_of_element_located(locator))
sleep(0.5)
#填写驳回信息
chrome.find_element_by_xpath('//textarea[@placeholder="意见留言"]').send_keys('审核驳回')
sleep(0.5)
#点击发送
chrome.find_element_by_xpath('//span[text()="发送"]').click()
#判断驳回成功
locator = (By.XPATH, '//p[text()="发送成功"]')
wait.until(ec.presence_of_element_located(locator))
print('订单驳回成功')
self.closetab()
class Outstore1(PurchaseOrder): # 出库三步曲
def outbound_review1(self,orderno,type=2):#出库复核
# 调用query_click进入表单视图
PurchaseOrder.query_click(self,'出库复核',orderno,'vxe-body--column col_19 col--left col--ellipsis dw-click-cell')
sleep(2)
wait.until(ec.visibility_of_element_located((By.XPATH, '(//td[@colid="col_105" and @f="F_8VDB5FTL" and @i=0])')))
sleep(0.5)
#填写商品信息
for i in range(1):
chrome.execute_script(
"document.getElementsByClassName('vxe-table--footer-wrapper body--wrapper')[0].scrollLeft = 1000")
sleep(1)
wait.until(ec.visibility_of_element_located((By.XPATH,'(//td[@colid="col_117" and @f="F_RECHECK_NUM" and @i=%s])'%i)))
chrome.find_element_by_xpath('(//td[@colid="col_117" and @f="F_RECHECK_NUM" and @i=%s])'%i).click()
sleep(0.5)
chrome.find_element_by_class_name('awsui-input-number-right').send_keys('1')
sleep(1)
chrome.find_element_by_xpath('(//td[@colid="col_119" and @f="F_DIF_NUM" and @i=%s])'%i).click()
sleep(1)
chrome.execute_script(
"document.getElementsByClassName('vxe-table--body-wrapper body--wrapper')[0].scrollLeft = 3400")
sleep(1)
# 填写到货温度
chrome.find_element_by_xpath('(//td[@colid="col_135" and @f="F_ARRIVAL_TEMP" and @i=%s])' % i).click()
sleep(0.5)
chrome.find_element_by_class_name('awsui-input-number-right').send_keys(ARRIVAL_TEMP)
sleep(0.5)
# 填写到货日期
chrome.find_element_by_xpath('(//td[@colid="col_136" and @f="F_ARRIVAL_DATE" and @i=%s])' % i).click()
sleep(0.5)
chrome.find_element_by_class_name('el-input__inner').send_keys(ARRIVAL_DATE)
sleep(0.5)
# 填写到货时间
chrome.find_element_by_xpath('(//td[@colid="col_137" and @f="F_ARRIVAL_TIME" and @i=%s])' % i).click()
sleep(0.5)
chrome.find_element_by_class_name('el-input__inner').send_keys(ARRIVAL_TIME)
sleep(0.5)
# 填写启运温度
chrome.find_element_by_xpath('(//td[@colid="col_138" and @f="F_STASHIP_TEMP" and @i=%s])' % i).click()
sleep(0.5)
chrome.find_element_by_class_name('awsui-input-number-right').send_keys(STASHIP_TEMP)
sleep(0.5)
# 填写启运日期
chrome.find_element_by_xpath('(//td[@colid="col_139" and @f="F_STASHIP_DATE" and @i=%s])' % i).click()
sleep(0.5)
chrome.find_element_by_class_name('el-input__inner').send_keys(STASHIP_DATE)
sleep(0.5)
# 填写启运时间
chrome.find_element_by_xpath('(//td[@colid="col_140" and @f="F_STASHIP_TIME" and @i=%s])' % i).click()
sleep(0.5)
chrome.find_element_by_class_name('el-input__inner').send_keys(STASHIP_TIME)
sleep(0.5)
# 调用button_click1保存/提交
PurchaseOrder.button_click1(self,type,el2='//p[text()="流程结束"]')
print('出库复核成功')
if __name__ == '__main__':
step1 = LoginSys()
step2_1 = SurgicalOrder()
step2_2 = PurchaseOrder()
step3 = SurgicalDispensing()
step4 = SurgicalLending()
step5_1 = Outstore()
step5_2 = Outstore1()
step1.loginsys(SIT_URL, usr2, pwd2)
step2_1.data_add_surgical()
step2_2.button_click1()
qltorder = step2_1.return_qltorder()
\ No newline at end of file
qltorder = step2_1.return_qltorder()
step3.dispensing(qltorder)
step4.lending(qltorder)
step4.switch_loggin(usr1,pwd1)
step4.query_click(menu_name='手术借出单', orderno=qltorder,
el='vxe-body--column col_19 col--center col--ellipsis dw-click-cell',
qrcond='请领单号')
jctorder = step4.return_jctorder()
step4.button_click2()
step4.switch_loggin(usr4, pwd4)
step5_1.deliver_goods(jctorder) # 仓库发货
step5_1.picking_goods(jctorder) # 仓库拣货
step5_1.switch_loggin(usr5, pwd5)
step5_2.outbound_review1(jctorder,type=3) # 出库复核
\ 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