Commit b2af39f84bc3218b7b0e112425ee0bf0af102738
1 parent
a3ecf544
新增开发商品
Showing
17 changed files
with
823 additions
and
81 deletions
Show diff stats
src/main/java/com/essa/framework/BasePage.java
| ... | ... | @@ -653,12 +653,12 @@ public class BasePage { |
| 653 | 653 | forceWait(1000); |
| 654 | 654 | } |
| 655 | 655 | } |
| 656 | - /** | |
| 657 | - * bpms动态等待,指的是我们后台系统那个加载的圈圈 | |
| 658 | - */ | |
| 659 | - protected void dynamicWait() { | |
| 660 | - dynamicWait(By.xpath("//*[@name='tailDeliveryDay']")); | |
| 661 | - } | |
| 656 | +// /** | |
| 657 | +// * bpms动态等待,指的是我们后台系统那个加载的圈圈 | |
| 658 | +// */ | |
| 659 | +// protected void dynamicWait() { | |
| 660 | +// dynamicWait(By.xpath("//*[@name='tailDeliveryDay']")); | |
| 661 | +// } | |
| 662 | 662 | |
| 663 | 663 | /** |
| 664 | 664 | * 与上面的方法相反,如果元素存在,等待直到元素不存在,最长7秒 |
| ... | ... | @@ -670,6 +670,14 @@ public class BasePage { |
| 670 | 670 | } |
| 671 | 671 | } |
| 672 | 672 | /** |
| 673 | + * 我们bpms的加载等待的那个圈圈,这个加载圈消失意味着加载完成 | |
| 674 | + * @param | |
| 675 | + * @return | |
| 676 | + */ | |
| 677 | + protected void dynamicLoad(){ | |
| 678 | + dynamicLoad(By.xpath("//*[style='display: block;']")); | |
| 679 | + } | |
| 680 | + /** | |
| 673 | 681 | * 连接数据库查询数据 |
| 674 | 682 | * @param sql 查询sql |
| 675 | 683 | * @param field 需要的字段,这个方法只支持一个字段查询 | ... | ... |
src/main/java/com/essa/framework/Model.java
| ... | ... | @@ -9,7 +9,7 @@ public class Model { |
| 9 | 9 | public static String skuNo;//商品编号 |
| 10 | 10 | public static String buyerNo;//采购商编号 |
| 11 | 11 | public static String supplierName;//供应商名称 |
| 12 | - public static String picPath;//图片路径 | |
| 12 | + public static String picPath = "C:\\Users\\Administrator\\Pictures\\Camera Roll\\ya.jpg";//图片路径 | |
| 13 | 13 | public static String email = "buyer"+Tools.getTime()+"@essa.cn";//采购商邮箱 |
| 14 | 14 | public static String invateCode;//邀请码 |
| 15 | 15 | public static String env;//所选环境 |
| ... | ... | @@ -19,8 +19,25 @@ public class Model { |
| 19 | 19 | public static int isactivity=0;//是否是活动商品 1:是 0:否 |
| 20 | 20 | public static String manager;//商品的类目经理 |
| 21 | 21 | public static String serialNum;//待办流水号 |
| 22 | - | |
| 23 | - | |
| 22 | + public static String materialName;//物料名称 | |
| 23 | + public static String projectName;//项目立项书名称 | |
| 24 | + | |
| 25 | + public static String getProjectName() { | |
| 26 | + return projectName; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public static void setProjectName(String projectName) { | |
| 30 | + Model.projectName = projectName; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public static String getMaterialName() { | |
| 34 | + return materialName; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public static void setMaterialName(String materialName) { | |
| 38 | + Model.materialName = materialName; | |
| 39 | + } | |
| 40 | + | |
| 24 | 41 | public static String getSerialNum() { |
| 25 | 42 | return serialNum; |
| 26 | 43 | } | ... | ... |
src/main/java/com/essa/pageObject/BaseTest.java
| ... | ... | @@ -8,58 +8,61 @@ import org.openqa.selenium.support.PageFactory; |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * @author Administrator |
| 11 | - *测试用例的基类,主要是有登录和调用浏览器的方法 | |
| 11 | + * 测试用例的基类,主要是有登录和调用浏览器的方法 | |
| 12 | 12 | */ |
| 13 | 13 | public class BaseTest { |
| 14 | - public WebDriver driver; | |
| 14 | + public WebDriver driver; | |
| 15 | 15 | |
| 16 | - public WebDriver getDriver() { | |
| 17 | - return driver; | |
| 18 | - } | |
| 19 | - | |
| 20 | - /** | |
| 21 | - * bpms调用浏览器,打开要测试的网页 | |
| 22 | - */ | |
| 23 | - public void initsetUp() { | |
| 24 | - BrowserEngine browserEngine = new BrowserEngine(); | |
| 16 | + public WebDriver getDriver() { | |
| 17 | + return driver; | |
| 18 | + } | |
| 19 | + | |
| 20 | + /** | |
| 21 | + * bpms调用浏览器,打开要测试的网页 | |
| 22 | + */ | |
| 23 | + public void initsetUp() { | |
| 24 | + BrowserEngine browserEngine = new BrowserEngine(); | |
| 25 | 25 | // try { |
| 26 | - browserEngine.initConfigData(); | |
| 26 | + browserEngine.initConfigData(); | |
| 27 | 27 | /*} catch (IOException e) { |
| 28 | 28 | e.printStackTrace(); |
| 29 | 29 | }*/ |
| 30 | - driver = browserEngine.getBrowser(); | |
| 31 | - } | |
| 32 | - | |
| 33 | - /** | |
| 34 | - * buyer调用浏览器,将访问buyer的地址 | |
| 35 | - */ | |
| 36 | - public void initBuyer() { | |
| 37 | - BrowserEngine browserEngine = new BrowserEngine(); | |
| 30 | + driver = browserEngine.getBrowser(); | |
| 31 | + } | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * buyer调用浏览器,将访问buyer的地址 | |
| 35 | + */ | |
| 36 | + public void initBuyer() { | |
| 37 | + BrowserEngine browserEngine = new BrowserEngine(); | |
| 38 | 38 | // try { |
| 39 | - browserEngine.initConfigData(); | |
| 39 | + browserEngine.initConfigData(); | |
| 40 | 40 | /* } catch (IOException e) { |
| 41 | 41 | e.printStackTrace(); |
| 42 | 42 | }*/ |
| 43 | - driver = browserEngine.buyerGetBrowser(); | |
| 44 | - } | |
| 43 | + driver = browserEngine.buyerGetBrowser(); | |
| 44 | + } | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * bpms初始化登录页面,登录 | |
| 48 | + * | |
| 49 | + * @param account | |
| 50 | + */ | |
| 51 | + public void loginValid(String account) { | |
| 52 | + LoginPage loginPage = PageFactory.initElements(driver, LoginPage.class); | |
| 53 | + loginPage.login(account, "essa123"); | |
| 54 | + } | |
| 45 | 55 | |
| 46 | - /** | |
| 47 | - * bpms初始化登录页面,登录 | |
| 48 | - * @param account | |
| 49 | - */ | |
| 50 | - public void loginValid(String account) { | |
| 51 | - LoginPage loginPage = PageFactory.initElements(driver, LoginPage.class); | |
| 52 | - loginPage.login(account, "essa123"); | |
| 53 | - } | |
| 54 | - /** | |
| 55 | - * buyer初始化登录 | |
| 56 | - * @param account | |
| 57 | - */ | |
| 58 | - public void loginBuyerValid(String account,String password) { | |
| 59 | - IndexPage indexPage = PageFactory.initElements(driver, IndexPage.class); | |
| 60 | - indexPage.toLoginPage(); | |
| 61 | - BuyerLoginPage loginPage = PageFactory.initElements(driver, BuyerLoginPage.class); | |
| 62 | - loginPage.login(account, password); | |
| 63 | - } | |
| 56 | + /** | |
| 57 | + * buyer初始化登录 | |
| 58 | + * | |
| 59 | + * @param account | |
| 60 | + */ | |
| 61 | + public void loginBuyerValid(String account, String password) { | |
| 62 | + IndexPage indexPage = PageFactory.initElements(driver, IndexPage.class); | |
| 63 | + indexPage.toLoginPage(); | |
| 64 | + BuyerLoginPage loginPage = PageFactory.initElements(driver, BuyerLoginPage.class); | |
| 65 | + loginPage.login(account, password); | |
| 66 | + } | |
| 64 | 67 | } |
| 65 | 68 | ... | ... |
src/main/java/com/essa/pageObject/GoodsManage/AddOriginalGoodsPage.java
| 1 | 1 | package com.essa.pageObject.GoodsManage; |
| 2 | 2 | |
| 3 | +import com.essa.pageObject.productDev.ProjectListPage; | |
| 3 | 4 | import org.openqa.selenium.By; |
| 4 | 5 | import org.openqa.selenium.WebDriver; |
| 5 | 6 | import org.openqa.selenium.WebElement; |
| ... | ... | @@ -28,6 +29,10 @@ public class AddOriginalGoodsPage extends BasePage { |
| 28 | 29 | //选择供应商 |
| 29 | 30 | @FindBy (xpath="//*[@ng-click='supplier()']") |
| 30 | 31 | WebElement selectSupplier; |
| 32 | + | |
| 33 | + //确定按钮-开发商品确认 | |
| 34 | + @FindBy (xpath = "//*[text()='确定']") | |
| 35 | + WebElement confrim; | |
| 31 | 36 | |
| 32 | 37 | //供应商查询方式选择 |
| 33 | 38 | @FindBy (xpath="//*[@ng-click='showSelect()']") |
| ... | ... | @@ -331,7 +336,7 @@ public class AddOriginalGoodsPage extends BasePage { |
| 331 | 336 | |
| 332 | 337 | /** |
| 333 | 338 | * 选择供应商 |
| 334 | - * @param 供应商名称 | |
| 339 | + * @param | |
| 335 | 340 | * @throws InterruptedException |
| 336 | 341 | */ |
| 337 | 342 | public void selectSupplier(String supplierName){ |
| ... | ... | @@ -465,7 +470,7 @@ public class AddOriginalGoodsPage extends BasePage { |
| 465 | 470 | |
| 466 | 471 | /** |
| 467 | 472 | * 原厂商品建档,将上面的方法整合 |
| 468 | - * @param supplierName | |
| 473 | + * @param | |
| 469 | 474 | * @return |
| 470 | 475 | * @throws InterruptedException |
| 471 | 476 | */ |
| ... | ... | @@ -478,6 +483,23 @@ public class AddOriginalGoodsPage extends BasePage { |
| 478 | 483 | goodsSpecifications(); |
| 479 | 484 | return new GoodsRelesePage(driver); |
| 480 | 485 | } |
| 486 | + /** | |
| 487 | + *开发商品建档保存 | |
| 488 | + * @param | |
| 489 | + * @return 项目立项书列表 | |
| 490 | + */ | |
| 491 | + public ProjectListPage addDevGood(){ | |
| 492 | + forceWait(4000);//页面会刷几次,只能强制等待 | |
| 493 | + moveHeightScroll("0"); | |
| 494 | + forceWait(1000); | |
| 495 | + click(save); | |
| 496 | + forceWait(1000); | |
| 497 | + if(isVisibility(By.xpath("//*[text()='确定']"))){ | |
| 498 | + click(confrim); | |
| 499 | + } | |
| 500 | + dynamicLoad(); | |
| 501 | + return new ProjectListPage(driver); | |
| 502 | + } | |
| 481 | 503 | |
| 482 | 504 | /** |
| 483 | 505 | * 用于断言是否商品建档成功 | ... | ... |
src/main/java/com/essa/pageObject/GoodsManage/AuditDevGoodsPage.java
0 → 100644
| ... | ... | @@ -0,0 +1,52 @@ |
| 1 | +package com.essa.pageObject.GoodsManage; | |
| 2 | + | |
| 3 | +import com.essa.framework.BasePage; | |
| 4 | +import com.essa.framework.Model; | |
| 5 | +import org.openqa.selenium.By; | |
| 6 | +import org.openqa.selenium.WebDriver; | |
| 7 | +import org.openqa.selenium.WebElement; | |
| 8 | +import org.openqa.selenium.support.FindBy; | |
| 9 | + | |
| 10 | +public class AuditDevGoodsPage extends BasePage { | |
| 11 | + /** | |
| 12 | + * 构造方法 | |
| 13 | + * | |
| 14 | + * @param driver | |
| 15 | + */ | |
| 16 | + public AuditDevGoodsPage(WebDriver driver) { | |
| 17 | + super(driver); | |
| 18 | + } | |
| 19 | + /** | |
| 20 | + * 元素定位 | |
| 21 | + */ | |
| 22 | + @FindBy (xpath = "//*[@ng-model='query.skuCode']") | |
| 23 | + WebElement skuNo;//sku编号 | |
| 24 | + | |
| 25 | + @FindBy (xpath = "//*[text()='查询']") | |
| 26 | + WebElement search;//查询按钮 | |
| 27 | + | |
| 28 | + @FindBy (xpath = "//*[@ng-change='getCheckedStatus();']") | |
| 29 | + WebElement checkbox;//复选框 | |
| 30 | + | |
| 31 | + @FindBy (xpath = "//*[text()='审核']") | |
| 32 | + WebElement audit;//审核 | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * 页面方法 | |
| 36 | + */ | |
| 37 | + /** | |
| 38 | + *跳转到审核页面,这里开发商品共用的原厂商品的审核页面 | |
| 39 | + * @param | |
| 40 | + * @return 原厂商品审核页面 | |
| 41 | + */ | |
| 42 | + public AuditOriginalOpreatePage auditDevGood(){ | |
| 43 | +// dynamicLoad(); | |
| 44 | + dynamicWait(By.xpath("//table[@class='table border-default margin-bottom-80 ng-scope ng-table']//tbody[1]")); | |
| 45 | + sendKeys(skuNo, Model.getSkuNo()); | |
| 46 | + click(search); | |
| 47 | + forceWait(1000); | |
| 48 | + click(checkbox); | |
| 49 | + click(audit); | |
| 50 | + return new AuditOriginalOpreatePage(driver); | |
| 51 | + } | |
| 52 | +} | ... | ... |
src/main/java/com/essa/pageObject/GoodsManage/AuditOriginalOpreatePage.java
| 1 | 1 | package com.essa.pageObject.GoodsManage; |
| 2 | 2 | |
| 3 | +import org.openqa.selenium.By; | |
| 3 | 4 | import org.openqa.selenium.WebDriver; |
| 4 | 5 | import org.openqa.selenium.WebElement; |
| 5 | 6 | import org.openqa.selenium.support.FindBy; |
| ... | ... | @@ -25,6 +26,18 @@ public class AuditOriginalOpreatePage extends BasePage { |
| 25 | 26 | //审核通过提示语 |
| 26 | 27 | @FindBy(xpath="//*[text()='商品审核已通过'") |
| 27 | 28 | WebElement succeedMessage; |
| 29 | + | |
| 30 | + //定价销售 | |
| 31 | + @FindBy (xpath = "//*[@ng-model='skuItem.isFixedSale']") | |
| 32 | + WebElement isFixedSale; | |
| 33 | + | |
| 34 | + //毛利率 | |
| 35 | + @FindBy (xpath = "//*[@ng-model='skuItem.grossProfit2']") | |
| 36 | + WebElement grossProfit; | |
| 37 | + | |
| 38 | + //工厂货号重复时,确定按钮 | |
| 39 | + @FindBy (xpath = "//*[text()='确定']") | |
| 40 | + WebElement confirm; | |
| 28 | 41 | |
| 29 | 42 | /* |
| 30 | 43 | * 页面方法 |
| ... | ... | @@ -36,8 +49,28 @@ public class AuditOriginalOpreatePage extends BasePage { |
| 36 | 49 | */ |
| 37 | 50 | public AuditOriginalGoodsPage auditPass() { |
| 38 | 51 | forceWait(2000); |
| 39 | - moveHeightScroll("100"); | |
| 52 | + moveHeightScroll("0"); | |
| 53 | + click(pass); | |
| 54 | + forceWait(500); | |
| 55 | + if (isVisibility(By.xpath("//*[text()='确定']"))) | |
| 56 | + click(confirm); | |
| 57 | + return new AuditOriginalGoodsPage(driver); | |
| 58 | + } | |
| 59 | + /** | |
| 60 | + *开发商品审核通过,要设置毛利率 | |
| 61 | + * @param | |
| 62 | + * @return AuditOriginalGoodsPage | |
| 63 | + */ | |
| 64 | + public AuditOriginalGoodsPage auditDevGoodPass(){ | |
| 65 | + forceWait(2000); | |
| 66 | + moveHeightScroll("50"); | |
| 67 | + selectElement(isFixedSale,"否"); | |
| 68 | + sendKeys(grossProfit,"5"); | |
| 69 | + moveHeightScroll("0"); | |
| 40 | 70 | click(pass); |
| 71 | + forceWait(500); | |
| 72 | + if (isVisibility(By.xpath("//*[text()='确定']"))) | |
| 73 | + click(confirm); | |
| 41 | 74 | return new AuditOriginalGoodsPage(driver); |
| 42 | 75 | } |
| 43 | 76 | ... | ... |
src/main/java/com/essa/pageObject/GoodsManage/GoodsRelesePage.java
| 1 | 1 | package com.essa.pageObject.GoodsManage; |
| 2 | 2 | |
| 3 | +import com.essa.framework.Model; | |
| 3 | 4 | import org.openqa.selenium.By; |
| 4 | 5 | import org.openqa.selenium.WebDriver; |
| 5 | 6 | import org.openqa.selenium.WebElement; |
| ... | ... | @@ -37,6 +38,15 @@ public class GoodsRelesePage extends BasePage { |
| 37 | 38 | String no = AddOriginalGoodsPage.getSkuNameNo(); |
| 38 | 39 | return driver.findElement(By.xpath("//*[contains(text(),'"+no+"')]/../../td[1]/input")); |
| 39 | 40 | } |
| 41 | + | |
| 42 | + @FindBy (xpath = "//*[@ng-model='query.keyword']") | |
| 43 | + WebElement keyword;//关键字 | |
| 44 | + | |
| 45 | + @FindBy (xpath = "//*[@ng-click='search()']") | |
| 46 | + WebElement search;//查询按钮 | |
| 47 | + | |
| 48 | + @FindBy (xpath = "//*[@ng-table='preUploadCtrlTableParams']/tbody[1]/tr[1]/td[1]/input") | |
| 49 | + WebElement checkbox;//第一个复选框 | |
| 40 | 50 | |
| 41 | 51 | //图片更新 |
| 42 | 52 | @FindBy(xpath="//*[contains(text(),'图片更新')]") |
| ... | ... | @@ -73,6 +83,22 @@ public class GoodsRelesePage extends BasePage { |
| 73 | 83 | click(edit); |
| 74 | 84 | return new EditSpuPage(driver); |
| 75 | 85 | } |
| 86 | + | |
| 87 | + /** | |
| 88 | + *开发商品更新图片 | |
| 89 | + * @param | |
| 90 | + * @return 更新图片详情页 | |
| 91 | + */ | |
| 92 | + public UpdatePicPage toUpdateDevGoodPic(){ | |
| 93 | + forceWait(2000); | |
| 94 | + dynamicWait(By.xpath("//*[@ng-table='preUploadCtrlTableParams']/tbody[1]/tr[1]/td[1]/input")); | |
| 95 | + sendKeys(keyword,Model.getSkuNo()); | |
| 96 | + click(search); | |
| 97 | + forceWait(1500); | |
| 98 | + click(checkbox); | |
| 99 | + click(updatePic); | |
| 100 | + return new UpdatePicPage(driver); | |
| 101 | + } | |
| 76 | 102 | |
| 77 | 103 | /** |
| 78 | 104 | * 断言商品建档是否成功 | ... | ... |
src/main/java/com/essa/pageObject/GoodsManage/UpdatePicPage.java
| 1 | 1 | package com.essa.pageObject.GoodsManage; |
| 2 | 2 | |
| 3 | +import com.essa.framework.Model; | |
| 3 | 4 | import org.openqa.selenium.By; |
| 4 | 5 | import org.openqa.selenium.WebDriver; |
| 5 | 6 | import org.openqa.selenium.WebElement; |
| ... | ... | @@ -15,7 +16,7 @@ public class UpdatePicPage extends BasePage { |
| 15 | 16 | public UpdatePicPage(WebDriver driver) { |
| 16 | 17 | super(driver); |
| 17 | 18 | } |
| 18 | - public static String picPath; | |
| 19 | +// public static String picPath; | |
| 19 | 20 | |
| 20 | 21 | /* |
| 21 | 22 | * 元素定位 |
| ... | ... | @@ -62,18 +63,12 @@ public class UpdatePicPage extends BasePage { |
| 62 | 63 | forceWait(2000); |
| 63 | 64 | dynamicWait(By.xpath("//*[text()='SPU信息']")); |
| 64 | 65 | click(spuUploadPic); |
| 65 | - uploadFile(picPath); | |
| 66 | - //如果spu图片还在上传,则等待2秒 | |
| 67 | - /*while(!isElementExist(spuPic)) { | |
| 68 | - forceWait(2000); | |
| 69 | - }*/ | |
| 66 | +// uploadFile(picPath); | |
| 67 | + uploadFile(Model.getPicPath()); | |
| 70 | 68 | dynamicWait(By.xpath("//*[@class='load-pic']")); |
| 71 | 69 | click(skuUploadPic); |
| 72 | - uploadFile(picPath); | |
| 73 | - //如果默认的sku图片还存在,说明图片还在上传,继续等待 | |
| 74 | - /*while (!isElementExist(skuPic)) { | |
| 75 | - forceWait(2000); | |
| 76 | - }*/ | |
| 70 | +// uploadFile(picPath); | |
| 71 | + uploadFile(Model.getPicPath()); | |
| 77 | 72 | dynamicWait(By.xpath("//*[contains(@ng-click,'picInfo,')]")); |
| 78 | 73 | forceWait(1000); |
| 79 | 74 | click(save); |
| ... | ... | @@ -88,11 +83,11 @@ public class UpdatePicPage extends BasePage { |
| 88 | 83 | return isElementExist(succeedMessage); |
| 89 | 84 | } |
| 90 | 85 | |
| 91 | - /** | |
| 92 | - * 通过GUI设置本机图片路径 | |
| 93 | - * @param picpath | |
| 94 | - */ | |
| 95 | - public static void setPicPath(String picpath) { | |
| 96 | - picPath = picpath; | |
| 97 | - } | |
| 86 | +// /** | |
| 87 | +// * 通过GUI设置本机图片路径 | |
| 88 | +// * @param picpath | |
| 89 | +// */ | |
| 90 | +// public static void setPicPath(String picpath) { | |
| 91 | +// picPath = picpath; | |
| 92 | +// } | |
| 98 | 93 | } | ... | ... |
src/main/java/com/essa/pageObject/HomePage.java
| ... | ... | @@ -2,18 +2,16 @@ package com.essa.pageObject; |
| 2 | 2 | |
| 3 | 3 | import com.essa.pageObject.DocumentaryManage.POBoardPage; |
| 4 | 4 | import com.essa.pageObject.DocumentaryManage.ReceiptCorePage; |
| 5 | +import com.essa.pageObject.GoodsManage.*; | |
| 5 | 6 | import com.essa.pageObject.SupplierManage.SupplierOperationsTrackPage; |
| 7 | +import com.essa.pageObject.productDev.AddMatterialPage; | |
| 8 | +import com.essa.pageObject.productDev.AddProjectPage; | |
| 9 | +import com.essa.pageObject.productDev.ProjectListPage; | |
| 6 | 10 | import org.openqa.selenium.WebDriver; |
| 7 | 11 | import org.openqa.selenium.WebElement; |
| 8 | 12 | import org.openqa.selenium.support.FindBy; |
| 9 | 13 | import com.essa.framework.BasePage; |
| 10 | 14 | import com.essa.framework.Model; |
| 11 | -import com.essa.pageObject.GoodsManage.AddOriginalGoodsPage; | |
| 12 | -import com.essa.pageObject.GoodsManage.AuditMarketGoodsPage; | |
| 13 | -import com.essa.pageObject.GoodsManage.AuditOriginalGoodsPage; | |
| 14 | -import com.essa.pageObject.GoodsManage.GoodsBankPage; | |
| 15 | -import com.essa.pageObject.GoodsManage.GoodsRelesePage; | |
| 16 | -import com.essa.pageObject.GoodsManage.MarketGoodsRelesePage; | |
| 17 | 15 | import com.essa.pageObject.DocumentaryManage.PODocumentaryListPage; |
| 18 | 16 | import com.essa.pageObject.StorageManage.GoodsReceiveTaskPage; |
| 19 | 17 | import com.essa.pageObject.StorageManage.NoticeReceivePage; |
| ... | ... | @@ -60,6 +58,9 @@ public class HomePage extends BasePage{ |
| 60 | 58 | //商品管理 |
| 61 | 59 | @FindBy (xpath="//*[text()='商品管理']") |
| 62 | 60 | WebElement goodsManage; |
| 61 | + | |
| 62 | + @FindBy (xpath = "//*[text()='开发商品发布审核']") | |
| 63 | + WebElement DevGoodAudit;//开发商品发布审核 | |
| 63 | 64 | |
| 64 | 65 | //商品库 |
| 65 | 66 | @FindBy (xpath="//*[text()='商品库']") |
| ... | ... | @@ -177,6 +178,10 @@ public class HomePage extends BasePage{ |
| 177 | 178 | @FindBy (xpath = "//a[contains(text(),'收货任务管理')]") |
| 178 | 179 | WebElement goodsReceiveTask; |
| 179 | 180 | |
| 181 | + //物料新增 | |
| 182 | + @FindBy (xpath = "//*[text()='物料新增']") | |
| 183 | + WebElement addMaterial; | |
| 184 | + | |
| 180 | 185 | /* |
| 181 | 186 | * 方法 |
| 182 | 187 | */ |
| ... | ... | @@ -214,6 +219,7 @@ public class HomePage extends BasePage{ |
| 214 | 219 | * @return GoodsRelesePage |
| 215 | 220 | */ |
| 216 | 221 | public GoodsRelesePage tGoodsRelesePage() { |
| 222 | + getHome(); | |
| 217 | 223 | click(goodsManage); |
| 218 | 224 | click(goodsPublish); |
| 219 | 225 | return new GoodsRelesePage(driver); |
| ... | ... | @@ -442,4 +448,45 @@ public class HomePage extends BasePage{ |
| 442 | 448 | click(Receipt_core); |
| 443 | 449 | return new ReceiptCorePage (driver); |
| 444 | 450 | } |
| 451 | + /** | |
| 452 | + *进入开发商品发布审核 | |
| 453 | + * @param | |
| 454 | + * @return 开发商品发布审核 | |
| 455 | + */ | |
| 456 | + public AuditDevGoodsPage toAuditDevgoodsPage(){ | |
| 457 | + click(goodsManage); | |
| 458 | + click(DevGoodAudit); | |
| 459 | + return new AuditDevGoodsPage(driver); | |
| 460 | + } | |
| 461 | + /** | |
| 462 | + *进入项目立项书新增页面 | |
| 463 | + * @param | |
| 464 | + * @return 项目立项书新增 | |
| 465 | + */ | |
| 466 | + public AddProjectPage toAddProject(){ | |
| 467 | + click(productDev); | |
| 468 | + click(addProject); | |
| 469 | + return new AddProjectPage(driver); | |
| 470 | + } | |
| 471 | + /** | |
| 472 | + *进入物料新增页面 | |
| 473 | + * @param | |
| 474 | + * @return 物料新增页面 | |
| 475 | + */ | |
| 476 | + public AddMatterialPage toMaterialPage(){ | |
| 477 | + click(productDev); | |
| 478 | + click(addMaterial); | |
| 479 | + return new AddMatterialPage(driver); | |
| 480 | + } | |
| 481 | + /** | |
| 482 | + *进入项目立项书列表 | |
| 483 | + * @param | |
| 484 | + * @return 项目立项书查询 | |
| 485 | + */ | |
| 486 | + public ProjectListPage toProjectListPage(){ | |
| 487 | + getHome(); | |
| 488 | + click(productDev); | |
| 489 | + click(quiryProject); | |
| 490 | + return new ProjectListPage(driver); | |
| 491 | + } | |
| 445 | 492 | } |
| 446 | 493 | \ No newline at end of file | ... | ... |
src/main/java/com/essa/pageObject/productDev/AddMatterialPage.java
0 → 100644
| ... | ... | @@ -0,0 +1,123 @@ |
| 1 | +package com.essa.pageObject.productDev; | |
| 2 | + | |
| 3 | +import com.essa.framework.BasePage; | |
| 4 | +import com.essa.framework.Model; | |
| 5 | +import com.essa.framework.Tools; | |
| 6 | +import org.openqa.selenium.WebDriver; | |
| 7 | +import org.openqa.selenium.WebElement; | |
| 8 | +import org.openqa.selenium.support.FindBy; | |
| 9 | +/* | |
| 10 | +* @Description: 新增物料页面 | |
| 11 | +* @Author: ZengJin | |
| 12 | +* @CreateTime: 2018/10/29 | |
| 13 | +*/ | |
| 14 | +public class AddMatterialPage extends BasePage { | |
| 15 | + /** | |
| 16 | + * 构造方法 | |
| 17 | + * | |
| 18 | + * @param driver | |
| 19 | + */ | |
| 20 | + public AddMatterialPage(WebDriver driver) { | |
| 21 | + super(driver); | |
| 22 | + } | |
| 23 | + | |
| 24 | + /* | |
| 25 | + 元素定位 | |
| 26 | + */ | |
| 27 | + @FindBy (xpath = "//*[text()='物料基础属性']") | |
| 28 | + WebElement checkPoint;//检查点,物料基础属性 | |
| 29 | + | |
| 30 | + @FindBy (xpath = "//*[@ng-model='item.supplierPrice']") | |
| 31 | + WebElement supplierPrice;//光身:供应商报价 | |
| 32 | + | |
| 33 | + @FindBy (xpath = "//*[@ng-model='item.bodyFclPrice']") | |
| 34 | + WebElement bodyFclPrice;//光身:供应商整柜报价 | |
| 35 | + | |
| 36 | + @FindBy (xpath = "//*[@ng-model='item.purchaseMoq']") | |
| 37 | + WebElement purchaseMoq;//光身:采购MOQ | |
| 38 | + | |
| 39 | + @FindBy (xpath = "//*[@ng-model='item.deliverDay']") | |
| 40 | + WebElement deliverDay;//光身:货期 | |
| 41 | + | |
| 42 | + @FindBy (xpath = "//*[@ng-click='save()']") | |
| 43 | + WebElement save;//保存 | |
| 44 | + | |
| 45 | + @FindBy (xpath = "//*[@ng-model='model.matFromType' and @ng-disabled='isUpdate']") | |
| 46 | + WebElement matFrom;//物料来源 | |
| 47 | + | |
| 48 | + @FindBy (xpath = "//*[@ng-model='model.name']") | |
| 49 | + WebElement matName;//物料名称 | |
| 50 | + | |
| 51 | + @FindBy (xpath = "//*[@ng-model='model.baseUnit']") | |
| 52 | + WebElement baseUnit;//基准单位 | |
| 53 | + | |
| 54 | + @FindBy (xpath = "//*[@ng-click='openSelector()']") | |
| 55 | + WebElement matType;//物料类型 | |
| 56 | + | |
| 57 | + @FindBy (xpath = "//*[text()='纸箱']") | |
| 58 | + WebElement carton;//物料类型:纸箱 | |
| 59 | + | |
| 60 | + @FindBy (xpath = "//*[text()='海德印刷厂']/../td[3]/input") | |
| 61 | + WebElement factoryNo;//工厂货号 | |
| 62 | + | |
| 63 | + @FindBy (xpath = "//*[text()='海德印刷厂']/../td[5]/select") | |
| 64 | + WebElement purchaseUnit;//物料采购单位 | |
| 65 | + | |
| 66 | + @FindBy (xpath = "//*[text()='海德印刷厂']/../td[6]/input") | |
| 67 | + WebElement unitExchangeRate;//换算值 | |
| 68 | + | |
| 69 | + @FindBy (xpath = "//*[text()='海德印刷厂']/../td[8]/input") | |
| 70 | + WebElement matSupplierPrice;//物料:供应商报价 | |
| 71 | + | |
| 72 | + @FindBy (xpath = "//*[text()='海德印刷厂']/../td[10]/input") | |
| 73 | + WebElement matPurchaseMoq;//物料:采购MOQ | |
| 74 | + | |
| 75 | + @FindBy (xpath = "//*[text()='海德印刷厂']/../td[12]/input") | |
| 76 | + WebElement matDeliverDay;//物料:货期 | |
| 77 | + | |
| 78 | + /* | |
| 79 | + 页面方法 | |
| 80 | + */ | |
| 81 | + /** | |
| 82 | + * @Description: 新增光身物料方法 | |
| 83 | + * @param: [] | |
| 84 | + * @return: 项目立项书列表 | |
| 85 | + * @Author: ZengJin | |
| 86 | + * @CreateTime: 2018/10/29 | |
| 87 | + */ | |
| 88 | + public ProjectListPage addBodyMat(){ | |
| 89 | + mywait(checkPoint); | |
| 90 | + moveHeightScroll("100"); | |
| 91 | + sendKeys(supplierPrice,"15"); | |
| 92 | + sendKeys(bodyFclPrice,"14"); | |
| 93 | + sendKeys(purchaseMoq,"15"); | |
| 94 | + sendKeys(deliverDay,"7"); | |
| 95 | + click(save); | |
| 96 | + return new ProjectListPage(driver); | |
| 97 | + } | |
| 98 | + /** | |
| 99 | + * @Description:新增物料 | |
| 100 | + * @return: 物料列表页 | |
| 101 | + * @Author: ZengJin | |
| 102 | + * @CreateTime: 2018/10/29 | |
| 103 | + */ | |
| 104 | + public MaterialListPage addMaterial(){ | |
| 105 | + mywait(checkPoint); | |
| 106 | + selectElement(matFrom,"自主物料"); | |
| 107 | + Model.setMaterialName("物料" + Tools.getTime()); | |
| 108 | + sendKeys(matName,Model.getMaterialName()); | |
| 109 | + selectElement(baseUnit,"只"); | |
| 110 | + moveHeightScroll("100"); | |
| 111 | + click(matType); | |
| 112 | + click(carton); | |
| 113 | + forceWait(1000); | |
| 114 | + sendKeys(factoryNo,Tools.getFactoryNo()); | |
| 115 | + selectElement(purchaseUnit,"只"); | |
| 116 | + sendKeys(unitExchangeRate,"1"); | |
| 117 | + sendKeys(matSupplierPrice,"5"); | |
| 118 | + sendKeys(matPurchaseMoq,"15"); | |
| 119 | + sendKeys(matDeliverDay,"5"); | |
| 120 | + click(save); | |
| 121 | + return new MaterialListPage(driver); | |
| 122 | + } | |
| 123 | +} | ... | ... |
src/main/java/com/essa/pageObject/productDev/AddProjectPage.java
| 1 | 1 | package com.essa.pageObject.productDev; |
| 2 | 2 | |
| 3 | +import com.essa.framework.Model; | |
| 4 | +import com.essa.framework.Tools; | |
| 5 | +import org.openqa.selenium.By; | |
| 3 | 6 | import org.openqa.selenium.WebDriver; |
| 4 | 7 | import org.openqa.selenium.WebElement; |
| 5 | 8 | import org.openqa.selenium.support.FindBy; |
| 6 | 9 | |
| 7 | 10 | import com.essa.framework.BasePage; |
| 8 | 11 | |
| 12 | +import java.util.Date; | |
| 13 | + | |
| 9 | 14 | /** |
| 10 | 15 | * @author Administrator |
| 11 | 16 | *新增项目立项书 |
| ... | ... | @@ -50,12 +55,16 @@ public class AddProjectPage extends BasePage { |
| 50 | 55 | WebElement Transactor1; |
| 51 | 56 | |
| 52 | 57 | //处理人-linrong |
| 53 | - @FindBy (xpath ="//*[@id='role-user-select-box']/ul/li[3]/span") | |
| 58 | + @FindBy (xpath ="//tbody//tr[1]//td[2]//div[1]//div[1]//ul[1]//li[3]") | |
| 54 | 59 | WebElement linrong1; |
| 55 | 60 | |
| 56 | 61 | //任务处理人 -第二个 |
| 57 | 62 | @FindBy (xpath ="//*[@class='col-md-14']/table/tbody/tr[2]/td[2]/div/input") |
| 58 | 63 | WebElement Transactor2; |
| 64 | + | |
| 65 | + //处理人-第二个 | |
| 66 | + @FindBy (xpath ="//tbody//tr[2]//td[2]//div[1]//div[1]//ul[1]//li[3]") | |
| 67 | + WebElement linrong2; | |
| 59 | 68 | |
| 60 | 69 | //成员角色 -第一个 |
| 61 | 70 | @FindBy (xpath ="//*[@class='col-md-14']/table/tbody/tr[1]/td[3]/select") |
| ... | ... | @@ -68,8 +77,75 @@ public class AddProjectPage extends BasePage { |
| 68 | 77 | //选择改版商品信息 |
| 69 | 78 | @FindBy (xpath ="//*[text()='选择']") |
| 70 | 79 | WebElement selectGoods; |
| 71 | - | |
| 80 | + | |
| 81 | + @FindBy (xpath = "//*[@name='keyword']") | |
| 82 | + WebElement searchContent; | |
| 83 | + | |
| 84 | + //添加商品-查询按钮 | |
| 85 | + @FindBy (xpath = "//*[@ng-click='search(false)']") | |
| 86 | + WebElement addSkuSearch; | |
| 87 | + | |
| 88 | + //添加商品-展开商品信息 | |
| 89 | + @FindBy (xpath = "//*[contains(@class,'fa fa-angle-double-dow')]") | |
| 90 | + WebElement showSku; | |
| 91 | + | |
| 92 | + //添加商品-搜索结果复选框 | |
| 93 | + @FindBy (xpath = "//*[@ng-repeat='list in item.skus']/tbody") | |
| 94 | + WebElement skuCheckbox; | |
| 95 | + | |
| 96 | + //确定按钮 | |
| 97 | + @FindBy (xpath = "//*[contains(text(),'确定')]") | |
| 98 | + WebElement confirm; | |
| 99 | + | |
| 72 | 100 | //保存 |
| 73 | 101 | @FindBy (xpath ="//*[contains(text(),'保存')]") |
| 74 | 102 | WebElement save; |
| 103 | + | |
| 104 | + //新增光身物料 | |
| 105 | + @FindBy (xpath = "//*[@ng-click='relateAdd()']") | |
| 106 | + WebElement addBodyMat; | |
| 107 | + | |
| 108 | + /* | |
| 109 | + 页面方法 | |
| 110 | + */ | |
| 111 | + /* | |
| 112 | + * @Description:新增项目立项书 | |
| 113 | + * @param: [] | |
| 114 | + * @return: 新增光身物料页面 | |
| 115 | + * @Author: ZengJin | |
| 116 | + * @CreateTime: 2018/10/29 | |
| 117 | + */ | |
| 118 | + public AddMatterialPage addProject(){ | |
| 119 | + mywait(revisonType); | |
| 120 | + selectElement(revisonType,"自主改版"); | |
| 121 | + Model.setProjectName("自主改版"+ Tools.getTime()); | |
| 122 | + sendKeys(projectName,Model.getProjectName()); | |
| 123 | + click(projectLeader); | |
| 124 | + click(linrong); | |
| 125 | + selectElement(devLevel,"小改"); | |
| 126 | + selectElement(devSerial,"男孩系列"); | |
| 127 | + click(addMember); | |
| 128 | + click(Transactor1); | |
| 129 | + forceWait(500); | |
| 130 | + click(linrong1); | |
| 131 | + selectElement(role1,"项目经理"); | |
| 132 | + click(Transactor2); | |
| 133 | + forceWait(500); | |
| 134 | + click(linrong2); | |
| 135 | + selectElement(role2,"翻译人员"); | |
| 136 | + click(selectGoods); | |
| 137 | + dynamicLoad(By.xpath("//*[@class='loading ng-scope']")); | |
| 138 | + String no = DBSqlSearch("SELECT no FROM prd_goods_sku WHERE src=1 ORDER BY create_time DESC LIMIT 1","no"); | |
| 139 | + sendKeys(searchContent,no); | |
| 140 | + click(addSkuSearch); | |
| 141 | + forceWait(1000); | |
| 142 | + click(showSku); | |
| 143 | + click(skuCheckbox); | |
| 144 | + click(confirm); | |
| 145 | + forceWait(3000); | |
| 146 | + click(save); | |
| 147 | + forceWait(1000); | |
| 148 | + click(addBodyMat); | |
| 149 | + return new AddMatterialPage(driver); | |
| 150 | + } | |
| 75 | 151 | } | ... | ... |
src/main/java/com/essa/pageObject/productDev/EditBOMPage.java
0 → 100644
| ... | ... | @@ -0,0 +1,76 @@ |
| 1 | +package com.essa.pageObject.productDev; | |
| 2 | + | |
| 3 | +import com.essa.framework.BasePage; | |
| 4 | +import com.essa.framework.Model; | |
| 5 | +import org.openqa.selenium.WebDriver; | |
| 6 | +import org.openqa.selenium.WebElement; | |
| 7 | +import org.openqa.selenium.support.FindBy; | |
| 8 | + | |
| 9 | +/** | |
| 10 | +* @Description: BOM修改页面 | |
| 11 | +* @Author: ZengJin | |
| 12 | +* @CreateTime: 2018/10/29 | |
| 13 | +*/ | |
| 14 | +public class EditBOMPage extends BasePage { | |
| 15 | + /** | |
| 16 | + * 构造方法 | |
| 17 | + * | |
| 18 | + * @param driver | |
| 19 | + */ | |
| 20 | + public EditBOMPage(WebDriver driver) { | |
| 21 | + super(driver); | |
| 22 | + } | |
| 23 | + /** | |
| 24 | + * 元素定位 | |
| 25 | + */ | |
| 26 | + @FindBy (xpath = "//*[@ng-click='materialChoose()']") | |
| 27 | + WebElement matChoose;//物料选取 | |
| 28 | + | |
| 29 | + @FindBy (xpath = "//*[@name='keyword']") | |
| 30 | + WebElement keyword;//关键字查询 | |
| 31 | + | |
| 32 | + @FindBy (xpath = "//*[@name='keyword']/../span/button") | |
| 33 | + WebElement search;//查询按钮 | |
| 34 | + | |
| 35 | + @FindBy (xpath = "//*[@ng-click='materialSelected(item)']") | |
| 36 | + WebElement checkbox;//复选框 | |
| 37 | + | |
| 38 | + @FindBy (xpath = "//*[contains(text(),'选定')]") | |
| 39 | + WebElement selectedConfirm;//选定 | |
| 40 | + | |
| 41 | + @FindBy (xpath = "//*[text()='设置']") | |
| 42 | + WebElement set;//集单物料:设置 | |
| 43 | + | |
| 44 | + @FindBy (xpath = "//*[@ng-click='selectBulkMat(item)']") | |
| 45 | + WebElement selectBulkMat;//待选择的物料 | |
| 46 | + | |
| 47 | + @FindBy (xpath = "//*[@ng-click='save()']") | |
| 48 | + WebElement save;//确定修改 | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * 页面方法 | |
| 52 | + */ | |
| 53 | + /** | |
| 54 | + *编辑BOM,设置集单物料等 | |
| 55 | + * @param | |
| 56 | + * @return 项目立项书列表 | |
| 57 | + */ | |
| 58 | + public ProjectListPage editBom(){ | |
| 59 | + mywait(matChoose); | |
| 60 | + click(matChoose); | |
| 61 | + forceWait(500); | |
| 62 | + sendKeys(keyword, Model.getMaterialName()); | |
| 63 | + click(search); | |
| 64 | + forceWait(1000); | |
| 65 | + click(checkbox); | |
| 66 | + click(selectedConfirm); | |
| 67 | + forceWait(500); | |
| 68 | + click(set); | |
| 69 | + click(selectBulkMat); | |
| 70 | + click(selectedConfirm); | |
| 71 | + forceWait(500); | |
| 72 | + click(save); | |
| 73 | + return new ProjectListPage(driver); | |
| 74 | + } | |
| 75 | + | |
| 76 | +} | ... | ... |
src/main/java/com/essa/pageObject/productDev/MaterialListPage.java
0 → 100644
| ... | ... | @@ -0,0 +1,65 @@ |
| 1 | +package com.essa.pageObject.productDev; | |
| 2 | + | |
| 3 | +import com.essa.framework.BasePage; | |
| 4 | +import com.essa.framework.Model; | |
| 5 | +import org.openqa.selenium.WebDriver; | |
| 6 | +import org.openqa.selenium.WebElement; | |
| 7 | +import org.openqa.selenium.support.FindBy; | |
| 8 | + | |
| 9 | +/* | |
| 10 | +* @Description:物料列表页面 | |
| 11 | +* @Author: ZengJin | |
| 12 | +* @CreateTime: 2018/10/29 | |
| 13 | +*/ | |
| 14 | +public class MaterialListPage extends BasePage { | |
| 15 | + /** | |
| 16 | + * 构造方法 | |
| 17 | + * | |
| 18 | + * @param driver | |
| 19 | + */ | |
| 20 | + public MaterialListPage(WebDriver driver) { | |
| 21 | + super(driver); | |
| 22 | + } | |
| 23 | + /* | |
| 24 | + 元素定位 | |
| 25 | + */ | |
| 26 | + @FindBy (xpath = "//table[@id='table-material-list']//tbody/tr[1]") | |
| 27 | + WebElement firstResult;//列表第一个结果 | |
| 28 | + | |
| 29 | + @FindBy (xpath = "//*[@name='keyWord']") | |
| 30 | + WebElement keyword;//关键字查询 | |
| 31 | + | |
| 32 | + @FindBy (xpath = "//*[@name='keyWord']/../span/button") | |
| 33 | + WebElement search;//查询按钮 | |
| 34 | + | |
| 35 | + @FindBy (xpath = "//*[contains(text(),'供应商关联类型设置')]") | |
| 36 | + WebElement supplierCatConfig;//供应商关联类型设置 | |
| 37 | + | |
| 38 | + @FindBy (xpath = "//tr[@class='ng-scope active']//select[@class='form-control ng-isolate-scope ng-pristine ng-valid']") | |
| 39 | + WebElement AssociatioType;//关联类型 | |
| 40 | + | |
| 41 | + @FindBy (xpath = "//button[contains(text(),'确定')]") | |
| 42 | + WebElement confirm;//确定 | |
| 43 | + | |
| 44 | + /* | |
| 45 | + 页面方法 | |
| 46 | + */ | |
| 47 | + /** | |
| 48 | + * @Description:设置核心供应商 | |
| 49 | + * @return: 物料列表 | |
| 50 | + * @Author: ZengJin | |
| 51 | + * @CreateTime: 2018/10/29 | |
| 52 | + */ | |
| 53 | + public MaterialListPage setSupplierCatConfig(){ | |
| 54 | + mywait(firstResult); | |
| 55 | + sendKeys(keyword,Model.getMaterialName()); | |
| 56 | + click(search); | |
| 57 | + mywait(firstResult); | |
| 58 | + forceWait(1000); | |
| 59 | + click(supplierCatConfig); | |
| 60 | + forceWait(1000); | |
| 61 | + selectElement(AssociatioType,"核心供应商"); | |
| 62 | + click(confirm); | |
| 63 | + return new MaterialListPage(driver); | |
| 64 | + } | |
| 65 | +} | ... | ... |
src/main/java/com/essa/pageObject/productDev/ProjectListPage.java
0 → 100644
| ... | ... | @@ -0,0 +1,99 @@ |
| 1 | +package com.essa.pageObject.productDev; | |
| 2 | + | |
| 3 | +import com.essa.framework.BasePage; | |
| 4 | +import com.essa.framework.Model; | |
| 5 | +import com.essa.pageObject.GoodsManage.AddOriginalGoodsPage; | |
| 6 | +import org.openqa.selenium.By; | |
| 7 | +import org.openqa.selenium.WebDriver; | |
| 8 | +import org.openqa.selenium.WebElement; | |
| 9 | +import org.openqa.selenium.support.FindBy; | |
| 10 | + | |
| 11 | +/** | |
| 12 | +* @Description: 项目立项书列表页面 | |
| 13 | +* @Author: ZengJin | |
| 14 | +* @CreateTime: 2018/10/29 | |
| 15 | +*/ | |
| 16 | +public class ProjectListPage extends BasePage { | |
| 17 | + /** | |
| 18 | + * 构造方法 | |
| 19 | + * | |
| 20 | + * @param driver | |
| 21 | + */ | |
| 22 | + public ProjectListPage(WebDriver driver) { | |
| 23 | + super(driver); | |
| 24 | + } | |
| 25 | + | |
| 26 | + /** | |
| 27 | + 元素定位 | |
| 28 | + */ | |
| 29 | + @FindBy (xpath = "//table[@class='tree-grid table table-hover table-even-striped no-border border-default text-center table-fixed ng-scope ng-table']//tbody//tr[1]") | |
| 30 | + WebElement firstResult;//第一个查询结果 | |
| 31 | + | |
| 32 | + @FindBy (xpath = "//*[@name='keyWord']") | |
| 33 | + WebElement keyword;//关键字查询 | |
| 34 | + | |
| 35 | + @FindBy (xpath = "//*[@name='keyWord']/../span/button") | |
| 36 | + WebElement search;//查询按钮 | |
| 37 | + | |
| 38 | + @FindBy (xpath = "//*[@ng-click='updateBom()']") | |
| 39 | + WebElement updateBom;//BOM更新 | |
| 40 | + | |
| 41 | + @FindBy (xpath = "//*[text()='确定']") | |
| 42 | + WebElement confirm;//确定按钮 | |
| 43 | + | |
| 44 | + @FindBy (xpath = "//*[@ng-click='singleGoodsPublic()']") | |
| 45 | + WebElement DevGoodPublic;//开发单品发布 | |
| 46 | + | |
| 47 | + @FindBy (xpath = "//*[contains(text(),'不选择SPU')]") | |
| 48 | + WebElement NotChooseSpu;//不选择SPU | |
| 49 | + | |
| 50 | + @FindBy (xpath = "//*[@data-ng-bind='item.publishSkuCode']") | |
| 51 | + WebElement DevGoodNo;//开发商品编号 | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * 页面方法 | |
| 55 | + */ | |
| 56 | + /** | |
| 57 | + *BOM更新方法 | |
| 58 | + * @param | |
| 59 | + * @return 编辑BOM页面 | |
| 60 | + */ | |
| 61 | + public EditBOMPage updateBom(){ | |
| 62 | + mywait(firstResult); | |
| 63 | + sendKeys(keyword,Model.getProjectName()); | |
| 64 | + click(search); | |
| 65 | + dynamicLoad(); | |
| 66 | + click(firstResult); | |
| 67 | + click(updateBom); | |
| 68 | + return new EditBOMPage(driver); | |
| 69 | + } | |
| 70 | + | |
| 71 | + /** | |
| 72 | + *开发单品发布,由于这里只是点击一下保存,故共用新增原厂商品的一个保存方法 | |
| 73 | + * @param | |
| 74 | + * @return 确认开发商品档案页面 | |
| 75 | + */ | |
| 76 | + public AddOriginalGoodsPage publicDevGood(){ | |
| 77 | + click(confirm); | |
| 78 | + sendKeys(keyword,Model.getProjectName()); | |
| 79 | + dynamicWait(By.xpath("//table[@class='tree-grid table table-hover table-even-striped no-border border-default text-center table-fixed ng-scope ng-table']//tbody//tr[1]")); | |
| 80 | + click(search); | |
| 81 | + dynamicLoad(); | |
| 82 | + click(firstResult); | |
| 83 | + click(DevGoodPublic); | |
| 84 | + forceWait(1000); | |
| 85 | + click(NotChooseSpu); | |
| 86 | + return new AddOriginalGoodsPage(driver); | |
| 87 | + } | |
| 88 | + /** | |
| 89 | + *获取到开发商品的编号,并且传递到model的skuNo字段中 | |
| 90 | + * @param | |
| 91 | + * @return | |
| 92 | + */ | |
| 93 | + public void getDevGoodNo(){ | |
| 94 | + sendKeys(keyword,Model.getProjectName()); | |
| 95 | + click(search); | |
| 96 | + dynamicLoad(); | |
| 97 | + Model.setSkuNo(getText(DevGoodNo)); | |
| 98 | + } | |
| 99 | +} | ... | ... |
src/main/java/com/essa/testSuite/TestAddDevGood.java
0 → 100644
| ... | ... | @@ -0,0 +1,83 @@ |
| 1 | +package com.essa.testSuite; | |
| 2 | + | |
| 3 | +import com.essa.pageObject.BaseTest; | |
| 4 | +import com.essa.pageObject.GoodsManage.*; | |
| 5 | +import com.essa.pageObject.HomePage; | |
| 6 | +import com.essa.pageObject.productDev.*; | |
| 7 | +import org.openqa.selenium.WebDriver; | |
| 8 | +import org.openqa.selenium.support.PageFactory; | |
| 9 | +import org.testng.annotations.AfterClass; | |
| 10 | +import org.testng.annotations.BeforeClass; | |
| 11 | +import org.testng.annotations.Test; | |
| 12 | + | |
| 13 | + | |
| 14 | +/** | |
| 15 | +* @Description: 新增开发商品测试用例 | |
| 16 | +* @Author: ZengJin | |
| 17 | +* @CreateTime: 2018/10/29 | |
| 18 | +*/ | |
| 19 | +public class TestAddDevGood extends BaseTest { | |
| 20 | + | |
| 21 | + WebDriver driver; | |
| 22 | + | |
| 23 | + @BeforeClass | |
| 24 | + public void setUp() { | |
| 25 | + initsetUp(); | |
| 26 | + loginValid("linrong"); | |
| 27 | + } | |
| 28 | + | |
| 29 | + @AfterClass | |
| 30 | + public void tearDown() { | |
| 31 | + driver.quit(); | |
| 32 | + } | |
| 33 | + | |
| 34 | + | |
| 35 | + /** | |
| 36 | + *新增开发商品 | |
| 37 | + * @param | |
| 38 | + * @return void | |
| 39 | + */ | |
| 40 | + @Test | |
| 41 | + public void addDevGood(){ | |
| 42 | + this.driver = getDriver(); | |
| 43 | + HomePage homePage = PageFactory.initElements(driver,HomePage.class); | |
| 44 | + AddProjectPage addProjectPage = PageFactory.initElements(driver,AddProjectPage.class); | |
| 45 | + AddMatterialPage addMatterialPage = PageFactory.initElements(driver,AddMatterialPage.class); | |
| 46 | + MaterialListPage materialListPage = PageFactory.initElements(driver,MaterialListPage.class); | |
| 47 | + ProjectListPage projectListPage = PageFactory.initElements(driver,ProjectListPage.class); | |
| 48 | + EditBOMPage editBOMPage = PageFactory.initElements(driver,EditBOMPage.class); | |
| 49 | + AddOriginalGoodsPage addOriginalGoodsPage = PageFactory.initElements(driver,AddOriginalGoodsPage.class); | |
| 50 | + homePage.toAddProject(); | |
| 51 | + addProjectPage.addProject();//新增立项书 | |
| 52 | + addMatterialPage.addBodyMat();//新增光身物料 | |
| 53 | + homePage.toMaterialPage(); | |
| 54 | + addMatterialPage.addMaterial();//新增物料 | |
| 55 | + materialListPage.setSupplierCatConfig();//设置核心供应商 | |
| 56 | + homePage.toProjectListPage(); | |
| 57 | + projectListPage.updateBom();//更新BOM | |
| 58 | + editBOMPage.editBom();//编辑BOM,设置集单物料 | |
| 59 | + projectListPage.publicDevGood();//发布开发单品 | |
| 60 | + addOriginalGoodsPage.addDevGood();//确认发布开发商品 | |
| 61 | + projectListPage.getDevGoodNo();//将新增的skuNo传递到model | |
| 62 | + } | |
| 63 | + /** | |
| 64 | + *审核开发商品 | |
| 65 | + * @param | |
| 66 | + * @return | |
| 67 | + */ | |
| 68 | + @Test | |
| 69 | + public void publicDevGood(){ | |
| 70 | + this.driver = getDriver(); | |
| 71 | + HomePage homePage = PageFactory.initElements(driver,HomePage.class); | |
| 72 | + GoodsRelesePage goodsRelesePage = PageFactory.initElements(driver,GoodsRelesePage.class); | |
| 73 | + UpdatePicPage updatePicPage = PageFactory.initElements(driver,UpdatePicPage.class); | |
| 74 | + AuditDevGoodsPage auditDevGoodsPage = PageFactory.initElements(driver,AuditDevGoodsPage.class); | |
| 75 | + AuditOriginalOpreatePage auditOriginalOpreatePage = PageFactory.initElements(driver,AuditOriginalOpreatePage.class); | |
| 76 | + homePage.tGoodsRelesePage(); | |
| 77 | + goodsRelesePage.toUpdateDevGoodPic();//更新开发商品图片 | |
| 78 | + updatePicPage.upDatePic(); | |
| 79 | + homePage.toAuditDevgoodsPage();//进入开发商品发布审核 | |
| 80 | + auditDevGoodsPage.auditDevGood(); | |
| 81 | + auditOriginalOpreatePage.auditDevGoodPass();//审核通过 | |
| 82 | + } | |
| 83 | +} | ... | ... |
src/main/java/swing/SwingMain.java
| ... | ... | @@ -565,7 +565,8 @@ public class SwingMain { |
| 565 | 565 | List<String> suites = new ArrayList<String>(); |
| 566 | 566 | if (Scene == "新增原厂商品") { |
| 567 | 567 | AddOriginalGoodsPage.setSupplierName(supplierName.getText()); |
| 568 | - UpdatePicPage.setPicPath(picPath.getText()); | |
| 568 | +// UpdatePicPage.setPicPath(picPath.getText()); | |
| 569 | + Model.setPicPath(picPath.getText()); | |
| 569 | 570 | suites.add(SuitesEnum.ADD_ORIGINAL_GOODS.getSuiteName()); |
| 570 | 571 | // suites.add(".\\resources\\suites\\addOriginalGoods.xml");// 图形界面 |
| 571 | 572 | } else if (Scene == "新增市场商品") { |
| ... | ... | @@ -576,7 +577,8 @@ public class SwingMain { |
| 576 | 577 | // suites.add(".\\resources\\suites\\addMarketGoods.xml");// 图形界面 |
| 577 | 578 | } else if (Scene == "发布团购") { |
| 578 | 579 | AddOriginalGoodsPage.setSupplierName(supplierName.getText()); |
| 579 | - UpdatePicPage.setPicPath(picPath.getText()); | |
| 580 | +// UpdatePicPage.setPicPath(picPath.getText()); | |
| 581 | + Model.setPicPath(picPath.getText()); | |
| 580 | 582 | suites.add(SuitesEnum.PUBLISH_GROUP_PURCHASE.getSuiteName()); |
| 581 | 583 | // suites.add(".\\resources\\suites\\publishGroupPurchase.xml");// 图形界面 |
| 582 | 584 | } else if (Scene == "采购商注册") { | ... | ... |
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | |
| 3 | +<suite name="新增开发商品"> | |
| 4 | + <test name="addDevGoods"> | |
| 5 | + <classes> | |
| 6 | + <class name="com.essa.testSuite.TestAddDevGood"> | |
| 7 | + <methods> | |
| 8 | + <include name="addDevGood" /> | |
| 9 | + <include name="publicDevGood" /> | |
| 10 | + </methods> | |
| 11 | + </class> | |
| 12 | + </classes> | |
| 13 | + </test> | |
| 14 | +</suite> | |
| 15 | + | ... | ... |