|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Pagantis\Pagantis\Test\Common; |
|
4
|
|
|
|
|
5
|
|
|
use Pagantis\Pagantis\Test\PagantisMagentoTest; |
|
6
|
|
|
use Facebook\WebDriver\WebDriverBy; |
|
7
|
|
|
use Facebook\WebDriver\WebDriverExpectedCondition; |
|
8
|
|
|
use Pagantis\SeleniumFormUtils\SeleniumHelper; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Class AbstractMg21Selenium |
|
12
|
|
|
* @package Pagantis\Test\Common |
|
13
|
|
|
*/ |
|
14
|
|
|
abstract class AbstractMg21Selenium extends PagantisMagentoTest |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* @throws \Exception |
|
18
|
|
|
*/ |
|
19
|
|
|
public function loginToBackOffice() |
|
20
|
|
|
{ |
|
21
|
|
|
$this->webDriver->get($this->configuration['magentoUrl'].self::BACKOFFICE_FOLDER); |
|
22
|
|
|
$emailElementSearch = WebDriverBy::id('username'); |
|
23
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($emailElementSearch); |
|
24
|
|
|
$this->webDriver->wait()->until($condition); |
|
25
|
|
|
$this->findById('username')->clear()->sendKeys($this->configuration['backofficeUsername']); |
|
26
|
|
|
$this->findById('login')->clear()->sendKeys($this->configuration['backofficePassword']); |
|
27
|
|
|
$this->findById('login-form')->submit(); |
|
28
|
|
|
$emailElementSearch = WebDriverBy::className('page-wrapper'); |
|
29
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($emailElementSearch); |
|
30
|
|
|
$this->webDriver->wait()->until($condition); |
|
31
|
|
|
$this->assertTrue((bool) $condition); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @require loginToBackOffice |
|
36
|
|
|
* |
|
37
|
|
|
* @throws \Exception |
|
38
|
|
|
*/ |
|
39
|
|
|
public function getpagantisBackOffice() |
|
40
|
|
|
{ |
|
41
|
|
|
$this->webDriver->get($this->configuration['magentoUrl'].self::BACKOFFICE_FOLDER); |
|
42
|
|
|
|
|
43
|
|
|
$elementSearch = WebDriverBy::linkText('STORES'); |
|
44
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($elementSearch); |
|
45
|
|
|
$this->webDriver->wait()->until($condition); |
|
46
|
|
|
$this->findByLinkText('STORES')->click(); |
|
47
|
|
|
|
|
48
|
|
|
sleep(5); |
|
49
|
|
|
$elementSearch = WebDriverBy::linkText('Configuration'); |
|
50
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($elementSearch); |
|
51
|
|
|
$this->webDriver->wait()->until($condition); |
|
52
|
|
|
$this->findByLinkText('Configuration')->click(); |
|
53
|
|
|
|
|
54
|
|
|
//Confirmamos que aparece el menu de tabs |
|
55
|
|
|
$elementSearch = WebDriverBy::id('system_config_tabs'); |
|
56
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($elementSearch); |
|
57
|
|
|
$this->webDriver->wait()->until($condition); |
|
58
|
|
|
|
|
59
|
|
|
//Buscamos la palabra SALES dentro del div anterior |
|
60
|
|
|
$menuSearch = WebDriverBy::cssSelector("#system_config_tabs > div > div > strong"); |
|
61
|
|
|
$menuElements = $this->webDriver->findElements($menuSearch); |
|
62
|
|
|
foreach ($menuElements as $menuElement) { |
|
63
|
|
|
if (strpos($menuElement->getText(), 'SALES', 0) !== false || |
|
64
|
|
|
strpos($menuElement->getText(), 'sales', 0) !== false) { |
|
65
|
|
|
$menuElement->click(); |
|
66
|
|
|
$this->assertContains('SALES', $menuElement->getText(), $menuElement->getText()); |
|
67
|
|
|
break; |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
$elementSearch = WebDriverBy::linkText('Payment Methods'); |
|
72
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($elementSearch); |
|
73
|
|
|
$this->webDriver->wait()->until($condition); |
|
74
|
|
|
$this->findByLinkText('Payment Methods')->click(); |
|
75
|
|
|
|
|
76
|
|
|
$elementSearch = WebDriverBy::id('payment_us_other_payment_methods-head'); |
|
77
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($elementSearch); |
|
78
|
|
|
$this->webDriver->wait()->until($condition); |
|
79
|
|
|
$otherElement = $this->findById('payment_us_other_payment_methods-head'); |
|
80
|
|
|
if ($otherElement->getAttribute('class')!='open') { |
|
81
|
|
|
$otherElement->click(); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
$verify = WebDriverBy::id('payment_us_pagantis-head'); |
|
85
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($verify); |
|
86
|
|
|
$this->webDriver->wait()->until($condition); |
|
87
|
|
|
$this->assertTrue((bool) $condition, "PR4"); |
|
88
|
|
|
$pagantisElement = $this->findById('payment_us_pagantis-head'); |
|
89
|
|
|
if ($pagantisElement->getAttribute('class')!='open') { |
|
90
|
|
|
$pagantisElement->click(); |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
$verify = WebDriverBy::id('payment_us_pagantis_active'); |
|
94
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($verify); |
|
95
|
|
|
$this->webDriver->wait()->until($condition); |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @throws \Exception |
|
100
|
|
|
*/ |
|
101
|
|
|
public function createAccount() |
|
102
|
|
|
{ |
|
103
|
|
|
$this->webDriver->get($this->configuration['magentoUrl']); |
|
104
|
|
|
$loginButtonSearch = WebDriverBy::linkText('Create an Account'); |
|
105
|
|
|
$condition = WebDriverExpectedCondition::elementToBeClickable($loginButtonSearch); |
|
106
|
|
|
$this->webDriver->wait()->until($condition); |
|
107
|
|
|
$this->findByLinkText('Create an Account')->click(); |
|
108
|
|
|
|
|
109
|
|
|
$random = rand(0, 1000); |
|
110
|
|
|
$this->findById('firstname')->clear()->sendKeys($this->configuration['firstname']); |
|
111
|
|
|
$this->findById('lastname')->sendKeys($this->configuration['lastname']); |
|
112
|
|
|
$this->findById('email_address')->sendKeys($this->configuration['email']); |
|
113
|
|
|
$this->findById('password')->sendKeys($this->configuration['password']); |
|
114
|
|
|
$this->findById('password-confirmation')->sendKeys($this->configuration['password']); |
|
115
|
|
|
$this->findById('form-validate')->submit(); |
|
116
|
|
|
|
|
117
|
|
|
$addressButton = WebDriverBy::partialLinkText('Address Book'); |
|
118
|
|
|
$condition = WebDriverExpectedCondition::elementToBeClickable($addressButton); |
|
119
|
|
|
$this->webDriver->wait()->until($condition); |
|
120
|
|
|
|
|
121
|
|
|
$this->assertContains( |
|
122
|
|
|
$this->configuration['firstname'], |
|
123
|
|
|
$this->findByClass('block-dashboard-info')->getText() |
|
124
|
|
|
); |
|
125
|
|
|
$this->findByPartialLinkText('Address Book')->click(); |
|
126
|
|
|
|
|
127
|
|
|
$addressLink = WebDriverBy::id('firstname'); |
|
128
|
|
|
$condition = WebDriverExpectedCondition::presenceOfElementLocated($addressLink); |
|
129
|
|
|
$this->webDriver->wait()->until($condition); |
|
130
|
|
|
|
|
131
|
|
|
$this->webDriver->findElement(WebDriverBy::id('country')) |
|
132
|
|
|
->findElement(WebDriverBy::cssSelector("option[value='ES']")) |
|
133
|
|
|
->click(); |
|
134
|
|
|
|
|
135
|
|
|
$this->findById('telephone')->clear()->sendKeys($this->configuration['phone']); |
|
136
|
|
|
$this->findById('street_1')->sendKeys($this->configuration['street']); |
|
137
|
|
|
$this->findById('city')->sendKeys($this->configuration['city']); |
|
138
|
|
|
$this->findById('zip')->sendKeys($this->configuration['zip']); |
|
139
|
|
|
|
|
140
|
|
|
$regionLink = WebDriverBy::id('region_id'); |
|
141
|
|
|
$condition = WebDriverExpectedCondition::presenceOfElementLocated($regionLink); |
|
142
|
|
|
$this->webDriver->wait()->until($condition); |
|
143
|
|
|
|
|
144
|
|
|
sleep(5); |
|
145
|
|
|
$this->webDriver->findElement(WebDriverBy::id('region_id')) |
|
146
|
|
|
->findElement(WebDriverBy::cssSelector("option[value='161']")) |
|
147
|
|
|
->click(); |
|
148
|
|
|
$this->findById('form-validate')->submit(); |
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
/** |
|
152
|
|
|
* @require createAccount |
|
153
|
|
|
* |
|
154
|
|
|
* @throws \Exception |
|
155
|
|
|
*/ |
|
156
|
|
|
public function loginToFrontend() |
|
157
|
|
|
{ |
|
158
|
|
|
$this->webDriver->get($this->configuration['magentoUrl']); |
|
159
|
|
|
$loginButton = WebDriverBy::partialLinkText('Sign In'); |
|
160
|
|
|
$condition = WebDriverExpectedCondition::elementToBeClickable($loginButton); |
|
161
|
|
|
$this->webDriver->wait()->until($condition); |
|
162
|
|
|
$this->assertTrue((bool) $condition); |
|
163
|
|
|
$this->webDriver->findElement($loginButton)->click(); |
|
164
|
|
|
|
|
165
|
|
|
$verifyElement = WebDriverBy::id('login-form'); |
|
166
|
|
|
$condition = WebDriverExpectedCondition::elementToBeClickable($verifyElement); |
|
167
|
|
|
$this->webDriver->wait()->until($condition); |
|
168
|
|
|
$this->assertTrue((bool) $condition); |
|
169
|
|
|
|
|
170
|
|
|
$this->findById('email')->sendKeys($this->configuration['email']); |
|
171
|
|
|
$this->findById('pass')->sendKeys($this->configuration['password']); |
|
172
|
|
|
$this->findById('login-form')->submit(); |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* |
|
177
|
|
|
* @throws \Exception |
|
178
|
|
|
*/ |
|
179
|
|
|
public function logoutFromFrontend() |
|
180
|
|
|
{ |
|
181
|
|
|
$this->webDriver->get($this->configuration['magentoUrl'].self::LOGOUT_FOLDER); |
|
182
|
|
|
|
|
183
|
|
|
$validatorSearch = WebDriverBy::className('base'); |
|
184
|
|
|
$actualString = $this->webDriver->findElement($validatorSearch)->getText(); |
|
185
|
|
|
$compareString = (strpos($actualString, "You are signed out")) === false ? false : true; |
|
186
|
|
|
$this->assertTrue($compareString, "PR1-PR4"); |
|
187
|
|
|
} |
|
188
|
|
|
|
|
189
|
|
|
/** |
|
190
|
|
|
* Configure product |
|
191
|
|
|
*/ |
|
192
|
|
|
public function checkProductPage() |
|
193
|
|
|
{ |
|
194
|
|
|
sleep(10); |
|
195
|
|
|
if (version_compare($this->version, '23') < 0) { |
|
196
|
|
|
$this->checkSimulator(); |
|
197
|
|
|
} |
|
198
|
|
|
|
|
199
|
|
|
$paymentFormElement = WebDriverBy::id('product-addtocart-button'); |
|
200
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($paymentFormElement); |
|
201
|
|
|
$this->webDriver->wait()->until($condition); |
|
202
|
|
|
$addToCartButton = $this->findById('product-addtocart-button'); |
|
203
|
|
|
$addToCartButton->click(); |
|
204
|
|
|
sleep(5); |
|
205
|
|
|
} |
|
206
|
|
|
|
|
207
|
|
|
/** |
|
208
|
|
|
* @param bool $verifySimulator |
|
209
|
|
|
* |
|
210
|
|
|
* @throws \Exception |
|
211
|
|
|
*/ |
|
212
|
|
|
public function goToProduct($verifySimulator = true) |
|
213
|
|
|
{ |
|
214
|
|
|
$this->webDriver->get($this->configuration['magentoUrl']); |
|
215
|
|
|
$this->findByLinkText(self::PRODUCT_NAME)->click(); |
|
216
|
|
|
$condition = WebDriverExpectedCondition::titleContains(self::PRODUCT_NAME); |
|
217
|
|
|
$this->webDriver->wait()->until($condition); |
|
218
|
|
|
$this->assertTrue((bool) $condition); |
|
219
|
|
|
} |
|
220
|
|
|
|
|
221
|
|
|
/** |
|
222
|
|
|
* @require goToProduct |
|
223
|
|
|
* |
|
224
|
|
|
* @throws \Exception |
|
225
|
|
|
*/ |
|
226
|
|
|
public function addProduct() |
|
227
|
|
|
{ |
|
228
|
|
|
$addToCartSearch = WebDriverBy::id('product-addtocart-button'); |
|
229
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($addToCartSearch); |
|
230
|
|
|
$this->webDriver->wait()->until($condition); |
|
231
|
|
|
$this->assertTrue((bool) $condition); |
|
232
|
|
|
$this->webDriver->findElement($addToCartSearch)->click(); |
|
233
|
|
|
|
|
234
|
|
|
$validatorSearch = WebDriverBy::className('messages'); |
|
235
|
|
|
$actualString = $this->webDriver->findElement($validatorSearch)->getText(); |
|
236
|
|
|
$addedMessage = "You added ".self::PRODUCT_NAME." to your shopping cart"; |
|
237
|
|
|
$compareString = (strpos($actualString, $addedMessage)) === false ? false : true; |
|
238
|
|
|
$this->assertTrue($compareString); |
|
239
|
|
|
|
|
240
|
|
|
//You added Fusion Backpack to your shopping cart. |
|
241
|
|
|
$shoppingCartSearch = WebDriverBy::id('shopping_cart'); |
|
242
|
|
|
$this->webDriver->findElement($shoppingCartSearch)->click(); |
|
243
|
|
|
$shoppingCartTitle = WebDriverBy::id('cart_title'); |
|
244
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($shoppingCartTitle); |
|
245
|
|
|
$this->webDriver->wait()->until($condition); |
|
246
|
|
|
$this->assertTrue((bool) $condition); |
|
247
|
|
|
} |
|
248
|
|
|
|
|
249
|
|
|
public function goToCart() |
|
250
|
|
|
{ |
|
251
|
|
|
$this->webDriver->get($this->configuration['magentoUrl'].self::CART_FOLDER); |
|
252
|
|
|
$this->findByLinkText(self::PRODUCT_NAME)->click(); |
|
253
|
|
|
$condition = WebDriverExpectedCondition::titleContains(self::CART_TITLE); |
|
254
|
|
|
$this->webDriver->wait()->until($condition); |
|
255
|
|
|
$this->assertTrue((bool) $condition); |
|
256
|
|
|
} |
|
257
|
|
|
|
|
258
|
|
|
/** |
|
259
|
|
|
* Config product quantity |
|
260
|
|
|
* |
|
261
|
|
|
* @param $qty |
|
262
|
|
|
*/ |
|
263
|
|
|
public function configureProduct($qty = 1) |
|
264
|
|
|
{ |
|
265
|
|
|
$qtyElements = $this->webDriver->findElements(WebDriverBy::id('qty')); |
|
266
|
|
|
foreach ($qtyElements as $qtyElement) { |
|
267
|
|
|
$qtyElement->clear()->sendKeys($qty); |
|
268
|
|
|
} |
|
269
|
|
|
} |
|
270
|
|
|
|
|
271
|
|
|
/** |
|
272
|
|
|
* @throws \Facebook\WebDriver\Exception\NoSuchElementException |
|
273
|
|
|
* @throws \Facebook\WebDriver\Exception\TimeOutException |
|
274
|
|
|
*/ |
|
275
|
|
|
public function goToCheckout() |
|
276
|
|
|
{ |
|
277
|
|
|
sleep(15); |
|
278
|
|
|
$this->webDriver->get($this->configuration['magentoUrl'].self::CHECKOUT_FOLDER); |
|
279
|
|
|
$condition = WebDriverExpectedCondition::titleContains(self::CHECKOUT_TITLE); |
|
280
|
|
|
$this->webDriver->wait()->until($condition); |
|
281
|
|
|
$this->assertTrue((bool)$condition, $this->configuration['magentoUrl'].self::CHECKOUT_FOLDER); |
|
282
|
|
|
} |
|
283
|
|
|
|
|
284
|
|
|
/** |
|
285
|
|
|
* @throws \Exception |
|
286
|
|
|
*/ |
|
287
|
|
|
public function verifyUTF8() |
|
288
|
|
|
{ |
|
289
|
|
|
$paymentFormElement = WebDriverBy::className('FieldsPreview-desc'); |
|
290
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($paymentFormElement); |
|
291
|
|
|
$this->webDriver->wait()->until($condition); |
|
292
|
|
|
$this->assertTrue((bool) $condition); |
|
293
|
|
|
$this->assertSame( |
|
294
|
|
|
$this->configuration['firstname'] . ' ' . $this->configuration['lastname'], |
|
295
|
|
|
$this->findByClass('FieldsPreview-desc')->getText() |
|
296
|
|
|
); |
|
297
|
|
|
} |
|
298
|
|
|
|
|
299
|
|
|
/** |
|
300
|
|
|
* Verify pagantis |
|
301
|
|
|
* |
|
302
|
|
|
* @throws \Exception |
|
303
|
|
|
*/ |
|
304
|
|
|
public function verifypagantis() |
|
305
|
|
|
{ |
|
306
|
|
|
$condition = WebDriverExpectedCondition::titleContains(self::PAGANTIS_TITLE); |
|
307
|
|
|
$this->webDriver->wait(300)->until($condition, $this->webDriver->getCurrentURL()); |
|
308
|
|
|
$this->assertTrue((bool)$condition, "PR32"); |
|
309
|
|
|
|
|
310
|
|
|
SeleniumHelper::finishForm($this->webDriver); |
|
311
|
|
|
} |
|
312
|
|
|
|
|
313
|
|
|
/** |
|
314
|
|
|
* Prepare checkout, called from BuyRegistered and BuyUnregistered |
|
315
|
|
|
*/ |
|
316
|
|
|
public function prepareCheckout() |
|
317
|
|
|
{ |
|
318
|
|
|
$firstnameElement = WebDriverBy::name('firstname'); |
|
319
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($firstnameElement); |
|
320
|
|
|
$this->webDriver->wait(200)->until($condition); |
|
321
|
|
|
$this->assertTrue((bool) $condition); |
|
322
|
|
|
|
|
323
|
|
|
sleep(5); |
|
324
|
|
|
$countryElement = WebDriverBy::name('country_id'); |
|
325
|
|
|
$condition = WebDriverExpectedCondition::elementToBeClickable($countryElement); |
|
326
|
|
|
$this->webDriver->wait()->until($condition); |
|
327
|
|
|
$this->assertTrue((bool) $condition); |
|
328
|
|
|
$this->webDriver->findElement(WebDriverBy::name('country_id')) |
|
329
|
|
|
->findElement(WebDriverBy::cssSelector("option[value='ES']")) |
|
330
|
|
|
->click(); |
|
331
|
|
|
|
|
332
|
|
|
$this->findByName('postcode')->clear()->sendKeys($this->configuration['zip']); |
|
333
|
|
|
$this->findByName('street[0]')->clear()->sendKeys($this->configuration['street']); |
|
334
|
|
|
$this->findByName('city')->clear()->sendKeys($this->configuration['city']); |
|
335
|
|
|
$this->findById('customer-email')->clear()->sendKeys($this->configuration['email']); |
|
336
|
|
|
$this->findByName('firstname')->clear()->sendKeys($this->configuration['firstname']); |
|
337
|
|
|
$this->findByName('lastname')->clear()->sendKeys($this->configuration['lastname']); |
|
338
|
|
|
$this->findByName('telephone')->clear()->sendKeys($this->configuration['phone']); |
|
339
|
|
|
|
|
340
|
|
|
$this->webDriver->findElement(WebDriverBy::name('region_id')) |
|
341
|
|
|
->findElement(WebDriverBy::cssSelector("option[value='139']")) |
|
342
|
|
|
->click(); |
|
343
|
|
|
|
|
344
|
|
|
$this->goToPayment(); |
|
345
|
|
|
} |
|
346
|
|
|
|
|
347
|
|
|
/** |
|
348
|
|
|
* @throws \Facebook\WebDriver\Exception\NoSuchElementException |
|
349
|
|
|
* @throws \Facebook\WebDriver\Exception\TimeOutException |
|
350
|
|
|
*/ |
|
351
|
|
|
public function goToPayment() |
|
352
|
|
|
{ |
|
353
|
|
|
$shippingElement = WebDriverBy::xpath("//input[@value='flatrate_flatrate']"); |
|
354
|
|
|
$condition = WebDriverExpectedCondition::elementToBeClickable($shippingElement); |
|
355
|
|
|
$this->webDriver->wait()->until($condition); |
|
356
|
|
|
$this->assertTrue((bool) $condition); |
|
357
|
|
|
|
|
358
|
|
|
sleep(5); |
|
359
|
|
|
$shippingButton = $this->webDriver->findElement($shippingElement); |
|
360
|
|
|
if (!$shippingButton->isSelected()) { |
|
361
|
|
|
$shippingButton->click(); |
|
362
|
|
|
} |
|
363
|
|
|
|
|
364
|
|
|
sleep(5); |
|
365
|
|
|
$continueElement = WebDriverBy::className('continue'); |
|
366
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($continueElement); |
|
367
|
|
|
$this->webDriver->wait()->until($condition); |
|
368
|
|
|
$this->assertTrue((bool) $condition); |
|
369
|
|
|
|
|
370
|
|
|
$condition = WebDriverExpectedCondition::elementToBeClickable($continueElement); |
|
371
|
|
|
$this->webDriver->wait()->until($condition); |
|
372
|
|
|
$this->assertTrue((bool) $condition); |
|
373
|
|
|
|
|
374
|
|
|
$this->findByClass('continue')->click(); |
|
375
|
|
|
} |
|
376
|
|
|
|
|
377
|
|
|
/** |
|
378
|
|
|
* @throws \Facebook\WebDriver\Exception\NoSuchElementException |
|
379
|
|
|
* @throws \Facebook\WebDriver\Exception\TimeOutException |
|
380
|
|
|
*/ |
|
381
|
|
|
public function preparePaymentMethod() |
|
382
|
|
|
{ |
|
383
|
|
|
$pagantisElement = WebDriverBy::id('pagantis'); |
|
384
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($pagantisElement); |
|
385
|
|
|
$this->webDriver->wait()->until($condition); |
|
386
|
|
|
$this->assertTrue((bool) $condition); |
|
387
|
|
|
|
|
388
|
|
|
$condition = WebDriverExpectedCondition::elementToBeClickable($pagantisElement); |
|
389
|
|
|
$this->webDriver->wait()->until($condition); |
|
390
|
|
|
$this->assertTrue((bool) $condition); |
|
391
|
|
|
|
|
392
|
|
|
sleep(10); |
|
393
|
|
|
$this->findById('pagantis')->click(); |
|
394
|
|
|
|
|
395
|
|
|
sleep(2); |
|
396
|
|
|
|
|
397
|
|
|
$pagantisElement = WebDriverBy::className('payment-group'); |
|
398
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($pagantisElement); |
|
399
|
|
|
$this->webDriver->wait()->until($condition); |
|
400
|
|
|
$this->assertTrue((bool) $condition); |
|
401
|
|
|
|
|
402
|
|
|
$menuSearch = WebDriverBy::cssSelector("#checkout-payment-method-load > .payment-methods > .payment-group > ._active > .payment-method-title"); |
|
403
|
|
|
$menuElement = $this->webDriver->findElement($menuSearch); |
|
404
|
|
|
$actualString = $menuElement->getText(); |
|
405
|
|
|
$compareString = (strstr($actualString, $this->configuration['methodTitle'])) === false ? false : true; |
|
406
|
|
|
$this->assertTrue($compareString, "PR25,PR26=>".$actualString.'--'.$this->configuration['methodTitle']); |
|
407
|
|
|
|
|
408
|
|
|
$descriptionSearch = WebDriverBy::cssSelector("#checkout-payment-method-load > .payment-methods > .payment-group > ._active > .payment-method-content"); |
|
409
|
|
|
$descriptionElement = $this->webDriver->findElement($descriptionSearch); |
|
410
|
|
|
$actualString = $descriptionElement->getText(); |
|
411
|
|
|
$this->assertContains($this->configuration['checkoutDescription'], $actualString, "PR54"); |
|
412
|
|
|
|
|
413
|
|
|
$priceSearch = WebDriverBy::className('price'); |
|
414
|
|
|
$priceElements = $this->webDriver->findElements($priceSearch); |
|
415
|
|
|
$price = $priceElements['6']->getText(); |
|
416
|
|
|
|
|
417
|
|
|
$this->assertNotEquals($price, 0, $price); |
|
418
|
|
|
$this->assertNotEmpty($price); |
|
419
|
|
|
|
|
420
|
|
|
sleep(20); |
|
421
|
|
|
$checkoutButton = WebDriverBy::cssSelector("#checkout-payment-method-load > .payment-methods > .payment-group > ._active > .payment-method-content > .actions-toolbar > .primary"); |
|
422
|
|
|
$condition = WebDriverExpectedCondition::elementToBeClickable($checkoutButton); |
|
423
|
|
|
$this->webDriver->wait()->until($condition); |
|
424
|
|
|
|
|
425
|
|
|
$menuElement = $this->webDriver->findElement($checkoutButton); |
|
426
|
|
|
$menuElement->click(); |
|
427
|
|
|
return $price; |
|
428
|
|
|
} |
|
429
|
|
|
|
|
430
|
|
|
/** |
|
431
|
|
|
* @throws \Facebook\WebDriver\Exception\NoSuchElementException |
|
432
|
|
|
* @throws \Facebook\WebDriver\Exception\TimeOutException |
|
433
|
|
|
*/ |
|
434
|
|
|
public function verifyOrder() |
|
435
|
|
|
{ |
|
436
|
|
|
$condition = WebDriverExpectedCondition::titleContains(self::SUCCESS_TITLE); |
|
437
|
|
|
$this->webDriver->wait()->until($condition); |
|
438
|
|
|
$this->assertTrue((bool) $condition); |
|
439
|
|
|
|
|
440
|
|
|
$menuSearch = WebDriverBy::className("base"); |
|
441
|
|
|
$menuElement = $this->webDriver->findElement($menuSearch); |
|
442
|
|
|
$actualString = $menuElement->getText(); |
|
443
|
|
|
$this->assertContains('Thank you for your purchase!', $actualString, "PR42"); |
|
444
|
|
|
} |
|
445
|
|
|
|
|
446
|
|
|
/** |
|
447
|
|
|
* @return string |
|
448
|
|
|
* @throws \Facebook\WebDriver\Exception\NoSuchElementException |
|
449
|
|
|
* @throws \Facebook\WebDriver\Exception\TimeOutException |
|
450
|
|
|
*/ |
|
451
|
|
|
public function verifyOrderInformation() |
|
452
|
|
|
{ |
|
453
|
|
|
$this->findByClass('order-number')->click(); |
|
454
|
|
|
$condition = WebDriverExpectedCondition::titleContains(self::ORDER_TITLE); |
|
455
|
|
|
$this->webDriver->wait()->until($condition); |
|
456
|
|
|
$this->assertTrue((bool) $condition); |
|
457
|
|
|
|
|
458
|
|
|
$menuSearch = WebDriverBy::cssSelector("div.block-order-details-view > div.block-content > div.box-order-billing-method > div.box-content > dl.payment-method"); |
|
459
|
|
|
$menuElement = $this->webDriver->findElement($menuSearch); |
|
460
|
|
|
$actualString = $menuElement->getText(); |
|
461
|
|
|
$compareString = (strstr($actualString, $this->configuration['methodName'])) === false ? false : true; |
|
462
|
|
|
$this->assertTrue($compareString, $actualString, "PR49"); |
|
463
|
|
|
|
|
464
|
|
|
$menuSearch = WebDriverBy::cssSelector("#my-orders-table > tfoot > .grand_total > .amount > strong > .price"); |
|
465
|
|
|
$menuElement = $this->webDriver->findElement($menuSearch); |
|
466
|
|
|
return $menuElement->getText(); |
|
467
|
|
|
} |
|
468
|
|
|
|
|
469
|
|
|
/** |
|
470
|
|
|
* @throws \Facebook\WebDriver\Exception\NoSuchElementException |
|
471
|
|
|
* @throws \Facebook\WebDriver\Exception\TimeOutException |
|
472
|
|
|
*/ |
|
473
|
|
|
public function goToOrder() |
|
474
|
|
|
{ |
|
475
|
|
|
$condition = WebDriverExpectedCondition::titleContains('Order'); |
|
476
|
|
|
$this->webDriver->wait()->until($condition); |
|
477
|
|
|
$this->assertTrue((bool) $condition); |
|
478
|
|
|
} |
|
479
|
|
|
|
|
480
|
|
|
/** |
|
481
|
|
|
* @throws \Facebook\WebDriver\Exception\NoSuchElementException |
|
482
|
|
|
* @throws \Facebook\WebDriver\Exception\TimeOutException |
|
483
|
|
|
*/ |
|
484
|
|
|
private function checkSimulator() |
|
485
|
|
|
{ |
|
486
|
|
|
$simulatorElementSearch = WebDriverBy::className('pagantisSimulator'); |
|
487
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($simulatorElementSearch); |
|
488
|
|
|
$this->webDriver->wait()->until($condition); |
|
489
|
|
|
$this->assertTrue((bool) $condition, "PR19//PR28"); |
|
490
|
|
|
} |
|
491
|
|
|
} |
|
492
|
|
|
|