Commit 492c1c63499e91255446dbcae7eaca595a9e4eaa

Authored by huangyuanbo914@163.com
1 parent bf143b86

结构调整

src/main/java/com/essa/pageObject/DocumentaryManage/POBoardPage.java
@@ -118,168 +118,5 @@ public class POBoardPage extends BasePage { @@ -118,168 +118,5 @@ public class POBoardPage extends BasePage {
118 return isVisibility(By.xpath("//*[contains(text(),'装柜中')]")); 118 return isVisibility(By.xpath("//*[contains(text(),'装柜中')]"));
119 } 119 }
120 120
121 - public static class ReceiptCorePage extends BasePage {  
122 121
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 - }  
285 } 122 }
src/main/java/com/essa/pageObject/DocumentaryManage/ReceiptCorePage.java 0 → 100644
@@ -0,0 +1,172 @@ @@ -0,0 +1,172 @@
  1 +package com.essa.pageObject.DocumentaryManage;
  2 +
  3 +import com.essa.framework.BasePage;
  4 +import org.openqa.selenium.By;
  5 +import org.openqa.selenium.WebDriver;
  6 +import org.openqa.selenium.WebElement;
  7 +import org.openqa.selenium.support.FindBy;
  8 +
  9 +public class ReceiptCorePage extends BasePage {
  10 +
  11 + public ReceiptCorePage(WebDriver driver) { super(driver);}
  12 +
  13 + /*
  14 + * 页面元素定位
  15 + * */
  16 +
  17 + @FindBy(xpath = "//i[@class='iconfont icon-double-arrow-right']")
  18 + // @FindBy (xpath = "//*[contains(text(),'高级查询')]")
  19 + WebElement advancedQuery; //高级查询
  20 +
  21 + @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]")
  22 + // @FindBy (xpath = "//input[@type='text' and @ng-model='query.params.poCode']")
  23 +
  24 + WebElement PO_numbers; //PO单号
  25 +
  26 + @FindBy (xpath = "//*[text()='查询']")
  27 + // @FindBy (xpath = "//*/button[@type='submit']")
  28 +
  29 + WebElement Query ; //查询
  30 +
  31 + @FindBy (xpath = "//tbody//tr[1]")
  32 + // @FindBy (xpath = "//*[@id=\"frontSendListCtrlView\"]/div/div/table/tbody/tr[1]")
  33 +
  34 + WebElement list_1; //列表第一条数据
  35 +
  36 + @FindBy (xpath = "/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/table[1]/tbody[1]")
  37 +
  38 + WebElement list; //列表
  39 +
  40 + @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]")
  41 +
  42 + WebElement document_code; //单据编号
  43 +
  44 + @FindBy (xpath = "//*[text()='开始发单']")
  45 + // @FindBy (xpath = "/html[1]/body[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/button[1]")
  46 +
  47 + WebElement start_billing; // 开始发单
  48 +
  49 + @FindBy (xpath = "//button[@class='btn btn-danger ng-scope']")
  50 +
  51 + WebElement start_billing_1 ; //前台发单扫码平台的开始发单
  52 +
  53 + @FindBy (xpath = "//div[@class='input-group ng-isolate-scope ng-pristine ng-valid']//input[@type='text']")
  54 +
  55 + WebElement input_document_code;//单据编号输入框
  56 +
  57 + @FindBy (xpath = "//button[@type='button' and @ng-click='clickBtn()']")
  58 + // @FindBy (xpath = "//*[contains(@ng-click,'clickBtn')]")
  59 +
  60 + WebElement search ;// 搜索按钮
  61 +
  62 + @FindBy (xpath = "//a[contains(text(),'扫码确认接单')]")
  63 +
  64 + WebElement Confirm_billing ; // 扫码确认接单
  65 +
  66 + @FindBy (xpath = "//*[text()='接单完成']")
  67 +
  68 + WebElement finish_billing; //接单完成
  69 +
  70 + @FindBy (xpath = "//*[contains(text(),'所选的工厂订单状态必须为“制单中”或“重新发单”')]")
  71 +
  72 + WebElement Fail_billing; //发单失败
  73 +
  74 + @FindBy (xpath = "//*[contains(text(),'所选的工厂订单状态必须为“发单中”')]")
  75 +
  76 + //*[coantains(text(),'所选的工厂订单状态必须为']
  77 + // *[@data-notify='message']
  78 + //*[@data-notify='message'] and text()='所选的工厂订单状态必须为“发单中”'
  79 + //*[(text()=' 所选的工厂订单状态必须为“发单中”']
  80 +
  81 + WebElement Fail_order; //接单失败
  82 +
  83 + @FindBy (xpath = "//*[contains(text(),'操作成功')]")
  84 +
  85 + WebElement Succeed_billing; //发单成功
  86 +
  87 +
  88 +
  89 +
  90 +
  91 + /*
  92 + * 页面方法
  93 + * */
  94 +
  95 + public void BillOrder(String PO_Code) {
  96 + click(advancedQuery);
  97 + forceWait(1000);
  98 +
  99 + sendKeys(PO_numbers,PO_Code);
  100 + forceWait(1000);
  101 +
  102 + click(Query);
  103 + // forceWait(3000);
  104 +
  105 + 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]"));
  106 +
  107 + // actionDoubleClick(document_code); // 双击元素
  108 + // forceWait(1000);
  109 + String Fo = document_code.getText();
  110 + forceWait(1000);
  111 +
  112 + click(start_billing);
  113 + forceWait(1000);
  114 + sendKeys(input_document_code,Fo);
  115 + forceWait(1000);
  116 +
  117 + click(search);
  118 + forceWait(1000);
  119 +
  120 + click(start_billing_1);
  121 + forceWait(1000);
  122 + // isVisibility(By.xpath("//*[contains(text(),'所选的工厂订单状态必须为“发单中”')]"));
  123 +
  124 + click(start_billing);
  125 + forceWait(1000);
  126 +
  127 + click(Confirm_billing);
  128 + forceWait(1000);
  129 +
  130 + sendKeys(input_document_code,Fo);
  131 + forceWait(1000);
  132 +
  133 + click(search);
  134 + forceWait(1000);
  135 +
  136 + click(finish_billing);
  137 + forceWait(3000);
  138 +
  139 +
  140 +
  141 + }
  142 +
  143 +
  144 + /*
  145 + *用于断言发单接单是否成功
  146 + * @return boolean
  147 + */
  148 +
  149 + public boolean isSucceed() {return isElementExist(Succeed_billing);}
  150 +
  151 + /*
  152 + *用于断言发单是否成功
  153 + * @return boolean
  154 + */
  155 +
  156 + public boolean FailBilling() {return isElementExist(Fail_billing);}
  157 +
  158 + /*
  159 + *用于断言接单是否成功
  160 + * @return boolean
  161 + */
  162 +
  163 +
  164 + public boolean FailOrder() {return isElementExist(Fail_order);}
  165 +
  166 +
  167 +
  168 +
  169 +
  170 +
  171 +
  172 +}
