Completed
Push — 4.0 ( 268f2c...88f012 )
by Hideki
05:48 queued 10s
created

_support/Page/Admin/ProductManagePage.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
206
    {
207
        $this->tester->click('#bulkDelete');
208
209
        return $this;
210
    }
211
212
    public function Cancel_削除($rowNum)
0 ignored issues
show
The parameter $rowNum is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
213
    {
214
        $this->tester->click('#bulkDeleteModal > div > div > div.modal-footer > button.btn.btn-ec-sub');
215
216
        return $this;
217
    }
218
219
    public function CSVダウンロード()
220
    {
221
        $this->tester->click('.c-contentsArea__cols .row div:nth-child(2) div:nth-child(2) a:nth-child(1)');
222
223
        return $this;
224
    }
225
226
    public function CSV出力項目設定()
227
    {
228
        $this->tester->click('.c-contentsArea__cols .row div:nth-child(2) div:nth-child(2) a:nth-child(2)');
229
230
        return $this;
231
    }
232
233
    public function すべて選択()
234
    {
235
        $this->tester->checkOption(['id' => 'trigger_check_all']);
236
237
        return $this;
238
    }
239
240
    public function 完全に削除()
241
    {
242
        $this->tester->click(['css' => '#form_bulk button.btn-ec-delete']);
243
        $this->tester->waitForElementVisible(['id' => 'bulkDelete']);
244
        $this->tester->click(['id' => 'bulkDelete']);
245
        $this->tester->waitForElementVisible(['id' => 'bulkDeleteDone']);
246
247
        return $this;
248
    }
249
250
    public function 一括削除完了()
251
    {
252
        $this->tester->click(['id' => 'bulkDeleteDone']);
253
254
        return $this;
255
    }
256
}
257