Commit 6d3b94e6 authored by 章 登恒's avatar 章 登恒
Browse files

commit

parent 27ea7d8c
......@@ -61,7 +61,7 @@ class LoginSys():###登录
# continue
class PurchaseOrder():###普通采购单界面操作
def data_add(self):#填写表单数据
def data_add_purchase(self):#填写表单数据
chrome.implicitly_wait(10)
###打开普通采购单###
order_link = chrome.find_element_by_xpath('//span[text()="普通采购订单"]')
......@@ -199,14 +199,15 @@ class PurchaseOrder():###普通采购单界面操作
#打开菜单
order_link = chrome.find_element_by_xpath('//span[text()="%s"]'%menu_name)
chrome.execute_script("arguments[0].click();", order_link)
sleep(3)
sleep(5)
chrome.switch_to.frame(chrome.find_element_by_xpath('(//iframe[@class="metro-main-frame"])[2]'))
sleep(1)
# 输入orderno并查询出订单
chrome.find_element_by_xpath('//label[text()="%s"]/parent::div/div/div/div/input'%qrcond).send_keys(orderno)
sleep(1)
chrome.find_element_by_xpath('//label[text()="%s"]/parent::div/div/div/div/input'%qrcond).send_keys(Keys.ENTER)
sleep(3)
wait.until(ec.visibility_of_element_located((By.XPATH,'//td[@class="%s"]'%el)))
sleep(2)
# locator = (By.CLASS_NAME, 'el-loading-spinner')
# wait.until_not(ec.presence_of_element_located(locator))
# sleep(1)
......@@ -214,8 +215,7 @@ class PurchaseOrder():###普通采购单界面操作
# chrome.find_element_by_xpath(
# '//span[text()="%s"]//parent::div/parent::td//preceding-sibling::td[1]/div/span' % orderno1).click()
#点击订单,进入表单视图
element = chrome.find_element_by_xpath('//td[@class="%s"]/div/span'%el)
element.click()
chrome.find_element_by_xpath('//td[@class="%s"]'%el).click()
sleep(1)
def commit_order(self,type=2):#保存/提交订单:type=1为保存,否则为提交
......@@ -414,8 +414,10 @@ class PurchaseReject(PurchaseOrder):
chrome.find_element_by_xpath('//label[text()="原始订单号"]/parent::div/div/div/div/input').send_keys(orderno)
sleep(1)
chrome.find_element_by_xpath('//label[text()="原始订单号"]/parent::div/div/div/div/input').send_keys(Keys.ENTER)
sleep(5)
#选中订单点击采退
wait.until(ec.visibility_of_element_located((By.XPATH,'//th[@class="vxe-header--column col_18 col--center col--checkbox col--ellipsis"]/div/span/span')))
sleep(1)
chrome.find_element_by_xpath('//th[@class="vxe-header--column col_18 col--center col--checkbox col--ellipsis"]/div/span/span').click()
sleep(0.5)
chrome.find_element_by_xpath('//span[text()="采退"]').click()
......@@ -476,15 +478,15 @@ class Outstore(PurchaseOrder):#出库三步曲
chrome.switch_to.frame(chrome.find_element_by_xpath('//iframe[contains(@name,"awsui-dialog-iframe")]'))
sleep(0.5)
wait.until(ec.visibility_of_element_located((By.XPATH, '//span[text()="确认发货"]')))
sleep(0.5)
sleep(1)
#确认发货
chrome.find_element_by_xpath('//span[text()="确认发货"]').click()
wait.until(ec.visibility_of_element_located((By.XPATH, '//span[text()="确定"]')))
sleep(0.5)
sleep(1)
#确定
chrome.find_element_by_xpath('//span[text()="确定"]').click()
wait.until(ec.visibility_of_element_located((By.XPATH, '//span[text()="确认发货"]')))
sleep(0.5)
sleep(1)
# 确认发货
chrome.find_element_by_xpath('//span[text()="确认发货"]').click()
sleep(0.5)
......@@ -504,9 +506,15 @@ class Outstore(PurchaseOrder):#出库三步曲
def outbound_review(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)
chrome.switch_to.frame(chrome.find_element_by_xpath('//iframe[contains(@name,"awsui-dialog-iframe")]'))
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)
......@@ -526,7 +534,7 @@ if __name__ == '__main__':
step4 = PurchaseReject()
step5 = Outstore()
step1.loginsys(SIT_URL,usr2,pwd2)#登录系统
step2.data_add()#填写表单数据
step2.data_add_purchase()#填写表单数据
step2.button_click1()#1为保存,否则为提交
# step2.commit_order(1)#提交采购单:1为保存,否则为提交
step2.switch_loggin(usr1,pwd1)#切换登录
......
import datetime
import threading
import time
import traceback
from airtest.core.api import *
from selenium import webdriver
from selenium.webdriver import DesiredCapabilities
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from airtest_selenium.proxy import *
from selenium.webdriver import Chrome, ChromeOptions
from airtest.core.api import *
from airtest_selenium.proxy import *
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.wait import WebDriverWait
from testcase.test_scene1.scene1_mainflow import *
from public.mail1 import send_email1
from public.tools 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'
warehousename = '103305'#仓库名称
purcontractnumber = 41007#采购合同号
salcontractnumber = 1222720#销售合同号
salesman = '杨春刚'#业务员名称
salcust = 1000486
productcode = 10156326#商品编码
productdate = '2023-10-01'#生产日期
expirdate = '2026-09-30'#失效日期
errmsg = '流程三:特一级/经销商向总代采购,货从供应商发(经销商快采快销场景)流程异常,请检查!'#流程异常提示信息
class QuickPurchase():#快速采购单界面操作
def data_add_quickpurchase(self):#填写表单数据
chrome.implicitly_wait(10)
###打开快速采购订单###
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('//span[text()="新建"]').click()
sleep(4)
chrome.switch_to.frame(chrome.find_element_by_xpath('//iframe[contains(@name,"awsui-dialog-iframe")]'))
sleep(2)
###获取订单号###
global orderno1
orderno1 = chrome.find_element_by_xpath('//div[text() = "订单号 "]/following-sibling::div/span').text
print('快速采购单号为:',orderno1)
###填写仓库信息###
#点击仓库名称,输入仓库名并查询出结果
chrome.find_element_by_xpath('//div[text()="仓库名称 "]/following-sibling::div/div/div/div/div/div/div/div/span/span/i').click()
sleep(1)
chrome.find_element_by_xpath('//input[@placeholder="模糊检索:仓库名称,仓库编码"]').send_keys(warehousename)
chrome.find_element_by_xpath('//input[@placeholder="模糊检索:仓库名称,仓库编码"]').send_keys(Keys.ENTER)
sleep(1)
#勾选查询出的仓库并点击确定按钮
btn_div= chrome.find_element_by_xpath('//span/input[@type="radio" and @value="093e125f132ba7792b1d6752aa9bc9cf1"]')
chrome.execute_script("arguments[0].click();", btn_div)
sleep(1)
chrome.find_element_by_xpath('(//button[@class="el-button el-button--primary el-button--default"])[2]').click()
sleep(1)
###填写合同页信息###
#切到合同信息页
chrome.find_element_by_xpath('//div[text()="合同信息"]').click()
sleep(1)
#点击采购合同/协议号并输入信息,查询出结果
chrome.find_element_by_xpath(
'//div[text()="采购合同/协议号 "]/following-sibling::div/div/div/div/div/div/div/div/span/span/i').click()
sleep(1)
chrome.find_element_by_xpath(
'//input[@placeholder="模糊检索:合同协议号,合同号,项目编码,项目名称,业态编码,对方编码,产品线编码"]').send_keys(
purcontractnumber)
sleep(1)
chrome.find_element_by_xpath(
'//input[@placeholder="模糊检索:合同协议号,合同号,项目编码,项目名称,业态编码,对方编码,产品线编码"]').send_keys(
Keys.ENTER)
sleep(1)
# chrome.find_element_by_xpath(
# '//div[@class="multiple-header string_col" and text()="38443"]/ancestor-or-self::td/preceding-sibling::td/div/label/span/span').click()
#勾选查询出的合同号并点击确定按钮
btn_div= chrome.find_element_by_xpath('//span/input[@type="radio" and @value="03992a2172b8f7327a077e60ac1da11b8"]')
chrome.execute_script("arguments[0].click();", btn_div)
sleep(1)
chrome.find_element_by_xpath('(//button[@class="el-button el-button--primary el-button--default"])[2]').click()
sleep(2)
#点击业务员名称并输入查询条件,查询出结果
chrome.find_element_by_xpath(
'//div[text()="业务员名称 "]/following-sibling::div/div/div/div/div/div/div/div/span/span/i').click()
sleep(1)
chrome.find_element_by_xpath('//input[@placeholder="模糊检索:业务员编码,业务员名称,部门编码,部门名称"]').send_keys(salesman)
sleep(1)
chrome.find_element_by_xpath('//input[@placeholder="模糊检索:业务员编码,业务员名称,部门编码,部门名称"]').send_keys(Keys.ENTER)
sleep(1)
#勾选查询出的业务员并点击确定按钮
btn_div= chrome.find_element_by_xpath('//span/input[@type="radio" and @value="06c32a810e3dabf2a50d1ab040c7951c8"]')
chrome.execute_script("arguments[0].click();", btn_div)
sleep(1)
chrome.find_element_by_xpath('(//span[@class="ensureBtn"]/button[1])[3]').click()
sleep(1)
# 点击销售合同/协议号并输入信息,查询出结果
chrome.find_element_by_xpath(
'//div[text()="销售合同/协议号 "]/following-sibling::div/div/div/div/div/div/div/div/span/span/i').click()
sleep(1)
chrome.find_element_by_xpath(
'//input[@placeholder="模糊检索:合同协议号,对方编码,销售项目编码,销售项目名称"]').send_keys(salcontractnumber)
sleep(1)
chrome.find_element_by_xpath(
'//input[@placeholder="模糊检索:合同协议号,对方编码,销售项目编码,销售项目名称"]').send_keys(Keys.ENTER)
sleep(1)
# chrome.find_element_by_xpath(
# '//div[@class="multiple-header string_col" and text()="38443"]/ancestor-or-self::td/preceding-sibling::td/div/label/span/span').click()
# 勾选查询出的合同号并点击确定按钮
btn_div = chrome.find_element_by_xpath(
'//span/input[@type="radio" and @value="09121f3b324320394a083752e0a5f392c"]')
chrome.execute_script("arguments[0].click();", btn_div)
sleep(1)
chrome.find_element_by_xpath('(//button[@class="el-button el-button--primary el-button--default"])[2]').click()
sleep(1)
# 点击销售客户名称并输入信息,查询出结果
chrome.find_element_by_xpath(
'//div[text()="销售客户名称 "]/following-sibling::div/div/div/div/div/div/div/div/span/span/i').click()
sleep(1)
chrome.find_element_by_xpath('//input[@placeholder="模糊检索:客户编码,客户名称"]').send_keys(salcust)
sleep(1)
chrome.find_element_by_xpath('//input[@placeholder="模糊检索:客户编码,客户名称"]').send_keys(Keys.ENTER)
sleep(1)
# chrome.find_element_by_xpath(
# '//div[@class="multiple-header string_col" and text()="38443"]/ancestor-or-self::td/preceding-sibling::td/div/label/span/span').click()
# 勾选查询出的合同号并点击确定按钮
btn_div = chrome.find_element_by_xpath(
'//span/input[@type="radio" and @value="09f1f6e22a40715aa4f23cc8b2cb2cece"]')
chrome.execute_script("arguments[0].click();", btn_div)
sleep(1)
chrome.find_element_by_xpath('(//button[@class="el-button el-button--primary el-button--default"])[2]').click()
sleep(1)
###切换到其他信息页签###
chrome.find_element_by_xpath('//div[text()="其他信息"]').click()
sleep(1)
###子表信息录入###
chrome.find_element_by_xpath('//div[text()="主体信息"]').click()
sleep(1)
#点击添加商品并输入商品编码,查询出结果
chrome.find_element_by_xpath('//span[text()="添加商品"]').click()
sleep(1)
chrome.find_element_by_xpath(
'//input[@placeholder="模糊检索:商品编码,商品名称,规格型号,厂家物料编码"]').send_keys(productcode)
sleep(0.5)
chrome.find_element_by_xpath(
'//input[@placeholder="模糊检索:商品编码,商品名称,规格型号,厂家物料编码"]').send_keys(Keys.ENTER)
sleep(2)
#勾选查询出的商品并点击确定按钮
chrome.find_element_by_xpath(
'//th[@class="el-table_21_column_237 multiple-column el-table-column--selection is-leaf headerCellClassName el-table__cell"]/div/label/span/span').click()
sleep(0.5)
chrome.find_element_by_xpath('(//div[@class="el-dialog__body"]/div[2]/span/button[1]/span)[6]').click()
sleep(5)
###填写数量价格###
for i in range(1):
wait.until(ec.visibility_of_element_located((By.XPATH,'(//td[@colid="col_165" and @f="F_QUANTITY_ORD" and @i=%s])'%i)))
#定位数量框并输入数量
element = chrome.find_element_by_xpath('(//td[@colid="col_165" and @f="F_QUANTITY_ORD" and @i=%s])'%i)
chrome.execute_script("arguments[0].click();", element)
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_172" and @f="F_PURUNIT_TXT" and @i=%s])' % i).click()
sleep(1)
if __name__ == '__main__':
step1 = LoginSys()
step2 = QuickPurchase()
step1.loginsys(SIT_URL,usr2,pwd2)
step2.data_add_quickpurchase()
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