Commit a0824d2dc071136de903eaf79a234d0ea59e7a3b

Authored by toby5221
1 parent 2e89392c

啊啊啊

src/main/java/com/essa/pageObject/PODocumentary/POBoardPage.java
... ... @@ -8,6 +8,8 @@ import com.essa.framework.BasePage;
8 8 import org.openqa.selenium.WebElement;
9 9 import org.openqa.selenium.support.FindBy;
10 10  
  11 +import java.util.Date;
  12 +
11 13 public class POBoardPage extends BasePage {
12 14  
13 15 public POBoardPage(WebDriver driver) {
... ... @@ -31,11 +33,34 @@ public class POBoardPage extends BasePage {
31 33 @FindBy (xpath ="//button[contains(text(),'转在途尾货')]")
32 34 WebElement toTail;//转在途尾货按钮
33 35  
  36 + // 通知收货
34 37 @FindBy (xpath = "//button[contains(text(),'通知收货')]")
35   - WebElement noticeReceive;//通知收货按钮
  38 + WebElement noticeReceive;
  39 +
  40 + //收货日期
  41 + @FindBy (xpath = "//*[contains(text(),'收货日期')]") ///label[@class='control-label col-sm-8']
  42 + WebElement reveiveDate;
  43 +
  44 + // 收货日期输入框
  45 + @FindBy (xpath = " //div[@class='col-sm-16']//input[@type='text']")
  46 + WebElement inputReceiveDate;
  47 +
  48 + // 确定
  49 + @FindBy (xpath = "//button[contains(text(),'确定')]")
  50 + WebElement submit;
  51 +
  52 + // 通知装柜
  53 + @FindBy(xpath = "//button[contains(text(),'通知装柜')]")
  54 + WebElement noticeLoad;
  55 +
  56 + // 装柜日期空白处
  57 + @FindBy(xpath = " //label[@class='control-label col-md-8']")
  58 + WebElement loadDate;
  59 +
  60 + // 装柜日期输入框
  61 + @FindBy (xpath = "//input[@name='newDate']")
  62 + WebElement inutLoadDate;
36 63  
37   - @FindBy(xpath ="//button[contains(text(),'通知装柜')]")
38   - WebElement noticeLoad;//通知装柜按钮
39 64  
40 65 /*
41 66 * 页面方法
... ... @@ -55,4 +80,32 @@ public class POBoardPage extends BasePage {
55 80 click(toTail);
56 81 return new ConvertTailPage(driver);
57 82 }
  83 +
  84 + /**
  85 + * PO通知收货和通知装柜
  86 + */
  87 + // 通知收货
  88 + public POBoardPage noticeReceive(){
  89 + click(noticeReceive);
  90 + jsExecutorRemoveAttribute(inputReceiveDate,"readonly");
  91 + String date = getDateTimeByFormat(new Date(),"MM/dd/yyyy");
  92 + sendKeys(inputReceiveDate,date);
  93 + click(reveiveDate);
  94 + click(submit);
  95 + forceWait(3000);
  96 + return new POBoardPage(driver);
  97 + }
  98 +
  99 + //通知装柜
  100 + public POBoardPage noticeLoad(){
  101 + click(noticeLoad);
  102 + jsExecutorRemoveAttribute(inutLoadDate,"readonly");
  103 + String date = getDateTimeByFormat(new Date(),"MM/dd/yyyy");
  104 + sendKeys(inutLoadDate,date);
  105 + click(loadDate);
  106 + forceWait(3000);
  107 + click(submit);
  108 + forceWait(2000);
  109 + return new POBoardPage(driver);
  110 + }
58 111 }
... ...
src/main/java/com/essa/pageObject/PODocumentary/PODocumentaryListPage.java
... ... @@ -33,6 +33,18 @@ public class PODocumentaryListPage extends BasePage {
33 33 @FindBy (xpath = "//*[@id='listView']/div/table/tbody/tr[1]/td/div/div[1]/div/ul/li[1]/a")
34 34 WebElement detail;//搜索结果中的一个查看详情
35 35  
  36 + // 关键字查询
  37 + @FindBy (xpath = "//*[contains(@placeholder,'请输入PO单号、客户编号等关键字查询')]")
  38 + WebElement keySearch;
  39 +
  40 + // 放大镜查询按钮
  41 + @FindBy (xpath = "//*[contains(@ng-click,'search()')]")
  42 + WebElement magnifierSearch;
  43 +
  44 + // 查看详情
  45 + @FindBy (xpath = "//*[contains(text(),'查看详情')]")
  46 + WebElement followDetail;
  47 +
36 48 /*
37 49 * 页面方法
38 50 */
... ... @@ -45,4 +57,19 @@ public class PODocumentaryListPage extends BasePage {
45 57 click(detail);
46 58 return new POBoardPage(driver);
47 59 }
  60 +
  61 + /**
  62 + * 进入PO跟单详情
  63 + * @return
  64 + */
  65 + public PODocumentaryListPage toPoFollowDetail(){
  66 + sendKeys(keySearch, Model.getPoNum());
  67 + click(magnifierSearch);
  68 + forceWait(5000);
  69 + dynamicWait(By.xpath("//div[@class='row xxrow-header-bg row-border-bottom no-margin padding-horizontal-5']"));
  70 + click(followDetail);
  71 + forceWait(5000);
  72 + dynamicWait(By.xpath("//div[@class='panel-body']"));
  73 + return new PODocumentaryListPage(driver);
  74 + }
48 75 }
... ...
src/main/java/com/essa/testSuite/TestNoticeReceiveAndLoad.java
1 1 package com.essa.testSuite;
2 2  
3 3 import com.essa.pageObject.BaseTest;
  4 +import com.essa.pageObject.HomePage;
  5 +import com.essa.pageObject.PODocumentary.POBoardPage;
  6 +import com.essa.pageObject.PODocumentary.PODocumentaryListPage;
4 7 import org.openqa.selenium.WebDriver;
  8 +import org.openqa.selenium.support.PageFactory;
5 9 import org.testng.annotations.AfterClass;
6 10 import org.testng.annotations.BeforeClass;
7 11 import org.testng.annotations.Test;
... ... @@ -22,11 +26,18 @@ public class TestNoticeReceiveAndLoad extends BaseTest{
22 26 }
23 27  
24 28 /**
25   - * 通知收货和通知装柜
  29 + * 通知收货装柜
26 30 */
27   - @Test(description = "通知收货和通知装柜")
  31 + @Test(description = "通知收货装柜")
28 32 public void NoticeReceiveAndLoad(){
29 33 this.driver = getDriver();
30   -
  34 + HomePage homePage = PageFactory.initElements(driver,HomePage.class);
  35 + homePage.toPoDocumentaryListPage();
  36 + PODocumentaryListPage poDocumentaryListPage = PageFactory.initElements(driver,PODocumentaryListPage.class);
  37 + POBoardPage poBoardPage = PageFactory.initElements(driver,POBoardPage.class);
  38 + poDocumentaryListPage.toPoFollowDetail();
  39 + poBoardPage.noticeReceive();
  40 + poBoardPage.noticeLoad();
31 41 }
  42 +
32 43 }
... ...