src/main/java/com/essa/pageObject/HomePage.java
1 package com.essa.pageObject; 1 package com.essa.pageObject;
2 2
3 import com.essa.pageObject.DocumentaryManage.POBoardPage; 3 import com.essa.pageObject.DocumentaryManage.POBoardPage;
  4 +import com.essa.pageObject.DocumentaryManage.ReceiptCorePage;
4 import org.openqa.selenium.WebDriver; 5 import org.openqa.selenium.WebDriver;
5 import org.openqa.selenium.WebElement; 6 import org.openqa.selenium.WebElement;
6 import org.openqa.selenium.support.FindBy; 7 import org.openqa.selenium.support.FindBy;
@@ -435,9 +436,9 @@ public class HomePage extends BasePage{ @@ -435,9 +436,9 @@ public class HomePage extends BasePage{
435 /* 436 /*
436 * 进入前台发单中心页面 437 * 进入前台发单中心页面
437 * */ 438 * */
438 - public POBoardPage.ReceiptCorePage toReceiptCore() { 439 + public ReceiptCorePage toReceiptCore() {
439 click(DocumentaryManage); 440 click(DocumentaryManage);
440 click(Receipt_core); 441 click(Receipt_core);
441 - return new POBoardPage.ReceiptCorePage(driver); 442 + return new ReceiptCorePage (driver);
442 } 443 }
443 } 444 }
444 \ No newline at end of file 445 \ No newline at end of file
src/main/java/com/essa/testSuite/TestReceiptCore.java
1 package com.essa.testSuite; 1 package com.essa.testSuite;
  2 +
2 import com.essa.framework.LinkSQL; 3 import com.essa.framework.LinkSQL;
3 import com.essa.pageObject.BaseTest; 4 import com.essa.pageObject.BaseTest;
4 -import com.essa.pageObject.DocumentaryManage.POBoardPage; 5 +import com.essa.pageObject.DocumentaryManage.ReceiptCorePage;
5 import com.essa.pageObject.HomePage; 6 import com.essa.pageObject.HomePage;
6 import org.openqa.selenium.WebDriver; 7 import org.openqa.selenium.WebDriver;
7 import org.openqa.selenium.support.PageFactory; 8 import org.openqa.selenium.support.PageFactory;
@@ -32,7 +33,7 @@ public class TestReceiptCore extends BaseTest { @@ -32,7 +33,7 @@ public class TestReceiptCore extends BaseTest {
32 this.driver = getDriver(); 33 this.driver = getDriver();
33 HomePage homePage = PageFactory.initElements(driver,HomePage.class); 34 HomePage homePage = PageFactory.initElements(driver,HomePage.class);
34 homePage.toReceiptCore(); 35 homePage.toReceiptCore();
35 - POBoardPage.ReceiptCorePage receiptCorePage = PageFactory.initElements(driver,POBoardPage.ReceiptCorePage.class); 36 + ReceiptCorePage receiptCorePage = PageFactory.initElements(driver,ReceiptCorePage.class);
36 String PO = LinkSQL.SQLQuery(); 37 String PO = LinkSQL.SQLQuery();
37 38
38 receiptCorePage.BillOrder(PO); 39 receiptCorePage.BillOrder(PO);