Failed Conditions
Pull Request — experimental/sf (#3236)
by Kentaro
121:51 queued 107:46
created

CustomerManagePage   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 94
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 94
rs 10
c 0
b 0
f 0
wmc 12
lcom 2
cbo 1
1
<?php
2
3
namespace Page\Admin;
4
5
6
class CustomerManagePage extends AbstractAdminPageStyleGuide
7
{
8
    public static $URL = '/customer';
9
10
    public static $検索ボタン = '#search_form .c-outsideBlock__contents button';
11
    public static $詳細検索ボタン = '//*[@id="search_form"]/div[1]/div[1]/div/div/div[2]/a/span';
12
    public static $検索結果メッセージ = '#search_form > div.c-outsideBlock__contents.mb-5 > span';
13
    public static $検索結果_結果なしメッセージ = '.c-contentsArea .c-contentsArea__cols div.text-center.h5';
14
    public static $検索結果_エラーメッセージ = '.c-contentsArea .c-contentsArea__cols div.text-center.h5';
15
    public static $検索条件_仮会員 = ['id' => 'admin_search_customer_customer_status_0'];
16
    public static $検索条件_本会員 = ['id' => 'admin_search_customer_customer_status_1'];
17
18
    /**
19
     * CustomerListPage constructor.
20
     * @param $I
21
     */
22
    public function __construct(\AcceptanceTester $I)
23
    {
24
        parent::__construct($I);
25
    }
26
27
    public static function go(\AcceptanceTester $I)
28
    {
29
        $page = new self($I);
30
        return $page->goPage(self::$URL, '会員マスター会員管理');
31
    }
32
33
    public function 検索($value = '')
34
    {
35
        $this->tester->fillField(['id' => 'admin_search_customer_multi'], $value);
36
        $this->tester->click(self::$検索ボタン);
37
        $this->tester->see('会員マスター会員管理', '.c-pageTitle');
38
        return $this;
39
    }
40
41
    public function 詳細検索_電話番号($value = '')
42
    {
43
        $this->tester->click(self::$詳細検索ボタン);
44
        $this->tester->wait(1);
45
        $this->tester->fillField(['id' => 'admin_search_customer_phone_number'], $value);
46
        $this->tester->click(self::$検索ボタン);
47
        $this->tester->see('会員マスター会員管理', '.c-pageTitle');
48
        return $this;
49
    }
50
51
    public function 一覧_編集($rowNum)
52
    {
53
        $this->tester->click("#search_form > div.c-contentsArea__cols > div > div > div.card.rounded.border-0.mb-4 > div > table > tbody > tr:nth-child(${rowNum}) > td:nth-child(2) > a");
54
        return $this;
55
    }
56
57
    public function 一覧_削除($rowNum, $execute = true)
58
    {
59
        $this->tester->click("#search_form > div.c-contentsArea__cols > div > div > div.card.rounded.border-0.mb-4 > div > table > tbody > tr:nth-child(${rowNum}) > td.align-middle.pr-3 > div > div > a");
60
        $this->tester->waitForElementVisible("#search_form > div.c-contentsArea__cols > div > div > div.card.rounded.border-0.mb-4 > div > table > tbody > tr:nth-child(${rowNum}) > td.align-middle.pr-3 > div > div > div.modal");
61
        $this->tester->wait(1);
62
        if ($execute) {
63
            $this->tester->click("#search_form > div.c-contentsArea__cols > div > div > div.card.rounded.border-0.mb-4 > div > table > tbody > tr:nth-child(${rowNum}) > td.align-middle.pr-3 > div > div > div.modal a.btn-ec-delete");
64
        } else {
65
            $this->tester->click("#search_form > div.c-contentsArea__cols > div > div > div.card.rounded.border-0.mb-4 > div > table > tbody > tr:nth-child(${rowNum}) > td.align-middle.pr-3 > div > div > div.modal button.btn-ec-sub");
66
        }
67
        return $this;
68
    }
69
70
    public function 一覧_仮会員メール再送($rowNum)
71
    {
72
        $this->tester->click(['xpath' => "//*[@id='search_form']//div/table/tbody/tr[${rowNum}]/td[6]/div/div[1]/a"]);
73
        $this->tester->wait(5);
74
        $this->tester->click('再送');
75
        return $this;
76
    }
77
78
    private function 一覧_メニュー($rowNum)
79
    {
80
        $this->tester->click("#search_form > div.row > div > div > div.box-body > div.table_list > div > table > tbody > tr:nth-child(${rowNum}) > td.icon_edit > div > a");
81
        return $this;
82
    }
83
84
    public function CSVダウンロード()
85
    {
86
        $this->tester->click('#search_form > div.c-contentsArea__cols > div > div > div.row.justify-content-between.mb-2 > div.col-5.text-right > div:nth-child(2) > div > button:nth-child(1)');
87
        return $this;
88
    }
89
90
    public function CSV出力項目設定()
91
    {
92
        $this->tester->click('#search_form > div.c-contentsArea__cols > div > div > div.row.justify-content-between.mb-2 > div.col-5.text-right > div:nth-child(2) > div > button:nth-child(2)');
93
    }
94
95
    public function 一覧_会員ID($rowNum)
96
    {
97
        return $this->tester->grabTextFrom("#search_form > div.c-contentsArea__cols > div > div > div.card.rounded.border-0.mb-4 > div > table > tbody > tr:nth-child(${rowNum}) > td.align-middle.pl-3");
98
    }
99
}
100