POBoardPage.java
7.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
package com.essa.pageObject.DocumentaryManage;
import com.essa.framework.Model;
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;
public class POBoardPage extends BasePage {
public POBoardPage(WebDriver driver) {
super(driver);
}
/*
* 元素定位
*/
@FindBy (xpath = "//*[text()='订单任务看板']")
WebElement taskBoard;//订单任务看板
@FindBy (xpath = "//*[@ng-model='keyword']")
WebElement keyword;//关键字查询输入框
@FindBy (xpath ="//*[@ng-model='keyword']/../span/button")
WebElement search;//查询按钮
@FindBy (xpath = "//*[@id='detailView']/div/div[3]/div[1]/div/div/table/tbody/tr[1]/td/div[2]/div[1]/input")
WebElement firstCheckbox;//第一个复选框
@FindBy (xpath ="//button[contains(text(),'转在途尾货')]")
WebElement toTail;//转在途尾货按钮
// 通知收货
@FindBy (xpath = "//button[contains(text(),'通知收货')]")
WebElement noticeReceive;
//收货日期
@FindBy (xpath = "//*[contains(text(),'收货日期')]") ///label[@class='control-label col-sm-8']
WebElement reveiveDate;
// 收货日期输入框
@FindBy (xpath = " //div[@class='col-sm-16']//input[@type='text']")
WebElement inputReceiveDate;
// 确定
@FindBy (xpath = "//button[contains(text(),'确定')]")
WebElement submit;
// 通知装柜
@FindBy(xpath = "//button[contains(text(),'通知装柜')]")
WebElement noticeLoad;
// 装柜日期空白处
@FindBy(xpath = " //label[@class='control-label col-md-8']")
WebElement loadDate;
// 装柜日期输入框
@FindBy (xpath = "//input[@name='newDate']")
WebElement inutLoadDate;
/*
* 页面方法
*/
/**
* 转在途尾货
* @return 转在途尾货页面
*/
public ConvertTailPage toTail() {
dynamicLoad(By.xpath("//*[style='display: block;']"));//等待页面加载完成
click(taskBoard);
dynamicLoad(By.xpath("//*[style='display: block;']"));
sendKeys(keyword, Model.getSkuNo());
click(search);
dynamicLoad(By.xpath("//*[style='display: block;']"));
click(firstCheckbox);
click(toTail);
return new ConvertTailPage(driver);
}
/**
* PO通知收货和通知装柜
*/
// 通知收货
public POBoardPage noticeReceive(){
click(noticeReceive);
jsExecutorRemoveAttribute(inputReceiveDate,"readonly");
String date = getDateTimeByFormat(new Date(),"MM/dd/yyyy");
sendKeys(inputReceiveDate,date);
click(reveiveDate);
click(submit);
return new POBoardPage(driver);
}
public boolean isNoticeReceSucceed(){
forceWait(2000);
return isVisibility(By.xpath("//*[contains(text(),'收货中')]"));
}
//通知装柜
public POBoardPage noticeLoad(){
click(noticeLoad);
jsExecutorRemoveAttribute(inutLoadDate,"readonly");
String date = getDateTimeByFormat(new Date(),"MM/dd/yyyy");
sendKeys(inutLoadDate,date);
click(loadDate);
forceWait(3000);
click(submit);
forceWait(2000);
return new POBoardPage(driver);
}
public boolean isNoticeLoadSucceed(){
forceWait(2000);
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);}
}
}