Commit a90375bd8161dd0d4e6e6efe90529186c40e3b16

Authored by huangyuanbo914@163.com
1 parent 3cd81127

huangyuanbo

src/main/java/com/essa/pageObject/DocumentaryManage/POBoardPage.java
... ... @@ -118,4 +118,168 @@ public class POBoardPage extends BasePage {
118 118 return isVisibility(By.xpath("//*[contains(text(),'装柜中')]"));
119 119 }
120 120  
  121 + public static class ReceiptCorePage extends BasePage {
  122 +
  123 + public ReceiptCorePage(WebDriver driver) { super(driver);}
  124 +
  125 + /*
  126 + * 页面元素定位
  127 + * */
  128 +
  129 + @FindBy (xpath = "//i[@class='iconfont icon-double-arrow-right']")
  130 + // @FindBy (xpath = "//*[contains(text(),'高级查询')]")
  131 + WebElement advancedQuery; //高级查询
  132 +
  133 + @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]")
  134 + // @FindBy (xpath = "//input[@type='text' and @ng-model='query.params.poCode']")
  135 +
  136 + WebElement PO_numbers; //PO单号
  137 +
  138 + @FindBy (xpath = "//*[text()='查询']")
  139 + // @FindBy (xpath = "//*/button[@type='submit']")
  140 +
  141 + WebElement Query ; //查询
  142 +
  143 + @FindBy (xpath = "//tbody//tr[1]")
  144 + // @FindBy (xpath = "//*[@id=\"frontSendListCtrlView\"]/div/div/table/tbody/tr[1]")
  145 +
  146 + WebElement list_1; //列表第一条数据
  147 +
  148 + @FindBy (xpath = "/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/table[1]/tbody[1]")
  149 +
  150 + WebElement list; //列表
  151 +
  152 + @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]")
  153 +
  154 + WebElement document_code; //单据编号
  155 +
  156 + @FindBy (xpath = "//*[text()='开始发单']")
  157 + // @FindBy (xpath = "/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/button[1]")
  158 +
  159 + WebElement start_billing; // 开始发单
  160 +
  161 + @FindBy (xpath = "//button[@class='btn btn-danger ng-scope']")
  162 +
  163 + WebElement start_billing_1 ; //前台发单扫码平台的开始发单
  164 +
  165 + @FindBy (xpath = "//div[@class='input-group ng-isolate-scope ng-pristine ng-valid']//input[@type='text']")
  166 +
  167 + WebElement input_document_code;//单据编号输入框
  168 +
  169 + @FindBy (xpath = "//button[@type='button' and @ng-click='clickBtn()']")
  170 + // @FindBy (xpath = "//*[contains(@ng-click,'clickBtn')]")
  171 +
  172 + WebElement search ;// 搜索按钮
  173 +
  174 + @FindBy (xpath = "//a[contains(text(),'扫码确认接单')]")
  175 +
  176 + WebElement Confirm_billing ; // 扫码确认接单
  177 +
  178 + @FindBy (xpath = "//*[text()='接单完成']")
  179 +
  180 + WebElement finish_billing; //接单完成
  181 +
  182 + @FindBy (xpath = "//*[contains(text(),'所选的工厂订单状态必须为“制单中”或“重新发单”')]")
  183 +
  184 + WebElement Fail_billing; //发单失败
  185 +
  186 + @FindBy (xpath = "//*[contains(text(),'所选的工厂订单状态必须为“发单中”')]")
  187 +
  188 + //*[coantains(text(),'所选的工厂订单状态必须为']
  189 + // *[@data-notify='message']
  190 + //*[@data-notify='message'] and text()='所选的工厂订单状态必须为“发单中”'
  191 + //*[(text()=' 所选的工厂订单状态必须为“发单中”']
  192 +
  193 + WebElement Fail_order; //接单失败
  194 +
  195 + @FindBy (xpath = "//*[contains(text(),'操作成功')]")
  196 +
  197 + WebElement Succeed_billing; //发单成功
  198 +
  199 +
  200 +
  201 +
  202 +
  203 + /*
  204 + * 页面方法
  205 + * */
  206 +
  207 + public void BillOrder(String PO_Code) {
  208 + click(advancedQuery);
  209 + forceWait(1000);
  210 +
  211 + sendKeys(PO_numbers,PO_Code);
  212 + forceWait(1000);
  213 +
  214 + click(Query);
  215 + // forceWait(3000);
  216 +
  217 + 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]"));
  218 +
  219 + // actionDoubleClick(document_code); // 双击元素
  220 + // forceWait(1000);
  221 + String Fo = document_code.getText();
  222 + forceWait(1000);
  223 +
  224 + click(start_billing);
  225 + forceWait(1000);
  226 + sendKeys(input_document_code,Fo);
  227 + forceWait(1000);
  228 +
  229 + click(search);
  230 + forceWait(1000);
  231 +
  232 + click(start_billing_1);
  233 + forceWait(1000);
  234 + // isVisibility(By.xpath("//*[contains(text(),'所选的工厂订单状态必须为“发单中”')]"));
  235 +
  236 + click(start_billing);
  237 + forceWait(1000);
  238 +
  239 + click(Confirm_billing);
  240 + forceWait(1000);
  241 +
  242 + sendKeys(input_document_code,Fo);
  243 + forceWait(1000);
  244 +
  245 + click(search);
  246 + forceWait(1000);
  247 +
  248 + click(finish_billing);
  249 + forceWait(3000);
  250 +
  251 +
  252 +
  253 + }
  254 +
  255 +
  256 + /*
  257 + *用于断言发单接单是否成功
  258 + * @return boolean
  259 + */
  260 +
  261 + public boolean isSucceed() {return isElementExist(Succeed_billing);}
  262 +
  263 + /*
  264 + *用于断言发单是否成功
  265 + * @return boolean
  266 + */
  267 +
  268 + public boolean FailBilling() {return isElementExist(Fail_billing);}
  269 +
  270 + /*
  271 + *用于断言接单是否成功
  272 + * @return boolean
  273 + */
  274 +
  275 +
  276 + public boolean FailOrder() {return isElementExist(Fail_order);}
  277 +
  278 +
  279 +
  280 +
  281 +
  282 +
  283 +
  284 + }
