Completed
Push — master ( add5f2...98e00e )
by Dmitry
04:29
created

SwitchesCest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 42
dl 0
loc 69
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A _before() 0 3 1
A ensureIndexPageWorks() 0 9 1
A ensureICanSeeBulkServerSearchBox() 0 12 1
A ensureICanSeeLegendBox() 0 11 1
A ensureICanSeeAdvancedSearchBox() 0 16 1
1
<?php
2
3
namespace hipanel\modules\server\tests\acceptance\admin;
4
5
use hipanel\helpers\Url;
6
use hipanel\tests\_support\Page\IndexPage;
7
use hipanel\tests\_support\Page\Widget\Input\Dropdown;
8
use hipanel\tests\_support\Page\Widget\Input\Input;
9
use hipanel\tests\_support\Step\Acceptance\Admin;
10
11
class SwitchesCest
12
{
13
    /**
14
     * @var IndexPage
15
     */
16
    private $index;
17
18
    public function _before(Admin $I)
19
    {
20
        $this->index = new IndexPage($I);
21
    }
22
23
    public function ensureIndexPageWorks(Admin $I)
24
    {
25
        $I->login();
26
        $I->needPage(Url::to('@hub'));
27
        $I->see('Switches', 'h1');
28
        $I->seeLink('Create switch', Url::to('@hub/create'));
29
        $this->ensureICanSeeAdvancedSearchBox();
30
        $this->ensureICanSeeLegendBox();
31
        $this->ensureICanSeeBulkServerSearchBox();
32
    }
33
34
    private function ensureICanSeeAdvancedSearchBox()
35
    {
36
        $this->index->containsFilters([
37
            new Input('Switch'),
38
            new Input('INN'),
39
            new Input('IP'),
40
            new Input('MAC address'),
41
            new Input('Model'),
42
            new Input('Order No.'),
43
            (new Dropdown('hubsearch-type_id'))->withItems([
44
                'Switch',
45
                'KVM',
46
                'APC',
47
                'Rack',
48
                'IPMI',
49
                'Module',
50
            ]),
51
        ]);
52
    }
53
54
    private function ensureICanSeeLegendBox()
55
    {
56
        $this->index->containsLegend([
57
            'Switch',
58
            'KVM',
59
            'APC',
60
            'IPMI',
61
            'Module',
62
            'Rack',
63
            'Camera',
64
            'Cable organizer',
65
        ]);
66
    }
67
68
    private function ensureICanSeeBulkServerSearchBox()
69
    {
70
        $this->index->containsBulkButtons([
71
            'Update',
72
        ]);
73
        $this->index->containsColumns([
74
            'Name',
75
            'INN',
76
            'Model',
77
            'Type',
78
            'IP',
79
            'MAC address',
80
        ]);
81
    }
82
}
83