diff --git a/src/main/java/com/essa/pageObject/PODocumentary/POBoardPage.java b/src/main/java/com/essa/pageObject/PODocumentary/POBoardPage.java new file mode 100644 index 0000000..036c1c5 --- /dev/null +++ b/src/main/java/com/essa/pageObject/PODocumentary/POBoardPage.java @@ -0,0 +1,84 @@ +package com.essa.pageObject.PODocumentary; + +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import com.essa.framework.BasePage; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +import java.util.Date; + +/** + * @author Administrator + *PO详情页 + */ +public class POBoardPage extends BasePage { + + public POBoardPage(WebDriver driver) { super(driver); } + + /* + * 元素定位 + */ + @FindBy (xpath = "//*[contains(text(),'通知收货')]") + WebElement NoticeReceipt;//通知收货 + + @FindBy (xpath = "//div[@class='col-sm-16']//input[@type='text']") + WebElement receiptDate;//选择收货日期 + + @FindBy (xpath = "//input[@name='newDate']") + WebElement loadingDate;//选择装柜日期 + + @FindBy (xpath = "//*[contains(text(),'确定')]") + WebElement submit;//提交 + + @FindBy (xpath = "//div[@class='bootbox modal fade in']") + WebElement BlankPlace;//点击空白处 + + @FindBy (xpath = "//*[contains(text(),'通知装柜')]") + WebElement NotificationLoading;//通知装柜 + + //通知收货 + public POBoardPage toNoticeReceipt() { + click(NoticeReceipt); + jsExecutorRemoveAttribute(receiptDate,"readonly"); + String Receiptdate = getDateTimeByFormat(new Date(), "MM/dd/yyyy"); + sendKeys(receiptDate,Receiptdate); + click(BlankPlace); + click(submit); + forceWait(4000); + + return new POBoardPage(driver); + } + + /** + * 判断通知收货是否成功 + * @return boolean + */ + public boolean isNoticeReceipt (){ + forceWait(2000); + return isVisibility(By.xpath("//*[contains(text(),'收货中')]")); + } + + + //通知装柜 + public POBoardPage toNotificationLoading(){ + click(NotificationLoading); + jsExecutorRemoveAttribute(loadingDate,"readonly"); + String Loadingdate = getDateTimeByFormat(new Date(), "MM/dd/yyyy"); + sendKeys(loadingDate,Loadingdate); + click(BlankPlace); + click(submit); + forceWait(4000); + + return new POBoardPage(driver); + } + + /** + * 判断通知装柜是否成功 + * @return boolean + */ + public boolean isNotificationLoading(){ + forceWait(2000); + return isVisibility(By.xpath("//*[contains(text(),'装柜中')]")); + } +} \ No newline at end of file diff --git a/src/main/java/com/essa/pageObject/PODocumentary/PODocumentaryListPage.java b/src/main/java/com/essa/pageObject/PODocumentary/PODocumentaryListPage.java new file mode 100644 index 0000000..ef690ab --- /dev/null +++ b/src/main/java/com/essa/pageObject/PODocumentary/PODocumentaryListPage.java @@ -0,0 +1,53 @@ +package com.essa.pageObject.PODocumentary; + +import com.essa.framework.Model; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +import com.essa.framework.BasePage; + +/** + * @author Administrator + *PO跟单任务列表页面 + */ +public class PODocumentaryListPage extends BasePage { + + public PODocumentaryListPage(WebDriver driver) { + super(driver); + } + + /* + * 元素定位 + */ + @FindBy (xpath = "//*[text()='跟单管理']") + WebElement DocumentaryManage;//跟单管理 + + @FindBy (xpath ="//*[text()='PO跟单']") + WebElement PODocumentary;//PO跟单 + + @FindBy (xpath = "//*[@placeholder='请输入PO单号、客户编号等关键字查询']") + WebElement OrderNo;//输入PO单号 + + @FindBy (xpath = "//*[@ng-click='search()']") + WebElement searchPO;//搜索 + + @FindBy (xpath = "//*[contains(text(),'查看详情')]") + WebElement detail;//查看详情 + + /** + * 搜索PO单查看详情 + */ + + public PODocumentaryListPage toPoDocumentaryListPage(){ + click(DocumentaryManage); + click(PODocumentary); + sendKeys(OrderNo,Model.getPoNum()); + forceWait(2000); + click(searchPO); + forceWait(2000); + click(detail); + forceWait(7000); + return new PODocumentaryListPage(driver); + } +} diff --git a/src/main/java/com/essa/testSuite/TsetNoticeReceipt.java b/src/main/java/com/essa/testSuite/TsetNoticeReceipt.java new file mode 100644 index 0000000..25d3113 --- /dev/null +++ b/src/main/java/com/essa/testSuite/TsetNoticeReceipt.java @@ -0,0 +1,59 @@ +package com.essa.testSuite; + +import com.essa.pageObject.BaseTest; +import com.essa.pageObject.PODocumentary.POBoardPage; +import com.essa.pageObject.PODocumentary.PODocumentaryListPage; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.PageFactory; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import org.testng.asserts.SoftAssert; + +import java.io.IOException; + + +/** + * @author Administrator + *测试用例:通知收货 + */ +public class TsetNoticeReceipt extends BaseTest { + + WebDriver driver; + + @BeforeClass + public void setUp() throws IOException{ + initsetUp(); + loginValid("chenyijie"); + } + + @AfterClass + public void tearDown() { driver.quit(); } + + + /** + * 操作 + * + * @throws InterruptedException + */ + @Test(description="查找PO单") + public void TsetNoticeReceipt(){ + this.driver = getDriver(); + PODocumentaryListPage poDocumentaryListPage = PageFactory.initElements(driver,PODocumentaryListPage.class); + POBoardPage poBoardPage = PageFactory.initElements(driver,POBoardPage.class); + poDocumentaryListPage.toPoDocumentaryListPage(); + poBoardPage.toNoticeReceipt(); + //通知收货是否成功 + boolean actualReceipt = poBoardPage.isNoticeReceipt(); + SoftAssert ftAssert =new SoftAssert(); + ftAssert.assertEquals(actualReceipt,true,"通知收货失败"); + + + poBoardPage.toNotificationLoading(); + //通知装柜是否成功 + boolean actualLoading = poBoardPage.isNotificationLoading(); + SoftAssert softAssert =new SoftAssert(); + softAssert.assertEquals(actualLoading,true,"通知装柜失败"); + } + +} -- libgit2 0.21.2