Completed
Push — master ( b21958...b5070f )
by Dmitry
33s
created

DomainsCest::ensureICanSeeAdvancedSearchBox()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 27

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 9.488
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace hipanel\modules\hosting\tests\acceptance\client;
4
5
use hipanel\helpers\Url;
6
use hipanel\tests\_support\Page\IndexPage;
7
use hipanel\tests\_support\Step\Acceptance\Client;
8
9
class DomainsCest
10
{
11
    /**
12
     * @var IndexPage
13
     */
14
    private $index;
15
16
    public function _before(Client $I)
17
    {
18
        $this->index = new IndexPage($I);
19
    }
20
21 View Code Duplication
    public function ensureIndexPageWorks(Client $I)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
22
    {
23
        $I->login();
24
        $I->needPage(Url::to('@hdomain'));
25
        $I->see('Domains', 'h1');
26
        $this->ensureICanSeeAdvancedSearchBox($I);
27
        $this->ensureICanSeeLegendBox($I);
28
        $this->ensureICanSeeBulkSearchBox();
29
    }
30
31
    private function ensureICanSeeAdvancedSearchBox(Client $I)
32
    {
33
        $I->see('Create domain', 'a');
34
        $I->see('Advanced search', 'h3');
35
36
        $formId = 'form-advancedsearch-hdomain-search';
37
        $this->index->containsFilters($formId, [
38
            ['input' => [
39
                'id' => 'hdomainsearch-domain_like',
40
                'placeholder' => 'Domain name',
41
            ]],
42
            ['input' => [
43
                'id' => 'hdomainsearch-domain_in',
44
            ]],
45
            ['input' => [
46
                'id' => 'hdomainsearch-ip',
47
                'placeholder' => 'IP',
48
            ]],
49
        ]);
50
51
        $I->see('Status', "//form[@id='$formId']//span");
52
        $I->see('Show aliases only', "//form[@id='$formId']//span");
53
        $I->see('Server', "//form[@id='$formId']//span");
54
        $I->see('Domain name', "//form[@id='$formId']//label");
55
        $I->see('Domain list (comma-separated)', "//form[@id='$formId']//label");
56
        $I->see('Type', "//form[@id='$formId']//label");
57
    }
58
59 View Code Duplication
    private function ensureICanSeeLegendBox(Client $I)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
60
    {
61
        $I->see('Legend', 'h3');
62
63
        $legend = [
64
            'Domain',
65
            'DNS records',
66
            'Alias',
67
            'Name server',
68
            'Complex domain',
69
        ];
70
        foreach ($legend as $text) {
71
            $I->see($text, '//ul/li');
72
        }
73
    }
74
75 View Code Duplication
    private function ensureICanSeeBulkSearchBox()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
76
    {
77
        $this->index->containsBulkButtons([
78
            ["//button[@type='submit']" => 'Delete'],
79
        ]);
80
        $this->index->containsColumns('bulk-hdomain-search', [
81
            'Domain name',
82
            'Account',
83
            'Server',
84
            'Status',
85
            'IP',
86
            'Service',
87
        ]);
88
    }
89
}
90