Blame view

src/test/java/com/essa/pageObject/HomePage.java 11.2 KB
fdd4bb76   zengjin55   windows
1
2
3
4
5
  package com.essa.pageObject;  
    
  import org.openqa.selenium.WebDriver;  
  import org.openqa.selenium.WebElement;  
  import org.openqa.selenium.support.FindBy;
09fdf50f   Administrator   bpms
6
  import com.essa.framework.BasePage;
a62053f7   Administrator   add scene
7
  import com.essa.framework.Model;
09fdf50f   Administrator   bpms
8
9
10
11
12
13
  import com.essa.pageObject.GoodsManage.AddOriginalGoodsPage;
  import com.essa.pageObject.GoodsManage.AuditMarketGoodsPage;
  import com.essa.pageObject.GoodsManage.AuditOriginalGoodsPage;
  import com.essa.pageObject.GoodsManage.GoodsBankPage;
  import com.essa.pageObject.GoodsManage.GoodsRelesePage;
  import com.essa.pageObject.GoodsManage.MarketGoodsRelesePage;
d15bbfd4   Administrator   1024byzengjin
14
  import com.essa.pageObject.PODocumentary.PODocumentaryListPage;
c3910777   Administrator   by zengjin10-25
15
16
  import com.essa.pageObject.StorageManage.GoodsReceiveTaskPage;
  import com.essa.pageObject.StorageManage.NoticeReceivePage;
09fdf50f   Administrator   bpms
17
  import com.essa.pageObject.buyPlaneManage.SkuCategoryManagerCongfigPage;
60b8852f   Administrator   test
18
  import com.essa.pageObject.buyerManage.InvateCodePage;
a62053f7   Administrator   add scene
19
  import com.essa.pageObject.inquiryManage.ProductInquiryTaskPage;
09fdf50f   Administrator   bpms
20
  import com.essa.pageObject.marketingManage.GroupControlPage;
a62053f7   Administrator   add scene
21
22
  import com.essa.pageObject.marketingManage.GroupSettingPage;
  import com.essa.pageObject.needDealt.NeedDealtApplyPage;  
fdd4bb76   zengjin55   windows
23
    
60b8852f   Administrator   test
24
25
26
27
  /**
   * @author Administrator
   *bpms后台首页
   */
