1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Oro\Bundle\SalesBundle\Tests\Selenium\Pages; |
4
|
|
|
|
5
|
|
|
use Oro\Bundle\TestFrameworkBundle\Pages\AbstractPageEntity; |
6
|
|
|
use Oro\Bundle\ContactBundle\Tests\Selenium\Pages\Contacts; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class Lead |
10
|
|
|
* |
11
|
|
|
* @package Oro\Bundle\SalesBundle\Tests\Selenium\Pages |
12
|
|
|
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity) |
13
|
|
|
*/ |
14
|
|
|
class Lead extends AbstractPageEntity |
15
|
|
|
{ |
16
|
|
|
/** @var \PHPUnit_Extensions_Selenium2TestCase_Element */ |
17
|
|
|
protected $name; |
18
|
|
|
/** @var \PHPUnit_Extensions_Selenium2TestCase_Element */ |
19
|
|
|
protected $firstName; |
20
|
|
|
/** @var \PHPUnit_Extensions_Selenium2TestCase_Element */ |
21
|
|
|
protected $lastName; |
22
|
|
|
/** @var \PHPUnit_Extensions_Selenium2TestCase_Element */ |
23
|
|
|
protected $contact; |
24
|
|
|
/** @var \PHPUnit_Extensions_Selenium2TestCase_Element */ |
25
|
|
|
protected $jobTitle; |
26
|
|
|
/** @var \PHPUnit_Extensions_Selenium2TestCase_Element */ |
27
|
|
|
protected $phone; |
28
|
|
|
/** @var \PHPUnit_Extensions_Selenium2TestCase_Element */ |
29
|
|
|
protected $email; |
30
|
|
|
/** @var \PHPUnit_Extensions_Selenium2TestCase_Element */ |
31
|
|
|
protected $companyName; |
32
|
|
|
/** @var \PHPUnit_Extensions_Selenium2TestCase_Element */ |
33
|
|
|
protected $website; |
34
|
|
|
/** @var \PHPUnit_Extensions_Selenium2TestCase_Element */ |
35
|
|
|
protected $employees; |
36
|
|
|
/** @var \PHPUnit_Extensions_Selenium2TestCase_Element */ |
37
|
|
|
protected $industry; |
38
|
|
|
/** @var \PHPUnit_Extensions_Selenium2TestCase_Element */ |
39
|
|
|
protected $addressCollection; |
40
|
|
|
/** @var \PHPUnit_Extensions_Selenium2TestCase_Element */ |
41
|
|
|
protected $campaign; |
42
|
|
|
|
43
|
|
|
protected $owner = "//div[starts-with(@id,'s2id_oro_sales_lead_form_owner')]/a"; |
44
|
|
|
|
45
|
|
|
public function init() |
46
|
|
|
{ |
47
|
|
|
$this->name = $this->test->byXpath("//*[@data-ftid='oro_sales_lead_form_name']"); |
48
|
|
|
$this->firstName = $this->test->byXpath("//*[@data-ftid='oro_sales_lead_form_firstName']"); |
49
|
|
|
$this->lastName = $this->test->byXpath("//*[@data-ftid='oro_sales_lead_form_lastName']"); |
50
|
|
|
$this->contact = $this->test->byXpath("//div[starts-with(@id,'s2id_oro_sales_lead_form_contact')]/a"); |
51
|
|
|
$this->jobTitle = $this->test->byXpath("//*[@data-ftid='oro_sales_lead_form_jobTitle']"); |
52
|
|
|
$this->phone = $this->test->byXpath("//*[@data-ftid='oro_sales_lead_form_phones_0_phone']"); |
53
|
|
|
$this->email = $this->test->byXpath("//*[@data-ftid='oro_sales_lead_form_emails_0_email']"); |
54
|
|
|
$this->companyName = $this->test->byXpath("//*[@data-ftid='oro_sales_lead_form_companyName']"); |
55
|
|
|
$this->website = $this->test->byXpath("//*[@data-ftid='oro_sales_lead_form_website']"); |
56
|
|
|
$this->employees = $this->test->byXpath("//*[@data-ftid='oro_sales_lead_form_numberOfEmployees']"); |
57
|
|
|
$this->industry = $this->test->byXpath("//*[@data-ftid='oro_sales_lead_form_industry']"); |
58
|
|
|
$this->campaign = $this->test->byXpath( |
59
|
|
|
"//div[starts-with(@id,'s2id_oro_sales_lead_form_campaign')]/a" |
60
|
|
|
); |
61
|
|
|
$this->addressCollection = $this->test->byXpath("//div[@data-ftid='oro_sales_lead_form_addresses']"); |
62
|
|
|
|
63
|
|
|
return $this; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function setName($name) |
67
|
|
|
{ |
68
|
|
|
$this->name->clear(); |
69
|
|
|
$this->name->value($name); |
70
|
|
|
|
71
|
|
|
return $this; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function getName() |
75
|
|
|
{ |
76
|
|
|
return $this->name->value(); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function setFirstName($firstName) |
80
|
|
|
{ |
81
|
|
|
$this->firstName->clear(); |
82
|
|
|
$this->firstName->value($firstName); |
83
|
|
|
|
84
|
|
|
return $this; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
public function getFirstName() |
88
|
|
|
{ |
89
|
|
|
return $this->firstName->value(); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
public function setLastName($lastName) |
93
|
|
|
{ |
94
|
|
|
$this->lastName->clear(); |
95
|
|
|
$this->lastName->value($lastName); |
96
|
|
|
|
97
|
|
|
return $this; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
public function getLastName() |
101
|
|
|
{ |
102
|
|
|
return $this->lastName->value(); |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
public function setContact($contact) |
106
|
|
|
{ |
107
|
|
|
$this->contact->click(); |
108
|
|
|
$this->waitForAjax(); |
109
|
|
|
$this->test->byXpath("//div[@id='select2-drop']/div/input")->value($contact); |
110
|
|
|
$this->waitForAjax(); |
111
|
|
|
$this->assertElementPresent( |
112
|
|
|
"//div[@id='select2-drop']//div[contains(., '{$contact}')]", |
113
|
|
|
"Assigned to autocomplete doesn't return search value" |
114
|
|
|
); |
115
|
|
|
$this->test->byXpath("//div[@id='select2-drop']//div[contains(., '{$contact}')]")->click(); |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
public function getContact() |
119
|
|
|
{ |
120
|
|
|
return $this->test->byXpath("//div[starts-with(@id,'s2id_oro_sales_lead_form_contact')]/a/span")->text(); |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
public function setJobTitle($jobTitle) |
124
|
|
|
{ |
125
|
|
|
$this->jobTitle->clear(); |
126
|
|
|
$this->jobTitle->value($jobTitle); |
127
|
|
|
|
128
|
|
|
return $this; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
public function getJobTitle() |
132
|
|
|
{ |
133
|
|
|
return $this->jobTitle->value(); |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
public function setPhone($phone) |
137
|
|
|
{ |
138
|
|
|
$this->phone->clear(); |
139
|
|
|
$this->phone->value($phone); |
140
|
|
|
|
141
|
|
|
return $this; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
public function getPhone() |
145
|
|
|
{ |
146
|
|
|
return $this->phone->value(); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
public function setEmail($email) |
150
|
|
|
{ |
151
|
|
|
$this->email->clear(); |
152
|
|
|
$this->email->value($email); |
153
|
|
|
|
154
|
|
|
return $this; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
public function getEmail() |
158
|
|
|
{ |
159
|
|
|
return $this->email->value(); |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
public function setCompany($companyName) |
163
|
|
|
{ |
164
|
|
|
$this->companyName->clear(); |
165
|
|
|
$this->companyName->value($companyName); |
166
|
|
|
|
167
|
|
|
return $this; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
public function getCompany() |
171
|
|
|
{ |
172
|
|
|
return $this->companyName->value(); |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
public function setWebsite($website) |
176
|
|
|
{ |
177
|
|
|
$this->website->clear(); |
178
|
|
|
$this->website->value($website); |
179
|
|
|
|
180
|
|
|
return $this; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
public function getWebsite() |
184
|
|
|
{ |
185
|
|
|
return $this->website->value(); |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
public function setEmployees($employees) |
189
|
|
|
{ |
190
|
|
|
$this->employees->clear(); |
191
|
|
|
$this->employees->value($employees); |
192
|
|
|
|
193
|
|
|
return $this; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
public function getEmployees() |
197
|
|
|
{ |
198
|
|
|
return $this->employees->value(); |
199
|
|
|
} |
200
|
|
|
|
201
|
|
View Code Duplication |
public function setCampaign($campaign) |
|
|
|
|
202
|
|
|
{ |
203
|
|
|
$this->test->moveto($this->campaign); |
204
|
|
|
$this->campaign->click(); |
205
|
|
|
$this->waitForAjax(); |
206
|
|
|
$this->test->byXpath("//div[@id='select2-drop']/div/input")->value($campaign); |
207
|
|
|
$this->waitForAjax(); |
208
|
|
|
$this->assertElementPresent( |
209
|
|
|
"//div[@id='select2-drop']//div[contains(., '{$campaign}')]", |
210
|
|
|
"Campaign autocomplete doesn't return search value" |
211
|
|
|
); |
212
|
|
|
$this->test->byXpath("//div[@id='select2-drop']//div[contains(., '{$campaign}')]")->click(); |
213
|
|
|
|
214
|
|
|
return $this; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
View Code Duplication |
public function setAddressPrimary($value, $addressId = 0) |
|
|
|
|
218
|
|
|
{ |
219
|
|
|
$primary = "//input[@data-ftid='oro_sales_lead_form_addresses_{$addressId}_primary']"; |
220
|
|
|
if ($this->isElementPresent("//div[@role='dialog']")) { |
221
|
|
|
$primary = ("//input[@data-ftid='oro_sales_lead_address_form_primary']"); |
222
|
|
|
} |
223
|
|
|
if ($value) { |
224
|
|
|
$this->test->byXpath($primary)->click(); |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
return $this; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
public function getAddressPrimary($addressId = 0) |
231
|
|
|
{ |
232
|
|
|
return $this->test |
233
|
|
|
->byXpath("//*[@data-ftid='oro_sales_lead_form_addresses_{$addressId}_primary']")->selected(); |
234
|
|
|
} |
235
|
|
|
|
236
|
|
View Code Duplication |
public function setAddressFirstName($value, $addressId = 0) |
|
|
|
|
237
|
|
|
{ |
238
|
|
|
$addressFirstName = "//input[@data-ftid='oro_sales_lead_form_addresses_{$addressId}_firstName']"; |
239
|
|
|
if ($this->isElementPresent("//div[@role='dialog']")) { |
240
|
|
|
$addressFirstName = "//input[@data-ftid='oro_sales_lead_address_form_firstName']"; |
241
|
|
|
} |
242
|
|
|
$addressFirstName = $this->test->byXpath($addressFirstName); |
243
|
|
|
$this->test->moveto($addressFirstName); |
244
|
|
|
|
245
|
|
|
$addressFirstName->clear(); |
246
|
|
|
$addressFirstName->value($value); |
247
|
|
|
|
248
|
|
|
return $this; |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
public function getAddressFirstName($addressId = 0) |
252
|
|
|
{ |
253
|
|
|
$addressFirstName = $this->test |
254
|
|
|
->byXpath("//*[@data-ftid='oro_sales_lead_form_addresses_{$addressId}_firstName']"); |
255
|
|
|
|
256
|
|
|
return $addressFirstName->attribute('value'); |
257
|
|
|
} |
258
|
|
|
|
259
|
|
View Code Duplication |
public function setAddressLastName($value, $addressId = 0) |
|
|
|
|
260
|
|
|
{ |
261
|
|
|
$addressLastName = "//input[@data-ftid='oro_sales_lead_form_addresses_{$addressId}_lastName']"; |
262
|
|
|
if ($this->isElementPresent("//div[@role='dialog']")) { |
263
|
|
|
$addressLastName = "//input[@data-ftid='oro_sales_lead_address_form_lastName']"; |
264
|
|
|
} |
265
|
|
|
$addressLastName = $this->test->byXpath($addressLastName); |
266
|
|
|
$this->test->moveto($addressLastName); |
267
|
|
|
|
268
|
|
|
$addressLastName->clear(); |
269
|
|
|
$addressLastName->value($value); |
270
|
|
|
|
271
|
|
|
return $this; |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
public function getAddressLastName($addressId = 0) |
275
|
|
|
{ |
276
|
|
|
$addressLastName = $this->test |
277
|
|
|
->byXpath("//*[@data-ftid='oro_sales_lead_form_addresses_{$addressId}_lastName']"); |
278
|
|
|
return $addressLastName->attribute('value'); |
279
|
|
|
} |
280
|
|
|
|
281
|
|
View Code Duplication |
public function setAddressStreet($value, $addressId = 0) |
|
|
|
|
282
|
|
|
{ |
283
|
|
|
$street = "//input[@data-ftid='oro_sales_lead_form_addresses_{$addressId}_street']"; |
284
|
|
|
if ($this->isElementPresent("//div[@role='dialog']")) { |
285
|
|
|
$street = "//input[@data-ftid='oro_sales_lead_address_form_street']"; |
286
|
|
|
} |
287
|
|
|
$street = $this->test->byXpath($street); |
288
|
|
|
$this->test->moveto($street); |
289
|
|
|
|
290
|
|
|
$street->clear(); |
291
|
|
|
$street->value($value); |
292
|
|
|
|
293
|
|
|
return $this; |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
public function getAddressStreet($addressId = 0) |
297
|
|
|
{ |
298
|
|
|
$street = $this->test->byXpath("//*[@data-ftid='oro_sales_lead_form_addresses_{$addressId}_street']"); |
299
|
|
|
return $street->attribute('value'); |
300
|
|
|
} |
301
|
|
|
|
302
|
|
|
public function setAddressCity($value, $addressId = 0) |
303
|
|
|
{ |
304
|
|
|
$xpathCity = "//input[@data-ftid='oro_sales_lead_form_addresses_{$addressId}_city']"; |
305
|
|
|
if ($this->isElementPresent("//div[@role='dialog']")) { |
306
|
|
|
$xpathCity = "//input[@data-ftid='oro_sales_lead_address_form_city']"; |
307
|
|
|
} |
308
|
|
|
$city = $this->test->byXpath($xpathCity); |
309
|
|
|
$this->test->moveto($city); |
310
|
|
|
|
311
|
|
|
$city->clear(); |
312
|
|
|
$city->value($value); |
313
|
|
|
|
314
|
|
|
return $this; |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
public function getAddressCity($addressId = 0) |
318
|
|
|
{ |
319
|
|
|
$city = $this->test->byXpath("//*[@data-ftid='oro_sales_lead_form_addresses_{$addressId}_city']"); |
320
|
|
|
|
321
|
|
|
return $city->attribute('value'); |
322
|
|
|
} |
323
|
|
|
|
324
|
|
View Code Duplication |
public function setAddressPostalCode($value, $addressId = 0) |
|
|
|
|
325
|
|
|
{ |
326
|
|
|
$xpathZipcode = "//input[@data-ftid='oro_sales_lead_form_addresses_{$addressId}_postalCode']"; |
327
|
|
|
if ($this->isElementPresent("//div[@role='dialog']")) { |
328
|
|
|
$xpathZipcode = "//input[@data-ftid='oro_sales_lead_address_form_postalCode']"; |
329
|
|
|
} |
330
|
|
|
$zipcode = $this->test->byXpath($xpathZipcode); |
331
|
|
|
$this->test->moveto($zipcode); |
332
|
|
|
|
333
|
|
|
$zipcode->clear(); |
334
|
|
|
$zipcode->value($value); |
335
|
|
|
|
336
|
|
|
return $this; |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
public function getAddressPostalCode($addressId = 0) |
340
|
|
|
{ |
341
|
|
|
$zipcode = $this->test |
342
|
|
|
->byXpath("//*[@data-ftid='oro_sales_lead_form_addresses_{$addressId}_postalCode']"); |
343
|
|
|
|
344
|
|
|
return $zipcode->attribute('value'); |
345
|
|
|
} |
346
|
|
|
|
347
|
|
View Code Duplication |
public function setAddressCountry($value, $addressId = 0) |
|
|
|
|
348
|
|
|
{ |
349
|
|
|
$country = "//div[starts-with(@id,'s2id_oro_sales_lead_form_addresses_{$addressId}_country')]/a"; |
350
|
|
|
if ($this->isElementPresent("//div[@role='dialog']")) { |
351
|
|
|
$country = "//div[starts-with(@id,'s2id_oro_sales_lead_address_form_country')]/a"; |
352
|
|
|
} |
353
|
|
|
$country = $this->test->byXpath($country); |
354
|
|
|
$this->test->moveto($country); |
355
|
|
|
|
356
|
|
|
$country->click(); |
357
|
|
|
$this->waitForAjax(); |
358
|
|
|
$this->test->byXpath("//div[@id='select2-drop']/div/input")->value($value); |
359
|
|
|
$this->waitForAjax(); |
360
|
|
|
$this->assertElementPresent( |
361
|
|
|
"//div[@id='select2-drop']//div[normalize-space(.) = '{$value}']", |
362
|
|
|
"Country's autocomplete doesn't return search value" |
363
|
|
|
); |
364
|
|
|
$this->test->byXpath("//div[@id='select2-drop']//div[normalize-space(.) = '{$value}']")->click(); |
365
|
|
|
$this->waitForAjax(); |
366
|
|
|
|
367
|
|
|
return $this; |
368
|
|
|
} |
369
|
|
|
|
370
|
|
|
public function getAddressCountry($addressId = 0) |
371
|
|
|
{ |
372
|
|
|
return $this->test |
373
|
|
|
->byXpath("//div[starts-with(@id,'s2id_oro_sales_lead_form_addresses_{$addressId}_country')]/a/span") |
374
|
|
|
->text(); |
375
|
|
|
} |
376
|
|
|
|
377
|
|
View Code Duplication |
public function setAddressRegion($region, $addressId = 0) |
|
|
|
|
378
|
|
|
{ |
379
|
|
|
$xpath = "//div[starts-with(@id,'s2id_oro_sales_lead_form_addresses_{$addressId}_region')]/a"; |
380
|
|
|
if ($this->isElementPresent("//div[@role='dialog']")) { |
381
|
|
|
$xpath = "//div[starts-with(@id,'s2id_oro_sales_lead_address_form_region')]/a"; |
382
|
|
|
} |
383
|
|
|
$xpath = $this->test->byXpath($xpath); |
384
|
|
|
$this->test->moveto($xpath); |
385
|
|
|
|
386
|
|
|
$xpath->click(); |
387
|
|
|
$this->waitForAjax(); |
388
|
|
|
$this->test->byXpath("//div[@id='select2-drop']/div/input")->value($region); |
389
|
|
|
$this->waitForAjax(); |
390
|
|
|
$this->assertElementPresent( |
391
|
|
|
"//div[@id='select2-drop']//div[normalize-space(.) = '{$region}']", |
392
|
|
|
"Country's autocopmlete doesn't return search value" |
393
|
|
|
); |
394
|
|
|
$this->test->byXpath("//div[@id='select2-drop']//div[normalize-space(.) = '{$region}']")->click(); |
395
|
|
|
|
396
|
|
|
return $this; |
397
|
|
|
} |
398
|
|
|
|
399
|
|
|
public function getAddressRegion($addressId = 0) |
400
|
|
|
{ |
401
|
|
|
return $this->test |
402
|
|
|
->byXpath("//div[starts-with(@id,'s2id_oro_sales_lead_form_addresses_{$addressId}_region')]/a/span") |
403
|
|
|
->text(); |
404
|
|
|
} |
405
|
|
|
|
406
|
|
View Code Duplication |
public function setAddress($data, $addressId = 1) |
|
|
|
|
407
|
|
|
{ |
408
|
|
|
if ($this->isElementPresent("//button[@data-action-name='add_address']")) { |
409
|
|
|
// click Add address button |
410
|
|
|
$this->test->byXpath("//button[@data-action-name='add_address']")->click(); |
411
|
|
|
$this->waitForAjax(); |
412
|
|
|
} elseif (!$this->isElementPresent( |
413
|
|
|
"//div[@data-ftid='oro_sales_lead_form_addresses']/div[@data-content='{$addressId}' or " . |
414
|
|
|
"@data-content='oro_sales_lead_form[addresses][{$addressId}]']" |
415
|
|
|
) |
416
|
|
|
) { |
417
|
|
|
//click Add |
418
|
|
|
$addButton = $this->test->byXpath( |
419
|
|
|
"//div[@class='row-oro'][div[@data-ftid='oro_sales_lead_form_addresses']]" . |
420
|
|
|
"//a[@class='btn add-list-item']" |
421
|
|
|
); |
422
|
|
|
$this->test->moveto($addButton); |
423
|
|
|
$addButton->click(); |
424
|
|
|
$this->waitForAjax(); |
425
|
|
|
} |
426
|
|
|
|
427
|
|
|
foreach ($data as $key => $value) { |
428
|
|
|
$method = 'setAddress' . ucfirst($key); |
429
|
|
|
$this->$method($value, $addressId); |
430
|
|
|
} |
431
|
|
|
|
432
|
|
|
if ($this->isElementPresent("//div[@role='dialog']")) { |
433
|
|
|
$this->test->byXpath("//div[@class='form-actions widget-actions']//button[@type='submit']")->click(); |
434
|
|
|
$this->waitForAjax(); |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
return $this; |
438
|
|
|
} |
439
|
|
|
|
440
|
|
View Code Duplication |
public function getAddress(&$values, $addressId = 0) |
|
|
|
|
441
|
|
|
{ |
442
|
|
|
$values['primary'] = $this->getAddressPrimary($addressId); |
443
|
|
|
$values['firstName'] = $this->getAddressFirstName($addressId); |
444
|
|
|
$values['lastName'] = $this->getAddressLastName($addressId); |
445
|
|
|
$values['street'] = $this->getAddressStreet($addressId); |
446
|
|
|
$values['city'] = $this->getAddressCity($addressId); |
447
|
|
|
$values['postalCode'] = $this->getAddressPostalCode($addressId); |
448
|
|
|
$values['country'] = $this->getAddressCountry($addressId); |
449
|
|
|
$values['region'] = $this->getAddressRegion($addressId); |
450
|
|
|
|
451
|
|
|
return $this; |
452
|
|
|
} |
453
|
|
|
|
454
|
|
|
public function checkStatus($status) |
455
|
|
|
{ |
456
|
|
|
$this->assertElementPresent("//div[@class='status-enabled pull-left'][contains(., '{$status}')]"); |
457
|
|
|
|
458
|
|
|
return $this; |
459
|
|
|
} |
460
|
|
|
|
461
|
|
|
public function edit() |
462
|
|
|
{ |
463
|
|
|
$this->test->byXpath("//div[@class='pull-left btn-group icons-holder']/a[@title = 'Edit Lead']")->click(); |
464
|
|
|
$this->waitPageToLoad(); |
465
|
|
|
$this->waitForAjax(); |
466
|
|
|
$this->init(); |
467
|
|
|
|
468
|
|
|
return $this; |
469
|
|
|
} |
470
|
|
|
|
471
|
|
View Code Duplication |
public function delete() |
|
|
|
|
472
|
|
|
{ |
473
|
|
|
$this->test->byXpath("//div[@class='pull-left btn-group icons-holder']/a[contains(., 'Delete')]")->click(); |
474
|
|
|
$this->test->byXpath("//div[div[contains(., 'Delete Confirmation')]]//a[text()='Yes, Delete']")->click(); |
475
|
|
|
$this->waitPageToLoad(); |
476
|
|
|
$this->waitForAjax(); |
477
|
|
|
|
478
|
|
|
return new Contacts($this->test, false); |
479
|
|
|
} |
480
|
|
|
|
481
|
|
View Code Duplication |
public function setChannel($channel) |
|
|
|
|
482
|
|
|
{ |
483
|
|
|
$element = $this->test->byXpath("//div[starts-with(@id,'s2id_oro_sales_lead_form_dataChannel')]/a"); |
484
|
|
|
$element->click(); |
485
|
|
|
$this->waitForAjax(); |
486
|
|
|
if ($this->isElementPresent("//div[@id='select2-drop']/div/input")) { |
487
|
|
|
$this->test->byXpath("//div[@id='select2-drop']/div/input")->value($channel); |
488
|
|
|
$this->waitForAjax(); |
489
|
|
|
$this->assertElementPresent( |
490
|
|
|
"//div[@id='select2-drop']//div[contains(., '{$channel}')]", |
491
|
|
|
"Channel autocomplete doesn't return search value" |
492
|
|
|
); |
493
|
|
|
} |
494
|
|
|
$this->test->byXpath("//div[@id='select2-drop']//div[contains(., '{$channel}')]")->click(); |
495
|
|
|
|
496
|
|
|
return $this; |
497
|
|
|
} |
498
|
|
|
} |
499
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.