121 285 }
... ...
src/main/java/com/essa/pageObject/HomePage.java
1 1 package com.essa.pageObject;
2 2  
3   -import com.essa.pageObject.ReceiptCore.ReceiptCorePage;
  3 +import com.essa.pageObject.DocumentaryManage.POBoardPage;
4 4 import org.openqa.selenium.WebDriver;
5 5 import org.openqa.selenium.WebElement;
6 6 import org.openqa.selenium.support.FindBy;
... ... @@ -435,9 +435,9 @@ public class HomePage extends BasePage{
435 435 /*
436 436 * 进入前台发单中心页面
437 437 * */
438   - public ReceiptCorePage toReceiptCore() {
  438 + public POBoardPage.ReceiptCorePage toReceiptCore() {
439 439 click(DocumentaryManage);
440 440 click(Receipt_core);
441   - return new ReceiptCorePage(driver);
  441 + return new POBoardPage.ReceiptCorePage(driver);
442 442 }
443 443 }
444 444 \ No newline at end of file
... ...
src/main/java/com/essa/pageObject/ReceiptCore/ReceiptCorePage.java deleted
... ... @@ -1,177 +0,0 @@
1   -package com.essa.pageObject.ReceiptCore;
2   -import com.essa.framework.BasePage;
3   -import org.openqa.selenium.By;
4   -import org.openqa.selenium.WebDriver;
5   -import org.openqa.selenium.WebElement;
6   -import org.openqa.selenium.support.FindBy;
7   -
8   -
9   -/*
10   - * 前台发单中心页面
11   - * */
12   -
13   -
14   -public class ReceiptCorePage extends BasePage {
15   -
16   - public ReceiptCorePage(WebDriver driver) { super(driver);}
17   -
18   - /*
19   - * 页面元素定位
20   - * */
21   -
22   - @FindBy (xpath = "//i[@class='iconfont icon-double-arrow-right']")
23   -// @FindBy (xpath = "//*[contains(text(),'高级查询')]")
24   - WebElement advancedQuery; //高级查询
25   -
26   - @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]")
27   -// @FindBy (xpath = "//input[@type='text' and @ng-model='query.params.poCode']")
28   -
29   - WebElement PO_numbers; //PO单号
30   -
31   - @FindBy (xpath = "//*[text()='查询']")
32   -// @FindBy (xpath = "//*/button[@type='submit']")
33   -
34   - WebElement Query ; //查询
35   -
36   - @FindBy (xpath = "//tbody//tr[1]")
37   -// @FindBy (xpath = "//*[@id=\"frontSendListCtrlView\"]/div/div/table/tbody/tr[1]")
38   -
39   - WebElement list_1; //列表第一条数据
40   -
41   - @FindBy (xpath = "/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/table[1]/tbody[1]")
42   -
43   - WebElement list; //列表
44   -
45   - @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]")
46   -
47   - WebElement document_code; //单据编号
48   -
49   - @FindBy (xpath = "//*[text()='开始发单']")
50   -// @FindBy (xpath = "/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/button[1]")
51   -
52   - WebElement start_billing; // 开始发单
53   -
54   - @FindBy (xpath = "//button[@class='btn btn-danger ng-scope']")
55   -
56   - WebElement start_billing_1 ; //前台发单扫码平台的开始发单
57   -
58   - @FindBy (xpath = "//div[@class='input-group ng-isolate-scope ng-pristine ng-valid']//input[@type='text']")
59   -
60   - WebElement input_document_code;//单据编号输入框
61   -
62   - @FindBy (xpath = "//button[@type='button' and @ng-click='clickBtn()']")
63   -// @FindBy (xpath = "//*[contains(@ng-click,'clickBtn')]")
64   -
65   - WebElement search ;// 搜索按钮
66   -
67   - @FindBy (xpath = "//a[contains(text(),'扫码确认接单')]")
68   -
69   - WebElement Confirm_billing ; // 扫码确认接单
70   -
71   - @FindBy (xpath = "//*[text()='接单完成']")
72   -
73   - WebElement finish_billing; //接单完成
74   -
75   - @FindBy (xpath = "//*[contains(text(),'所选的工厂订单状态必须为“制单中”或“重新发单”')]")
76   -
77   - WebElement Fail_billing; //发单失败
78   -
79   - @FindBy (xpath = "//*[contains(text(),'所选的工厂订单状态必须为“发单中”')]")
80   -
81   - //*[coantains(text(),'所选的工厂订单状态必须为']
82   - // *[@data-notify='message']
83   - //*[@data-notify='message'] and text()='所选的工厂订单状态必须为“发单中”'
84   - //*[(text()=' 所选的工厂订单状态必须为“发单中”']
85   -
86   - WebElement Fail_order; //接单失败
87   -
88   - @FindBy (xpath = "//*[contains(text(),'操作成功')]")
89   -
90   - WebElement Succeed_billing; //发单成功
91   -
92   -
93   -
94   -
95   -
96   - /*
97   - * 页面方法
98   - * */
99   -
100   - public void BillOrder(String PO_Code) {
101   - click(advancedQuery);
102   - forceWait(1000);
103   -
104   - sendKeys(PO_numbers,PO_Code);
105   - forceWait(1000);
106   -
107   - click(Query);
108   -// forceWait(3000);
109   -
110   - 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]"));
111   -
112   -// actionDoubleClick(document_code); // 双击元素
113   -// forceWait(1000);
114   - String Fo = document_code.getText();
115   - forceWait(1000);
116   -
117   - click(start_billing);
118   - forceWait(1000);
119   - sendKeys(input_document_code,Fo);
120   - forceWait(1000);
121   -
122   - click(search);
123   - forceWait(1000);
124   -
125   - click(start_billing_1);
126   - forceWait(1000);
127   -// isVisibility(By.xpath("//*[contains(text(),'所选的工厂订单状态必须为“发单中”')]"));
128   -
129   - click(start_billing);
130   - forceWait(1000);
131   -
132   - click(Confirm_billing);
133   - forceWait(1000);
134   -
135   - sendKeys(input_document_code,Fo);
136   - forceWait(1000);
137   -
138   - click(search);
139   - forceWait(1000);
140   -
141   - click(finish_billing);
142   - forceWait(3000);
143   -
144   -
145   -
146   - }
147   -
148   -
149   - /*
150   - *用于断言发单接单是否成功
151   - * @return boolean
152   - */
153   -
154   - public boolean isSucceed() {return isElementExist(Succeed_billing);}
155   -
156   - /*
157   - *用于断言发单是否成功
158   - * @return boolean
159   - */
160   -
161   - public boolean FailBilling() {return isElementExist(Fail_billing);}
162   -
163   - /*
164   - *用于断言接单是否成功
165   - * @return boolean
166   - */
167   -
168   -
169   - public boolean FailOrder() {return isElementExist(Fail_order);}
170   -
171   -
172   -
173   -
174   -
175   -
176   -
177   -}
src/main/java/com/essa/testSuite/TestReceiptCore.java
1 1 package com.essa.testSuite;
2 2 import com.essa.framework.LinkSQL;
3 3 import com.essa.pageObject.BaseTest;
  4 +import com.essa.pageObject.DocumentaryManage.POBoardPage;