fdd4bb76   zengjin55   windows
28
29
30
  public class HomePage extends BasePage{  
      public HomePage(WebDriver driver) {  
          super(driver);  
fdd4bb76   zengjin55   windows
31
32
33
34
35
36
37
38
39
40
      }  
      
      /*
       * 元素定位
       */
      
      //退出
      @FindBy (xpath="//*[text()='退出']")
      WebElement logout;
      
09fdf50f   Administrator   bpms
41
42
43
44
      //左上角图标--用于回到首页
      @FindBy (xpath="//*[@class='logo-text']")
      WebElement essaIcon;
      
fdd4bb76   zengjin55   windows
45
46
47
48
49
50
51
52
53
54
55
56
      //供应商管理
      @FindBy (xpath="//*[text()='供应商管理']")
      WebElement supplier;
      
      //平台运营跟进管理
      @FindBy (xpath="//*/a[contains(text(),'平台运营跟进管理')]")
      WebElement operationsTrack;
      
      //供应商查询
      @FindBy (xpath="//*[text()='供应商查询']")
      WebElement searchSuppliers;
      
09fdf50f   Administrator   bpms
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
      //商品管理
      @FindBy (xpath="//*[text()='商品管理']")
      WebElement goodsManage;
      
      //商品库
      @FindBy (xpath="//*[text()='商品库']")
      WebElement goodBank;
      
      //原厂商品发布
      @FindBy (xpath="//*[text()='原厂商品发布']")
      WebElement addOriginalGoods;
      
      //市场商品发布
      @FindBy (xpath="//*[text()='市场商品发布']")
      WebElement marketGoodsRelese;
      
      //商品发布管理-子元素
      @FindBy(xpath="//*[@name='child.text' and text()='商品发布管理']")
      WebElement goodsPublish;
      
      //原厂商品发布审核
      @FindBy(xpath="//*[text()='原厂商品发布审核']")
      WebElement auditOriginal;
      
      //市场商品发布审核
      @FindBy(xpath="//*[text()='市场商品发布审核']")
      WebElement auditMarket;
      
      //采购计划管理
      @FindBy(xpath="//*[text()='采购计划管理']")
      WebElement buyerPlaneManage;
      
      //商品类目经理分配配置
      @FindBy(xpath="//*[text()='商品类目经理分配配置']")
      WebElement skuManagerConfig;
      
      //营销管理
      @FindBy (xpath="//*[text()='营销管理']")
      WebElement marketingManage;
      
      //团购设置
      @FindBy (xpath="//*[text()='团购设置']/..")
      WebElement groupSetting;
      
      //团购控制
      @FindBy (xpath="//*[text()='团购控制']/..")
      WebElement groupControl;
      
60b8852f   Administrator   test
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
      //采购商管理
      @FindBy (xpath="//*[text()='采购商管理']")
      WebElement buyerManage;
      
      //生成邀请码
      @FindBy (xpath="//*[text()='生成邀请码']"	)
      WebElement inviteCode;
      
      //询价管理
      @FindBy (xpath ="//span[text()='询价管理']")
      WebElement inquiryManage;
      
      //成品询价任务列表
      @FindBy (xpath = "//*[text()='成品询价任务列表']")
      WebElement productInquiryTask;
      
      //产品开发
      @FindBy (xpath ="//*[text()='产品开发']")
      WebElement productDev;
      
      //项目立项书新增
      @FindBy (xpath ="//*[text()='项目立项书新增']")
      WebElement addProject;
      
      //项目立项书查询
      @FindBy (xpath ="//*[text()='项目立项书查询']")
      WebElement quiryProject;
      
a62053f7   Administrator   add scene
133
134
135
      //待办中的"采购计划审核流程"
      @FindBy (xpath = "//*[@title='采购计划审核流程']")
      WebElement purchasePlaneProcess;
60b8852f   Administrator   test
136
      
c3910777   Administrator   by zengjin10-25
137
138
139
140
      //待办中的“船务确认备选船期流程”
      @FindBy (xpath = "//*[text()='船务确认备选船期流程']")
      WebElement confirmDailingDate;
      
a62053f7   Administrator   add scene
141
142
143
144
145
146
147
148
149
150
151
      //第一条待办
      @FindBy (xpath = "//*[@ng-table='tableParams']/tbody/tr[1]")
      WebElement firstNeedDealt;
      
      //待办搜索文本框
      @FindBy (xpath ="//*[@name='searchForm']/div/input")
      WebElement searchText;
      
      //待办搜索按钮
      @FindBy (xpath = "//*[@name='searchForm']/div/span/button")
      WebElement search;
60b8852f   Administrator   test
152
      
d15bbfd4   Administrator   1024byzengjin
153
154
155
156
157
158
159
160
      //跟单管理
      @FindBy (xpath = "//*[text()='跟单管理']")
      WebElement DocumentaryManage;
      
      //PO跟单
      @FindBy (xpath ="//*[text()='PO跟单']")
      WebElement PODocumentary;
      
c3910777   Administrator   by zengjin10-25
161
162
163
164
165
166
167
168
169
170
171
172
      //仓储管理
      @FindBy (xpath = "//span[contains(text(),'仓储管理')]")
      WebElement StorageManage;
      
      //收货通知
      @FindBy (xpath = "//a[@name='child.text'][contains(text(),'收货通知')]")
      WebElement NoticeReceive;
      
      //收货任务管理
      @FindBy (xpath = "//a[contains(text(),'收货任务管理')]")
      WebElement goodsReceiveTask;
      
fdd4bb76   zengjin55   windows
173
174
175
176
      /*
       * 方法
       */
      
09fdf50f   Administrator   bpms
177
178
      /**
       * 进入运营跟进管理页面
60b8852f   Administrator   test
179
       * @return SupplierOperationsTrackPage
09fdf50f   Administrator   bpms
180
       */
fdd4bb76   zengjin55   windows
181
182
183
184
185
186
187
188
189
190
191
192
193
      public SupplierOperationsTrackPage goToSupplierOperationsTrack() {
      	
      	//点击 供应商管理
      	click(supplier);
      	
      	//点击 平台运营跟进管理
      	click(operationsTrack);
      	
      	//此时,系统会加载一个平台运营跟进管理页面,故在此初始化该页面并将driver传递过去
      	return new SupplierOperationsTrackPage(driver);
      	
      }
      
09fdf50f   Administrator   bpms
194
195
      /**
       * 进入原厂商品发布
60b8852f   Administrator   test
196
       * @return AddOriginalGoodsPage
09fdf50f   Administrator   bpms
197
198
199
200
201
202
203
204
205
206
       */
      public AddOriginalGoodsPage tOriginalGoodsPage() {
      	click(goodsManage);
      	isElementExist(addOriginalGoods);
      	click(addOriginalGoods);
      	return new AddOriginalGoodsPage(driver);
      }
      
      /**
       * 进入商品发布管理
60b8852f   Administrator   test
207
       * @return GoodsRelesePage
09fdf50f   Administrator   bpms
208
209
210
211
212
213
214
215
216
       */
      public GoodsRelesePage tGoodsRelesePage() {
      	click(goodsManage);
      	click(goodsPublish);
      	return new GoodsRelesePage(driver);
      }
      
      /**
       * 进入原厂商品发布审核
60b8852f   Administrator   test
217
       * @return AuditOriginalGoodsPage
09fdf50f   Administrator   bpms
218
219
220
221
222
223
224
225
226
227
       */
      public AuditOriginalGoodsPage toAuditOriginalGoodsPage() {
      	mywait(logout);
      	click(goodsManage);
      	click(auditOriginal);
      	return new AuditOriginalGoodsPage(driver);
      }
      
      /**
       * 进入商品库
60b8852f   Administrator   test
228
       * @return GoodsBankPage
09fdf50f   Administrator   bpms
229
230
231
232
233
234
235
236
237
       */
      public GoodsBankPage toGoodsBankPage() {
      	click(goodsManage);
      	click(goodBank);
      	return new GoodsBankPage(driver);
      }
      
      /**
       * 进入市场商品发布
60b8852f   Administrator   test
238
       * @return MarketGoodsRelesePage
09fdf50f   Administrator   bpms
239
240
241
242
243
244
245
       */
      public MarketGoodsRelesePage toMarketGoodsRelesePage() {
      	click(goodsManage);
      	click(marketGoodsRelese);
      	return new MarketGoodsRelesePage(driver);
      }
      /**
60b8852f   Administrator   test
246
247
       * 进入市场商品发布审核 
       * @return AuditMarketGoodsPage
09fdf50f   Administrator   bpms
248
249
250
251
252
253
254
255
       */
      public AuditMarketGoodsPage toAuditMarketGoodsPage() {
      	click(goodsManage);
      	click(auditMarket);
      	return new AuditMarketGoodsPage(driver);
      }
      /**
       * 进入商品类目经理分配配置
60b8852f   Administrator   test
256
       * @return SkuCategoryManagerCongfigPage
09fdf50f   Administrator   bpms
257
258
259
260
261
262
263
264
265
       */
      public SkuCategoryManagerCongfigPage toSkuCategoryManagerCongfig() {
      	mywait(logout);
      	click(buyerPlaneManage);
      	click(skuManagerConfig);
      	return new SkuCategoryManagerCongfigPage(driver);
      }
      /**
       * 进入团购设置
60b8852f   Administrator   test
266
       * @return GroupSettingPage
09fdf50f   Administrator   bpms
267
268
269
270
271
272
273
274
275
       */
      public GroupSettingPage toGroupSettingPage() {
      	getHome();
      	click(marketingManage);
      	click(groupSetting);
      	return new GroupSettingPage(driver);
      }
      /**
       * 进入团购控制
60b8852f   Administrator   test
276
       * @return GroupControlPage
09fdf50f   Administrator   bpms
277
278
279
       */
      public GroupControlPage toGroupControlPage() {
  //    	getHome();
60b8852f   Administrator   test
280
      	jsExecutorClick(essaIcon);
09fdf50f   Administrator   bpms
281
282
283
284
      	click(marketingManage);
      	click(groupControl);
      	return new GroupControlPage(driver);
      }
60b8852f   Administrator   test
285
286
287
288
289
290
291
292
293
294
295
296
297
298
      /**
       * 进入生成邀请码
       * @return InvateCodePage
       */
      public InvateCodePage toInvateCodePage() {
      	click(buyerManage);
      	moveHeightScroll("100");
      	click(inviteCode);
      	return new InvateCodePage(driver);
      }
      /**
       * 进入成品询价任务列表
       * @return ProductInquiryTask
       */
a62053f7   Administrator   add scene
299
      public ProductInquiryTaskPage toProductInquiryTask() {
60b8852f   Administrator   test
300
301
      	click(inquiryManage);
      	click(productInquiryTask);
a62053f7   Administrator   add scene
302
      	return new ProductInquiryTaskPage(driver);
60b8852f   Administrator   test
303
304
305
306
307
308
309
      }
      
      
      /**
       * 判断是否进入后台首页
       * @return boolean
       */
fdd4bb76   zengjin55   windows
310
      public boolean isSucceed() {
fdd4bb76   zengjin55   windows
311
      	return isThisPage("退出", logout);
fdd4bb76   zengjin55   windows
312
313
      }
      
60b8852f   Administrator   test
314
315
316
317
      /**
       * 判断是否选中“供应商管理”
       * @return
       */
fdd4bb76   zengjin55   windows
318
      public boolean isSearchSuppliers() {
fdd4bb76   zengjin55   windows
319
      	return isElementExist(searchSuppliers);
fdd4bb76   zengjin55   windows
320
321
      }
      
09fdf50f   Administrator   bpms
322
323
324
325
326
327
328
329
      /**
       *点击essa图标, 回到bpms后台首页
       */
      public void getHome() {
      	forceWait(500);
      	jsExecutorClick(essaIcon);
      	forceWait(1000);
      }
60b8852f   Administrator   test
330
331
332
      /**
       * 退出登录
       */
fdd4bb76   zengjin55   windows
333
      public void logout() {
fdd4bb76   zengjin55   windows
334
      	click(logout);
fdd4bb76   zengjin55   windows
335
      }
a62053f7   Administrator   add scene
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
      
      /**
       * 点击退出,有弹框确认是否离开时,用这个
       */
      public void sureLogout() {
      	click(logout);
      	alert(true);
      	forceWait(1000);
      }
      
      /**
       * 团购活动达成,类目经理采购计划单申请
       * @return 询价待办申请页面
       */
      public NeedDealtApplyPage applyPurchasePlane() {
      	mywait(firstNeedDealt);
      	click(purchasePlaneProcess);
      	forceWait(500);
      	click(firstNeedDealt);
      	switchWindow();
      	return new NeedDealtApplyPage(driver);
      }
      
      /**
       * 待办详情页
       * @return 进入待办详情页
       */
      public NeedDealtApplyPage toNeedDealtDetailPage() {
      	mywait(firstNeedDealt);
      	sendKeys(searchText, Model.getSerialNum());
      	click(search);
      	forceWait(1000);
      	mywait(firstNeedDealt);
      	click(firstNeedDealt);
  //    	switchWindow();
      	switchMoreWindow();
      	return new NeedDealtApplyPage(driver);
      }
d15bbfd4   Administrator   1024byzengjin
374
375
376
377
378
379
      
      /**
       * 进入PO跟单列表页
       * @return PO跟单列表页
       */
      public PODocumentaryListPage toPoDocumentaryListPage() {
c3910777   Administrator   by zengjin10-25
380
      	mywait(DocumentaryManage);
d15bbfd4   Administrator   1024byzengjin
381
382
383
384
      	click(DocumentaryManage);
      	click(PODocumentary);
      	return new PODocumentaryListPage(driver);
      }
c3910777   Administrator   by zengjin10-25
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
      
      /**
       * 进入收货通知页面
       * @return 收货通知页面
       */
      public NoticeReceivePage toNoticeReceivePage() {
      	click(StorageManage);
      	click(NoticeReceive);
      	return new NoticeReceivePage(driver);
      }
      
      /**
       * 进入收货任务管理
       * @return 收货任务管理页面
       */
      public GoodsReceiveTaskPage toGoodsReceiveTaskPage() {
      	click(StorageManage);
      	click(goodsReceiveTask);
      	return new GoodsReceiveTaskPage(driver);
      }
      /**
       * 大跟单进入第一个需要确认备选船期的待办页面
       * @return 确认船期页面
       */
      public NeedDealtApplyPage toSailingDateConfirmPage() {
      	click(confirmDailingDate);
      	click(firstNeedDealt);
      	switchMoreWindow();
      	return new NeedDealtApplyPage(driver);
      }
fdd4bb76   zengjin55   windows
415
  }