Completed
Push — master ( 1b679c...e05b34 )
by
unknown
12s queued 10s
created

pagantisMgInstallTest   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 41
dl 0
loc 78
rs 10
c 1
b 0
f 0
wmc 8

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testPagantisMg21ConfigureTest() 0 5 1
B configurepagantis() 0 47 6
A testPagantisMg21InstallTest() 0 6 1
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
 */
14
class pagantisMgInstallTest extends AbstractMg21Selenium
15
{
16
    /**
17
     * testPagantisMg21InstallTest
18
     * @group magento-install
19
     * @throws \Exception
20
     */
21
    public function testPagantisMg21InstallTest()
22
    {
23
        $this->loginToBackOffice();
24
        $this->getpagantisBackOffice();
25
        $this->configurepagantis();
26
        $this->quit();
27
    }
28
29
    /**
30
     * testPagantisMg21ConfigureTest
31
     * @group magento-configure
32
     */
33
    public function testPagantisMg21ConfigureTest()
34
    {
35
        $this->loginToBackOffice();
36
        $this->configurepagantis();
37
        $this->quit();
38
    }
39
40
    /**
41
     * @require getpagantisBackOffice
42
     *
43
     * @throws \Exception
44
     */
45
    private function configurepagantis()
46
    {
47
        $verify = WebDriverBy::id('payment_us_pagantis_pagantis_public_key');
48
        $condition = WebDriverExpectedCondition::visibilityOfElementLocated($verify);
49
        $this->webDriver->wait()->until($condition);
50
        $this->assertTrue((bool) $condition, "PR5");
51
52
        $verify = WebDriverBy::id('payment_us_pagantis_pagantis_private_key');
53
        $condition = WebDriverExpectedCondition::visibilityOfElementLocated($verify);
54
        $this->webDriver->wait()->until($condition);
55
        $this->assertTrue((bool) $condition, "PR5");
56
57
        $activeSelect = $this->findById('payment_us_pagantis_active');
58
        $activeOptions = $activeSelect->findElements(WebDriverBy::xpath('option'));
59
        foreach ($activeOptions as $activeOption) {
60
            if ($activeOption->getText() == 'Yes') {
61
                $activeOption->click();
62
                break;
63
            }
64
        }
65
66
        $activeSelect = $this->findById('payment_us_pagantis_product_simulator');
67
        $activeOptions = $activeSelect->findElements(WebDriverBy::xpath('option'));
68
        foreach ($activeOptions as $activeOption) {
69
            if ($activeOption->getText() == 'Yes') {
70
                $activeOption->click();
71
                break;
72
            }
73
        }
74
75
        $this->findById('payment_us_pagantis_pagantis_public_key')->clear()->sendKeys($this->configuration['publicKey']);
76
        $this->findById('payment_us_pagantis_pagantis_private_key')->clear()->sendKeys($this->configuration['secretKey']);
77
78
        $this->findById('config-edit-form')->submit();
79
80
        $validatorSearch = WebDriverBy::className('message-success');
81
        $actualString = $this->webDriver->findElement($validatorSearch)->getText();
82
        $compareString = (strstr($actualString, 'You saved the configuration')) === false ? false : true;
83
        $this->assertTrue($compareString, $actualString);
84
85
        $enabledModule = $this->findByCss("select#payment_us_pagantis_active > option[selected]");
86
        $this->assertEquals($enabledModule->getText(), 'Yes', 'PR6');
87
88
        $verify = WebDriverBy::id('payment_us_pagantis_active');
89
        $condition = WebDriverExpectedCondition::visibilityOfElementLocated($verify);
90
        $this->webDriver->wait()->until($condition);
91
        $this->assertTrue((bool) $condition, "PR7");
92
    }
93
}
94