Completed
Push — master ( b496ad...92fc11 )
by Dmitry
07:25
created

AccountRechargingCest::ensureIndexPageWorks()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace hipanel\modules\finance\tests\acceptance\client;
4
5
use hipanel\helpers\Url;
6
use hipanel\tests\_support\Step\Acceptance\Client;
7
8
class AccountRechargingCest
9
{
10
    public function ensureIndexPageWorks(Client $I)
11
    {
12
        $I->login();
13
        $I->needPage(Url::to('@pay/deposit'));
14
        $I->see('Account recharging', 'h1');
15
        $this->ensureICanSeeDepositBox($I);
16
        $this->ensureICanSeePaymentBox($I);
17
        $this->ensureICanSeeWarningBox($I);
18
    }
19
20
    private function ensureICanSeeDepositBox(Client $I)
21
    {
22
        $url = Url::to('@pay/deposit');
23
        $form = "//form[@action='$url']";
24
        $I->see('Amount', "$form/label");
25
        $I->seeElement('input', ['id' => 'depositform-amount']);
26
        $text = 'Enter the amount of the replenishment in dollars. For example: 8.79';
27
        $I->see($text, $form);
28
        $I->see('Proceed', "$form/button[@type='submit']");
29
    }
30
31
    private function ensureICanSeePaymentBox(Client $I)
32
    {
33
        $I->see('Available payment methods', 'h3');
34
        $I->see('We support fully automatic account depositing with the following payment systems:');
35
    }
36
37
    private function ensureICanSeeWarningBox(Client $I)
38
    {
39
        $I->see('Important information', 'h4');
40
        $text = 'Remember to return to the site after successful payment!';
41
        $I->see($text, 'p');
42
    }
43
}
44