1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace DigitalOrigin\Pmt\Test\Install; |
4
|
|
|
|
5
|
|
|
use DigitalOrigin\Pmt\Test\Common\AbstractMg21Selenium; |
6
|
|
|
use Facebook\WebDriver\WebDriverExpectedCondition; |
7
|
|
|
use Facebook\WebDriver\WebDriverBy; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class PaylaterMgInstallTest |
11
|
|
|
* @package DigitalOrigin\Test\Install |
12
|
|
|
* |
13
|
|
|
* @group magento-install |
14
|
|
|
*/ |
15
|
|
|
class PaylaterMgInstallTest extends AbstractMg21Selenium |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @throws \Exception |
19
|
|
|
*/ |
20
|
|
|
public function testPaylaterMg21InstallTest() |
21
|
|
|
{ |
22
|
|
|
$this->loginToBackOffice(); |
23
|
|
|
$this->getPaylaterBackOffice(); |
24
|
|
|
$this->configurePaylater(); |
25
|
|
|
$this->quit(); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @require getPaylaterBackOffice |
30
|
|
|
* |
31
|
|
|
* @throws \Exception |
32
|
|
|
*/ |
33
|
|
|
private function configurePaylater() |
34
|
|
|
{ |
35
|
|
|
$verify = WebDriverBy::id('payment_us_paylater_pmt_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_paylater_pmt_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_paylater_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
|
|
|
$this->findById('payment_us_paylater_pmt_public_key')->clear()->sendKeys($this->configuration['publicKey']); |
54
|
|
|
$this->findById('payment_us_paylater_pmt_private_key')->clear()->sendKeys($this->configuration['secretKey']); |
55
|
|
|
|
56
|
|
|
$this->findById('payment_us_paylater_title')->clear()->sendKeys($this->configuration['methodName']); |
57
|
|
|
$simulatorCss = "option[value='".$this->configuration['defaultSimulatorOpt']."']"; |
58
|
|
|
$this->webDriver->findElement(WebDriverBy::id('payment_us_paylater_product_simulator')) |
59
|
|
|
->findElement(WebDriverBy::cssSelector($simulatorCss)) |
60
|
|
|
->click(); |
61
|
|
|
|
62
|
|
|
$this->findById('config-edit-form')->submit(); |
63
|
|
|
|
64
|
|
|
$validatorSearch = WebDriverBy::className('message-success'); |
65
|
|
|
$actualString = $this->webDriver->findElement($validatorSearch)->getText(); |
66
|
|
|
$compareString = (strstr($actualString, 'You saved the configuration')) === false ? false : true; |
67
|
|
|
$this->assertTrue($compareString, $actualString); |
68
|
|
|
|
69
|
|
|
$enabledModule = $this->findByCss("select#payment_us_paylater_active > option[selected]"); |
70
|
|
|
$this->assertEquals($enabledModule->getText(), 'Yes', 'PR6'); |
71
|
|
|
|
72
|
|
|
$verify = WebDriverBy::id('payment_us_paylater_active'); |
73
|
|
|
$condition = WebDriverExpectedCondition::visibilityOfElementLocated($verify); |
74
|
|
|
$this->webDriver->wait()->until($condition); |
75
|
|
|
$this->assertTrue((bool) $condition, "PR7"); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|