4 5 import com.essa.pageObject.HomePage;
5   -import com.essa.pageObject.ReceiptCore.ReceiptCorePage;
6 6 import org.openqa.selenium.WebDriver;
7 7 import org.openqa.selenium.support.PageFactory;
8 8 import org.testng.annotations.AfterClass;
... ... @@ -10,6 +10,7 @@ import org.testng.annotations.BeforeClass;
10 10 import org.testng.annotations.Test;
11 11 import org.testng.asserts.SoftAssert;
12 12  
  13 +// 跟单管理
13 14  
14 15 public class TestReceiptCore extends BaseTest {
15 16 WebDriver driver ;
... ... @@ -31,7 +32,7 @@ public class TestReceiptCore extends BaseTest {
31 32 this.driver = getDriver();
32 33 HomePage homePage = PageFactory.initElements(driver,HomePage.class);
33 34 homePage.toReceiptCore();
34   - ReceiptCorePage receiptCorePage = PageFactory.initElements(driver,ReceiptCorePage.class);
  35 + POBoardPage.ReceiptCorePage receiptCorePage = PageFactory.initElements(driver,POBoardPage.ReceiptCorePage.class);
35 36 String PO = LinkSQL.SQLQuery();
36 37  
37 38 receiptCorePage.BillOrder(PO);
... ...