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

ProductManagePage   A

Complexity

Total Complexity 20

Size/Duplication

Total Lines 193
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 193
rs 10
c 0
b 0
f 0
wmc 20
lcom 2
cbo 1
1
<?php
2
3
namespace Page\Admin;
4
5
/**
6
 * 商品管理/商品マスター
7
 * @package Page\Admin
8
 */
9
class ProductManagePage extends AbstractAdminPageStyleGuide
10
{
11
    public static $URL = '/product';
12
13
    public static $検索条件_プロダクト = ['id' => 'admin_search_product_id'];
14
    public static $検索ボタン = '#search_form .c-outsideBlock__contents button';
15
    public static $詳細検索ボタン = '//*[@id="search_form"]/div[1]/div/div/div[2]/a/span';
16
    public static $検索結果_メッセージ = '#search_form > div.c-outsideBlock__contents.mb-5 > span';
17
    public static $検索結果_結果なしメッセージ = '.c-contentsArea .c-contentsArea__cols div.text-center.h5';
18
    public static $検索結果_エラーメッセージ = '.c-contentsArea .c-contentsArea__cols div.text-center.h5';
19
    public static $検索結果_一覧 = "#page_admin_product > div > div.c-contentsArea > div.c-contentsArea__cols > div > div > form > div.card.rounded.border-0.mb-4 > div.card-body.p-0 > table > tbody";
20
    public static $一括削除エラー = ['id' => 'bulkErrors'];
21
22
    /** @var \AcceptanceTester $tester */
23
    protected $tester;
24
25
    /**
26
     * ProductListPage constructor.
27
     */
28
    public function __construct(\AcceptanceTester $I)
29
    {
30
        parent::__construct($I);
31
    }
32
33
    public static function go(\AcceptanceTester $I)
34
    {
35
        $page = new ProductManagePage($I);
36
        return $page->goPage(self::$URL, '商品マスター商品管理');
37
    }
38
39
    /**
40
     * @param $second
41
     * @return $this
42
     */
43
    public function wait($second = 3)
44
    {
45
        $this->tester->wait($second);
46
        return $this;
47
    }
48
49
    /**
50
     * 指定した商品名/ID/コードで検索する。
51
     * @param string $product 商品名/ID/コード
52
     * @return $this
53
     */
54
    public function 検索($product = '')
55
    {
56
        $this->tester->fillField(self::$検索条件_プロダクト, $product);
57
        $this->tester->click(self::$検索ボタン);
58
        $this->tester->see('商品マスター商品管理', '.c-pageTitle');
59
        return $this;
60
    }
61
62
    public function 詳細検索_ステータス($value)
63
    {
64
        $this->tester->click(self::$詳細検索ボタン);
65
        $this->tester->wait(1);
66
        $this->tester->checkOption(['id' => 'admin_search_product_status_' . $value]);
67
        $this->tester->click(self::$検索ボタン);
68
        $this->tester->see('商品マスター商品管理', '.c-pageTitle');
69
        return $this;
70
    }
71
    /**
72
     * 検索結果の指定した行の規格設定に遷移。
73
     * @param int $rowNum 検索結果の行番号(1から始まる)
74
     * @return $this
75
     */
76
    public function 検索結果_規格設定($rowNum)
77
    {
78
        $this->tester->click("#main #result_list__list > div > div:nth-child(${rowNum}) > div:nth-child(4) > div > ul > li:nth-child(1) > a");
79
    }
80
81
    /**
82
     * 検索結果の指定した行の複製。
83
     * @param int $rowNum 検索結果の行番号(1から始まる)
84
     * @return $this
85
     */
86
    public function 検索結果_複製($rowNum)
87
    {
88
        $this->tester->click("#page_admin_product > div > div.c-contentsArea > div.c-contentsArea__cols > div > div > form > div.card.rounded.border-0.mb-4 > div.card-body.p-0 > table > tbody > tr:nth-child(${rowNum}) > td.align-middle.pr-3 > div > div:nth-child(2) > a");
89
        return $this;
90
    }
91
92
    /**
93
     * 検索結果の指定した行の確認。
94
     * @param int $rowNum 検索結果の行番号(1から始まる)
95
     * @return $this
96
     */
97
    public function 検索結果_確認($rowNum)
98
    {
99
        $this->tester->click("#page_admin_product > div > div.c-contentsArea > div.c-contentsArea__cols > div > div > form > div.card.rounded.border-0.mb-4 > div.card-body.p-0 > table > tbody > tr:nth-child(${rowNum}) > td.align-middle.pr-3 > div > div:nth-child(1) > a");
100
        return $this;
101
    }
102
103
    /**
104
     * 検索結果の指定した行を選択。
105
     * @param int $rowNum 検索結果の行番号(1から始まる)
106
     * @return $this
107
     */
108
    public function 検索結果_選択($rowNum)
109
    {
110
        $this->tester->click("#page_admin_product > div > div.c-contentsArea > div.c-contentsArea__cols > div > div > form > div.card.rounded.border-0.mb-4 > div.card-body.p-0 > table > tbody > tr:nth-child(${rowNum}) > td:nth-child(4) > a");
111
        return $this;
112
    }
113
114
    /**
115
     * Btn class product, list product search
116
     * @return $this
117
     */
118
    public function 規格確認ボタンをクリック()
119
    {
120
        $this->tester->click("#page_admin_product > div > div.c-contentsArea > div.c-contentsArea__cols > div > div > form > div.card.rounded.border-0.mb-4 > div.card-body.p-0 > table > tbody > tr > td:nth-child(7) > button.page-link");
121
        $this->tester->waitForElementVisible(['id' => 'productClassesModal']);
122
        $this->tester->wait(1);
123
        return $this;
124
    }
125
126
    /**
127
     * Btn class product, list product search
128
     * @return $this
129
     */
130
    public function 規格確認をキャンセル()
131
    {
132
        $this->tester->click("#page_admin_product div#productClassesModal .modal-footer button.btn-v-sub");
133
        $this->tester->waitForElementNotVisible(['id' => 'productClassesModal']);
134
        return $this;
135
    }
136
137
    /**
138
     * @return $this
139
     */
140
    public function 規格編集画面に遷移()
141
    {
142
        $this->tester->click("#page_admin_product div#productClassesModal .modal-footer a.btn-ec-conversion");
143
        return $this;
144
    }
145
146
    /**
147
     * 検索結果の指定した行を削除。
148
     * @param int $rowNum 検索結果の行番号(1から始まる)
149
     * @return $this
150
     */
151
    public function 検索結果_削除($rowNum)
152
    {
153
      $this->tester->click("#page_admin_product > div.c-container > div.c-contentsArea > div.c-contentsArea__cols > div > div > form > div.card.rounded.border-0.mb-4 > div.card-body.p-0 > table > tbody > tr:nth-child(${rowNum}) > td.align-middle.pr-3 > div > div:nth-child(3) > a");
154
      return $this;
155
    }
156
157
    public function Accept_削除($rowNum)
158
    {
159
        $this->tester->click("#page_admin_product > div.c-container > div.c-contentsArea > div.c-contentsArea__cols > div > div > form > div.card.rounded.border-0.mb-4 > div.card-body.p-0 > table > tbody > tr:nth-child(${rowNum}) > td.align-middle.pr-3 > div > div:nth-child(3) div.modal div.modal-footer a.btn-ec-delete");
160
        return $this;
161
    }
162
163
    public function Cancel_削除($rowNum)
164
    {
165
        $this->tester->click("#page_admin_product > div.c-container > div.c-contentsArea > div.c-contentsArea__cols > div > div > form > div.card.rounded.border-0.mb-4 > div.card-body.p-0 > table > tbody > tr:nth-child(${rowNum}) > td.align-middle.pr-3 > div > div:nth-child(3) button.btn.btn-ec-sub");
166
        return $this;
167
    }
168
169
    public function CSVダウンロード()
170
    {
171
        $this->tester->click('.c-contentsArea__cols .row div:nth-child(2) div:nth-child(2) button:nth-child(1)');
172
        return $this;
173
    }
174
175
    public function CSV出力項目設定()
176
    {
177
        $this->tester->click('.c-contentsArea__cols .row div:nth-child(2) div:nth-child(2) button:nth-child(2)');
178
        return $this;
179
    }
180
181
    public function すべて選択()
182
    {
183
        $this->tester->checkOption(['id' => 'check_all']);
184
        return $this;
185
    }
186
187
    public function 完全に削除()
188
    {
189
        $this->tester->click(['css' => '#form_bulk button.btn-ec-delete']);
190
        $this->tester->waitForElementVisible(['id' => 'bulkDelete']);
191
        $this->tester->click(['id' => 'bulkDelete']);
192
        $this->tester->waitForElementVisible(['id' => 'bulkDeleteDone']);
193
        return $this;
194
    }
195
196
    public function 一括削除完了()
197
    {
198
        $this->tester->click(['id' => 'bulkDeleteDone']);
199
        return $this;
200
    }
201
}
202