diff --git a/src/main/java/com/essa/pageObject/DocumentaryManage/POBoardPage.java b/src/main/java/com/essa/pageObject/DocumentaryManage/POBoardPage.java index 04de8e8..3fb8386 100644 --- a/src/main/java/com/essa/pageObject/DocumentaryManage/POBoardPage.java +++ b/src/main/java/com/essa/pageObject/DocumentaryManage/POBoardPage.java @@ -118,4 +118,168 @@ public class POBoardPage extends BasePage { return isVisibility(By.xpath("//*[contains(text(),'装柜中')]")); } + public static class ReceiptCorePage extends BasePage { + + public ReceiptCorePage(WebDriver driver) { super(driver);} + + /* + * 页面元素定位 + * */ + + @FindBy (xpath = "//i[@class='iconfont icon-double-arrow-right']") + // @FindBy (xpath = "//*[contains(text(),'高级查询')]") + WebElement advancedQuery; //高级查询 + + @FindBy (xpath = "/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/form[2]/div[5]/div[1]/input[1]") + // @FindBy (xpath = "//input[@type='text' and @ng-model='query.params.poCode']") + + WebElement PO_numbers; //PO单号 + + @FindBy (xpath = "//*[text()='查询']") + // @FindBy (xpath = "//*/button[@type='submit']") + + WebElement Query ; //查询 + + @FindBy (xpath = "//tbody//tr[1]") + // @FindBy (xpath = "//*[@id=\"frontSendListCtrlView\"]/div/div/table/tbody/tr[1]") + + WebElement list_1; //列表第一条数据 + + @FindBy (xpath = "/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/table[1]/tbody[1]") + + WebElement list; //列表 + + @FindBy (xpath = "/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/table[1]/tbody[1]/tr[1]/td[1]") + + WebElement document_code; //单据编号 + + @FindBy (xpath = "//*[text()='开始发单']") + // @FindBy (xpath = "/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/button[1]") + + WebElement start_billing; // 开始发单 + + @FindBy (xpath = "//button[@class='btn btn-danger ng-scope']") + + WebElement start_billing_1 ; //前台发单扫码平台的开始发单 + + @FindBy (xpath = "//div[@class='input-group ng-isolate-scope ng-pristine ng-valid']//input[@type='text']") + + WebElement input_document_code;//单据编号输入框 + + @FindBy (xpath = "//button[@type='button' and @ng-click='clickBtn()']") + // @FindBy (xpath = "//*[contains(@ng-click,'clickBtn')]") + + WebElement search ;// 搜索按钮 + + @FindBy (xpath = "//a[contains(text(),'扫码确认接单')]") + + WebElement Confirm_billing ; // 扫码确认接单 + + @FindBy (xpath = "//*[text()='接单完成']") + + WebElement finish_billing; //接单完成 + + @FindBy (xpath = "//*[contains(text(),'所选的工厂订单状态必须为“制单中”或“重新发单”')]") + + WebElement Fail_billing; //发单失败 + + @FindBy (xpath = "//*[contains(text(),'所选的工厂订单状态必须为“发单中”')]") + + //*[coantains(text(),'所选的工厂订单状态必须为'] + // *[@data-notify='message'] + //*[@data-notify='message'] and text()='所选的工厂订单状态必须为“发单中”' + //*[(text()=' 所选的工厂订单状态必须为“发单中”'] + + WebElement Fail_order; //接单失败 + + @FindBy (xpath = "//*[contains(text(),'操作成功')]") + + WebElement Succeed_billing; //发单成功 + + + + + + /* + * 页面方法 + * */ + + public void BillOrder(String PO_Code) { + click(advancedQuery); + forceWait(1000); + + sendKeys(PO_numbers,PO_Code); + forceWait(1000); + + click(Query); + // forceWait(3000); + + dynamicWait(By.xpath("/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/table[1]/tbody[1]")); + + // actionDoubleClick(document_code); // 双击元素 + // forceWait(1000); + String Fo = document_code.getText(); + forceWait(1000); + + click(start_billing); + forceWait(1000); + sendKeys(input_document_code,Fo); + forceWait(1000); + + click(search); + forceWait(1000); + + click(start_billing_1); + forceWait(1000); + // isVisibility(By.xpath("//*[contains(text(),'所选的工厂订单状态必须为“发单中”')]")); + + click(start_billing); + forceWait(1000); + + click(Confirm_billing); + forceWait(1000); + + sendKeys(input_document_code,Fo); + forceWait(1000); + + click(search); + forceWait(1000); + + click(finish_billing); + forceWait(3000); + + + + } + + + /* + *用于断言发单接单是否成功 + * @return boolean + */ + + public boolean isSucceed() {return isElementExist(Succeed_billing);} + + /* + *用于断言发单是否成功 + * @return boolean + */ + + public boolean FailBilling() {return isElementExist(Fail_billing);} + + /* + *用于断言接单是否成功 + * @return boolean + */ + + + public boolean FailOrder() {return isElementExist(Fail_order);} + + + + + + + + } } diff --git a/src/main/java/com/essa/pageObject/HomePage.java b/src/main/java/com/essa/pageObject/HomePage.java index f96c1c8..0fd068f 100644 --- a/src/main/java/com/essa/pageObject/HomePage.java +++ b/src/main/java/com/essa/pageObject/HomePage.java @@ -1,6 +1,6 @@ package com.essa.pageObject; -import com.essa.pageObject.ReceiptCore.ReceiptCorePage; +import com.essa.pageObject.DocumentaryManage.POBoardPage; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; @@ -435,9 +435,9 @@ public class HomePage extends BasePage{ /* * 进入前台发单中心页面 * */ - public ReceiptCorePage toReceiptCore() { + public POBoardPage.ReceiptCorePage toReceiptCore() { click(DocumentaryManage); click(Receipt_core); - return new ReceiptCorePage(driver); + return new POBoardPage.ReceiptCorePage(driver); } } \ No newline at end of file diff --git a/src/main/java/com/essa/pageObject/ReceiptCore/ReceiptCorePage.java b/src/main/java/com/essa/pageObject/ReceiptCore/ReceiptCorePage.java deleted file mode 100644 index cbd92d9..0000000 --- a/src/main/java/com/essa/pageObject/ReceiptCore/ReceiptCorePage.java +++ /dev/null @@ -1,177 +0,0 @@ -package com.essa.pageObject.ReceiptCore; -import com.essa.framework.BasePage; -import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.FindBy; - - -/* - * 前台发单中心页面 - * */ - - -public class ReceiptCorePage extends BasePage { - - public ReceiptCorePage(WebDriver driver) { super(driver);} - - /* - * 页面元素定位 - * */ - - @FindBy (xpath = "//i[@class='iconfont icon-double-arrow-right']") -// @FindBy (xpath = "//*[contains(text(),'高级查询')]") - WebElement advancedQuery; //高级查询 - - @FindBy (xpath = "/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/form[2]/div[5]/div[1]/input[1]") -// @FindBy (xpath = "//input[@type='text' and @ng-model='query.params.poCode']") - - WebElement PO_numbers; //PO单号 - - @FindBy (xpath = "//*[text()='查询']") -// @FindBy (xpath = "//*/button[@type='submit']") - - WebElement Query ; //查询 - - @FindBy (xpath = "//tbody//tr[1]") -// @FindBy (xpath = "//*[@id=\"frontSendListCtrlView\"]/div/div/table/tbody/tr[1]") - - WebElement list_1; //列表第一条数据 - - @FindBy (xpath = "/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/table[1]/tbody[1]") - - WebElement list; //列表 - - @FindBy (xpath = "/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/table[1]/tbody[1]/tr[1]/td[1]") - - WebElement document_code; //单据编号 - - @FindBy (xpath = "//*[text()='开始发单']") -// @FindBy (xpath = "/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/button[1]") - - WebElement start_billing; // 开始发单 - - @FindBy (xpath = "//button[@class='btn btn-danger ng-scope']") - - WebElement start_billing_1 ; //前台发单扫码平台的开始发单 - - @FindBy (xpath = "//div[@class='input-group ng-isolate-scope ng-pristine ng-valid']//input[@type='text']") - - WebElement input_document_code;//单据编号输入框 - - @FindBy (xpath = "//button[@type='button' and @ng-click='clickBtn()']") -// @FindBy (xpath = "//*[contains(@ng-click,'clickBtn')]") - - WebElement search ;// 搜索按钮 - - @FindBy (xpath = "//a[contains(text(),'扫码确认接单')]") - - WebElement Confirm_billing ; // 扫码确认接单 - - @FindBy (xpath = "//*[text()='接单完成']") - - WebElement finish_billing; //接单完成 - - @FindBy (xpath = "//*[contains(text(),'所选的工厂订单状态必须为“制单中”或“重新发单”')]") - - WebElement Fail_billing; //发单失败 - - @FindBy (xpath = "//*[contains(text(),'所选的工厂订单状态必须为“发单中”')]") - - //*[coantains(text(),'所选的工厂订单状态必须为'] - // *[@data-notify='message'] - //*[@data-notify='message'] and text()='所选的工厂订单状态必须为“发单中”' - //*[(text()=' 所选的工厂订单状态必须为“发单中”'] - - WebElement Fail_order; //接单失败 - - @FindBy (xpath = "//*[contains(text(),'操作成功')]") - - WebElement Succeed_billing; //发单成功 - - - - - - /* - * 页面方法 - * */ - - public void BillOrder(String PO_Code) { - click(advancedQuery); - forceWait(1000); - - sendKeys(PO_numbers,PO_Code); - forceWait(1000); - - click(Query); -// forceWait(3000); - - dynamicWait(By.xpath("/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/table[1]/tbody[1]")); - -// actionDoubleClick(document_code); // 双击元素 -// forceWait(1000); - String Fo = document_code.getText(); - forceWait(1000); - - click(start_billing); - forceWait(1000); - sendKeys(input_document_code,Fo); - forceWait(1000); - - click(search); - forceWait(1000); - - click(start_billing_1); - forceWait(1000); -// isVisibility(By.xpath("//*[contains(text(),'所选的工厂订单状态必须为“发单中”')]")); - - click(start_billing); - forceWait(1000); - - click(Confirm_billing); - forceWait(1000); - - sendKeys(input_document_code,Fo); - forceWait(1000); - - click(search); - forceWait(1000); - - click(finish_billing); - forceWait(3000); - - - - } - - - /* - *用于断言发单接单是否成功 - * @return boolean - */ - - public boolean isSucceed() {return isElementExist(Succeed_billing);} - - /* - *用于断言发单是否成功 - * @return boolean - */ - - public boolean FailBilling() {return isElementExist(Fail_billing);} - - /* - *用于断言接单是否成功 - * @return boolean - */ - - - public boolean FailOrder() {return isElementExist(Fail_order);} - - - - - - - -} diff --git a/src/main/java/com/essa/testSuite/TestReceiptCore.java b/src/main/java/com/essa/testSuite/TestReceiptCore.java index 86de910..0ebf348 100644 --- a/src/main/java/com/essa/testSuite/TestReceiptCore.java +++ b/src/main/java/com/essa/testSuite/TestReceiptCore.java @@ -1,8 +1,8 @@ package com.essa.testSuite; import com.essa.framework.LinkSQL; import com.essa.pageObject.BaseTest; +import com.essa.pageObject.DocumentaryManage.POBoardPage; import com.essa.pageObject.HomePage; -import com.essa.pageObject.ReceiptCore.ReceiptCorePage; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.PageFactory; import org.testng.annotations.AfterClass; @@ -10,6 +10,7 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.testng.asserts.SoftAssert; +// 跟单管理 public class TestReceiptCore extends BaseTest { WebDriver driver ; @@ -31,7 +32,7 @@ public class TestReceiptCore extends BaseTest { this.driver = getDriver(); HomePage homePage = PageFactory.initElements(driver,HomePage.class); homePage.toReceiptCore(); - ReceiptCorePage receiptCorePage = PageFactory.initElements(driver,ReceiptCorePage.class); + POBoardPage.ReceiptCorePage receiptCorePage = PageFactory.initElements(driver,POBoardPage.ReceiptCorePage.class); String PO = LinkSQL.SQLQuery(); receiptCorePage.BillOrder(PO); -- libgit2 0.21.2