MailboxesCest::ensureICanSeeBulkSearchBox()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Hosting Plugin for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-hosting
6
 * @package   hipanel-module-hosting
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\hosting\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 MailboxesCest
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('@mail'));
35
        $I->see('Mailboxes', 'h1');
36
        $I->seeLink('Create mailbox', Url::to('create'));
37
        $this->ensureICanSeeAdvancedSearchBox($I);
38
        $this->ensureICanSeeLegendBox();
39
        $this->ensureICanSeeBulkSearchBox();
40
    }
41
42
    private function ensureICanSeeAdvancedSearchBox(Client $I)
43
    {
44
        $this->index->containsFilters([
45
            Input::asAdvancedSearch($I, 'E-mail'),
46
            Select2::asAdvancedSearch($I, 'Server'),
47
            Select2::asAdvancedSearch($I, 'Status'),
48
            Select2::asAdvancedSearch($I, 'Type'),
49
        ]);
50
    }
51
52
    private function ensureICanSeeLegendBox()
53
    {
54
        $this->index->containsLegend([
55
            'Mail box',
56
            'Mail alias',
57
            'Mail box with aliases',
58
        ]);
59
    }
60
61
    private function ensureICanSeeBulkSearchBox()
62
    {
63
        $this->index->containsBulkButtons([
64
            'Enable',
65
            'Disable',
66
            'Delete',
67
        ]);
68
        $this->index->containsColumns([
69
            'E-mail',
70
            'Forwarding',
71
            'Server',
72
            'Account',
73
            'Status',
74
        ]);
75
    }
76
}
77