Blame view

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