Blame view

src/test/java/com/essa/pageObject/HomePage.java 9.7 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;
09fdf50f   Administrator   bpms
15
  import com.essa.pageObject.buyPlaneManage.SkuCategoryManagerCongfigPage;
60b8852f   Administrator   test
16
  import com.essa.pageObject.buyerManage.InvateCodePage;
a62053f7   Administrator   add scene
17
  import com.essa.pageObject.inquiryManage.ProductInquiryTaskPage;
09fdf50f   Administrator   bpms
18
  import com.essa.pageObject.marketingManage.GroupControlPage;
a62053f7   Administrator   add scene
19
20
  import com.essa.pageObject.marketingManage.GroupSettingPage;
  import com.essa.pageObject.needDealt.NeedDealtApplyPage;  
fdd4bb76   zengjin55   windows
21
    
60b8852f   Administrator   test
22
23
24
25
  /**
   * @author Administrator
   *bpms后台首页
   */
fdd4bb76   zengjin55   windows
26
27
28
  public class HomePage extends BasePage{  
      public HomePage(WebDriver driver) {  
          super(driver);  
fdd4bb76   zengjin55   windows
29
30
31
32
33
34
35
36
37
38
      }  
      
      /*
       * 元素定位
       */
      
      //退出
      @FindBy (xpath="//*[text()='退出']")
      WebElement logout;
      
09fdf50f   Administrator   bpms
39
40
41
42
      //左上角图标--用于回到首页
      @FindBy (xpath="//*[@class='logo-text']")
      WebElement essaIcon;
      
fdd4bb76   zengjin55   windows
43
44
45
46
47
48
49
50
51
52
53
54
      //供应商管理
      @FindBy (xpath="//*[text()='供应商管理']")
      WebElement supplier;
      
      //平台运营跟进管理
      @FindBy (xpath="//*/a[contains(text(),'平台运营跟进管理')]")
      WebElement operationsTrack;
      
      //供应商查询
      @FindBy (xpath="//*[text()='供应商查询']")
      WebElement searchSuppliers;
      
09fdf50f   Administrator   bpms
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
      //商品管理
      @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
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
      //采购商管理
      @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
131
132
133
      //待办中的"采购计划审核流程"
      @FindBy (xpath = "//*[@title='采购计划审核流程']")
      WebElement purchasePlaneProcess;
60b8852f   Administrator   test
134
      
a62053f7   Administrator   add scene
135
136
137
138
139
140
141
142
143
144
145
      //第一条待办
      @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
146
      
d15bbfd4   Administrator   1024byzengjin
147
148
149
150
151
152
153
154
      //跟单管理
      @FindBy (xpath = "//*[text()='跟单管理']")
      WebElement DocumentaryManage;
      
      //PO跟单
      @FindBy (xpath ="//*[text()='PO跟单']")
      WebElement PODocumentary;
      
fdd4bb76   zengjin55   windows
155
156
157
158
      /*
       * 方法
       */
      
09fdf50f   Administrator   bpms
159
160
      /**
       * 进入运营跟进管理页面
60b8852f   Administrator   test
161
       * @return SupplierOperationsTrackPage
09fdf50f   Administrator   bpms
162
       */
fdd4bb76   zengjin55   windows
163
164
165
166
167
168
169
170
171
172
173
174
175
      public SupplierOperationsTrackPage goToSupplierOperationsTrack() {
      	
      	//点击 供应商管理
      	click(supplier);
      	
      	//点击 平台运营跟进管理
      	click(operationsTrack);
      	
      	//此时,系统会加载一个平台运营跟进管理页面,故在此初始化该页面并将driver传递过去
      	return new SupplierOperationsTrackPage(driver);
      	
      }
      
09fdf50f   Administrator   bpms
176
177
      /**
       * 进入原厂商品发布
60b8852f   Administrator   test
178
       * @return AddOriginalGoodsPage
09fdf50f   Administrator   bpms
179
180
181
182
183
184
185
186
187
188
       */
      public AddOriginalGoodsPage tOriginalGoodsPage() {
      	click(goodsManage);
      	isElementExist(addOriginalGoods);
      	click(addOriginalGoods);
      	return new AddOriginalGoodsPage(driver);
      }
      
      /**
       * 进入商品发布管理
60b8852f   Administrator   test
189
       * @return GoodsRelesePage
09fdf50f   Administrator   bpms
190
191
192
193
194
195
196
197
198
       */
      public GoodsRelesePage tGoodsRelesePage() {
      	click(goodsManage);
      	click(goodsPublish);
      	return new GoodsRelesePage(driver);
      }
      
      /**
       * 进入原厂商品发布审核
60b8852f   Administrator   test
199
       * @return AuditOriginalGoodsPage
09fdf50f   Administrator   bpms
200
201
202
203
204
205
206
207
208
209
       */
      public AuditOriginalGoodsPage toAuditOriginalGoodsPage() {
      	mywait(logout);
      	click(goodsManage);
      	click(auditOriginal);
      	return new AuditOriginalGoodsPage(driver);
      }
      
      /**
       * 进入商品库
60b8852f   Administrator   test
210
       * @return GoodsBankPage
09fdf50f   Administrator   bpms
211
212
213
214
215
216
217
218
219
       */
      public GoodsBankPage toGoodsBankPage() {
      	click(goodsManage);
      	click(goodBank);
      	return new GoodsBankPage(driver);
      }
      
      /**
       * 进入市场商品发布
60b8852f   Administrator   test
220
       * @return MarketGoodsRelesePage
09fdf50f   Administrator   bpms
221
222
223
224
225
226
227
       */
      public MarketGoodsRelesePage toMarketGoodsRelesePage() {
      	click(goodsManage);
      	click(marketGoodsRelese);
      	return new MarketGoodsRelesePage(driver);
      }
      /**
60b8852f   Administrator   test
228
229
       * 进入市场商品发布审核 
       * @return AuditMarketGoodsPage
09fdf50f   Administrator   bpms
230
231
232
233
234
235
236
237
       */
      public AuditMarketGoodsPage toAuditMarketGoodsPage() {
      	click(goodsManage);
      	click(auditMarket);
      	return new AuditMarketGoodsPage(driver);
      }
      /**
       * 进入商品类目经理分配配置
60b8852f   Administrator   test
238
       * @return SkuCategoryManagerCongfigPage
09fdf50f   Administrator   bpms
239
240
241
242
243
244
245
246
247
       */
      public SkuCategoryManagerCongfigPage toSkuCategoryManagerCongfig() {
      	mywait(logout);
      	click(buyerPlaneManage);
      	click(skuManagerConfig);
      	return new SkuCategoryManagerCongfigPage(driver);
      }
      /**
       * 进入团购设置
60b8852f   Administrator   test
248
       * @return GroupSettingPage
09fdf50f   Administrator   bpms
249
250
251
252
253
254
255
256
257
       */
      public GroupSettingPage toGroupSettingPage() {
      	getHome();
      	click(marketingManage);
      	click(groupSetting);
      	return new GroupSettingPage(driver);
      }
      /**
       * 进入团购控制
60b8852f   Administrator   test
258
       * @return GroupControlPage
09fdf50f   Administrator   bpms
259
260
261
       */
      public GroupControlPage toGroupControlPage() {
  //    	getHome();
60b8852f   Administrator   test
262
      	jsExecutorClick(essaIcon);
09fdf50f   Administrator   bpms
263
264
265
266
      	click(marketingManage);
      	click(groupControl);
      	return new GroupControlPage(driver);
      }
60b8852f   Administrator   test
267
268
269
270
271
272
273
274
275
276
277
278
279
280
      /**
       * 进入生成邀请码
       * @return InvateCodePage
       */
      public InvateCodePage toInvateCodePage() {
      	click(buyerManage);
      	moveHeightScroll("100");
      	click(inviteCode);
      	return new InvateCodePage(driver);
      }
      /**
       * 进入成品询价任务列表
       * @return ProductInquiryTask
       */
a62053f7   Administrator   add scene
281
      public ProductInquiryTaskPage toProductInquiryTask() {
60b8852f   Administrator   test
282
283
      	click(inquiryManage);
      	click(productInquiryTask);
a62053f7   Administrator   add scene
284
      	return new ProductInquiryTaskPage(driver);
60b8852f   Administrator   test
285
286
287
288
289
290
291
      }
      
      
      /**
       * 判断是否进入后台首页
       * @return boolean
       */
fdd4bb76   zengjin55   windows
292
      public boolean isSucceed() {
fdd4bb76   zengjin55   windows
293
      	return isThisPage("退出", logout);
fdd4bb76   zengjin55   windows
294
295
      }
      
60b8852f   Administrator   test
296
297
298
299
      /**
       * 判断是否选中“供应商管理”
       * @return
       */
fdd4bb76   zengjin55   windows
300
      public boolean isSearchSuppliers() {
fdd4bb76   zengjin55   windows
301
      	return isElementExist(searchSuppliers);
fdd4bb76   zengjin55   windows
302
303
      }
      
09fdf50f   Administrator   bpms
304
305
306
307
308
309
310
311
      /**
       *点击essa图标, 回到bpms后台首页
       */
      public void getHome() {
      	forceWait(500);
      	jsExecutorClick(essaIcon);
      	forceWait(1000);
      }
60b8852f   Administrator   test
312
313
314
      /**
       * 退出登录
       */
fdd4bb76   zengjin55   windows
315
      public void logout() {
fdd4bb76   zengjin55   windows
316
      	click(logout);
fdd4bb76   zengjin55   windows
317
      }
a62053f7   Administrator   add scene
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
      
      /**
       * 点击退出,有弹框确认是否离开时,用这个
       */
      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
356
357
358
359
360
361
362
363
364
365
      
      /**
       * 进入PO跟单列表页
       * @return PO跟单列表页
       */
      public PODocumentaryListPage toPoDocumentaryListPage() {
      	click(DocumentaryManage);
      	click(PODocumentary);
      	return new PODocumentaryListPage(driver);
      }
fdd4bb76   zengjin55   windows
366
  }