Completed
Push — master ( f3d63a...ac0cda )
by Andrii
04:25
created

ServerIndexCest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 21
c 0
b 0
f 0
dl 0
loc 42
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A ensureIndexPageWorks() 0 7 1
A _before() 0 3 1
A ensureICanSeeAdvancedSearchBox() 0 8 1
A ensureICanSeeBulkServerSearchBox() 0 10 1
1
<?php
2
/**
3
 * Server module for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-server
6
 * @package   hipanel-module-server
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\server\tests\acceptance\client;
12
13
use hipanel\helpers\Url;
14
use hipanel\tests\_support\Page\IndexPage;
15
use hipanel\tests\_support\Page\Widget\Input\Input;
16
use hipanel\tests\_support\Page\Widget\Input\Select2;
17
use hipanel\tests\_support\Step\Acceptance\Client;
18
19
class ServerIndexCest
20
{
21
    /**
22
     * @var IndexPage
23
     */
24
    private $index;
25
26
    public function _before(Client $I)
27
    {
28
        $this->index = new IndexPage($I);
29
    }
30
31
    public function ensureIndexPageWorks(Client $I)
32
    {
33
        $I->login();
34
        $I->needPage(Url::to('@server'));
35
        $I->see('Servers', 'h1');
36
        $this->ensureICanSeeAdvancedSearchBox($I);
37
        $this->ensureICanSeeBulkServerSearchBox();
38
    }
39
40
    private function ensureICanSeeAdvancedSearchBox(Client $I)
41
    {
42
        $this->index->containsFilters([
43
            Input::asAdvancedSearch($I, 'Name'),
44
            Input::asAdvancedSearch($I, 'Note'),
45
            Input::asAdvancedSearch($I, 'IP'),
46
            Select2::asAdvancedSearch($I, 'Type'),
47
            Select2::asAdvancedSearch($I, 'Status'),
48
        ]);
49
    }
50
51
    private function ensureICanSeeBulkServerSearchBox()
52
    {
53
        $this->index->containsBulkButtons([
54
            'Basic actions',
55
        ]);
56
        $this->index->containsColumns([
57
            'Name',
58
            'IPs',
59
            'Tariff',
60
            'Hardware Summary',
61
        ]);
62
    }
63
}
64