1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Pagantis\Pagantis\Test\Install; |
4
|
|
|
|
5
|
|
|
use Pagantis\Pagantis\Test\Common\AbstractMg21Selenium; |
6
|
|
|
use Facebook\WebDriver\WebDriverExpectedCondition; |
7
|
|
|
use Facebook\WebDriver\WebDriverBy; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class pagantisMgInstallTest |
11
|
|
|
* @package Pagantis\Test\Install |
12
|
|
|
* |
13
|
|
|
* @group magento-install |
14
|
|
|
*/ |
15
|
|
|
class pagantisMgInstallTest extends AbstractMg21Selenium |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @throws \Exception |
19
|
|
|
*/ |
20
|
|
|
public function testpagantisMg21InstallTest() |
21
|
|
|
{ |
22
|
|
|
$this->loginToBackOffice(); |
23
|
|
|
$this->getpagantisBackOffice(); |
24
|
|
|
$this->configurepagantis(); |
25
|
|
|
$this->quit(); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @require getpagantisBackOffice |
30
|
|
|
* |
31
|
|
|
* @throws \Exception |
32
|
|
|
*/ |
33
|
|
|
private function configurepagantis() |
34
|
|
|
{ |
35
|
|
|
$verify = WebDriverBy::id('payment_us_pagantis_pagantis_public_key'); |
36
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($verify); |
37
|
|
|
$this->webDriver->wait()->until($condition); |
38
|
|
|
$this->assertTrue((bool) $condition, "PR5"); |
39
|
|
|
|
40
|
|
|
$verify = WebDriverBy::id('payment_us_pagantis_pagantis_private_key'); |
41
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($verify); |
42
|
|
|
$this->webDriver->wait()->until($condition); |
43
|
|
|
$this->assertTrue((bool) $condition, "PR5"); |
44
|
|
|
|
45
|
|
|
$activeSelect = $this->findById('payment_us_pagantis_active'); |
46
|
|
|
$activeOptions = $activeSelect->findElements(WebDriverBy::xpath('option')); |
47
|
|
|
foreach ($activeOptions as $activeOption) { |
48
|
|
|
if ($activeOption->getText() == 'Yes') { |
49
|
|
|
$activeOption->click(); |
50
|
|
|
break; |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
$activeSelect = $this->findById('payment_us_pagantis_product_simulator'); |
55
|
|
|
$activeOptions = $activeSelect->findElements(WebDriverBy::xpath('option')); |
56
|
|
|
foreach ($activeOptions as $activeOption) { |
57
|
|
|
if ($activeOption->getText() == 'Yes') { |
58
|
|
|
$activeOption->click(); |
59
|
|
|
break; |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
$this->findById('payment_us_pagantis_pagantis_public_key')->clear()->sendKeys($this->configuration['publicKey']); |
64
|
|
|
$this->findById('payment_us_pagantis_pagantis_private_key')->clear()->sendKeys($this->configuration['secretKey']); |
65
|
|
|
|
66
|
|
|
$this->findById('config-edit-form')->submit(); |
67
|
|
|
|
68
|
|
|
$validatorSearch = WebDriverBy::className('message-success'); |
69
|
|
|
$actualString = $this->webDriver->findElement($validatorSearch)->getText(); |
70
|
|
|
$compareString = (strstr($actualString, 'You saved the configuration')) === false ? false : true; |
71
|
|
|
$this->assertTrue($compareString, $actualString); |
72
|
|
|
|
73
|
|
|
$enabledModule = $this->findByCss("select#payment_us_pagantis_active > option[selected]"); |
74
|
|
|
$this->assertEquals($enabledModule->getText(), 'Yes', 'PR6'); |
75
|
|
|
|
76
|
|
|
$verify = WebDriverBy::id('payment_us_pagantis_active'); |
77
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($verify); |
78
|
|
|
$this->webDriver->wait()->until($condition); |
79
|
|
|
$this->assertTrue((bool) $condition, "PR7"); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|