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 | use Codeception\Util\Fixtures; |
||
15 | use Page\Admin\CategoryCsvUploadPage; |
||
16 | use Page\Admin\CategoryManagePage; |
||
17 | use Page\Admin\ClassCategoryManagePage; |
||
18 | use Page\Admin\ClassNameManagePage; |
||
19 | use Page\Admin\CsvSettingsPage; |
||
20 | use Page\Admin\ProductClassEditPage; |
||
21 | use Page\Admin\ProductCsvUploadPage; |
||
22 | use Page\Admin\ProductEditPage; |
||
23 | use Page\Admin\ProductManagePage; |
||
24 | |||
25 | /** |
||
26 | * @group admin |
||
27 | * @group admin01 |
||
28 | * @group product |
||
29 | * @group ea3 |
||
30 | */ |
||
31 | class EA03ProductCest |
||
32 | { |
||
33 | const ページタイトル = '#main .page-header'; |
||
34 | const ページタイトルStyleGuide = '.c-pageTitle'; |
||
35 | |||
36 | public function _before(\AcceptanceTester $I) |
||
37 | { |
||
38 | // すべてのテストケース実施前にログインしておく |
||
39 | // ログイン後は管理アプリのトップページに遷移している |
||
40 | $I->loginAsAdmin(); |
||
41 | } |
||
42 | |||
43 | public function _after(\AcceptanceTester $I) |
||
44 | { |
||
45 | } |
||
46 | |||
47 | View Code Duplication | public function product_商品検索(\AcceptanceTester $I) |
|
48 | { |
||
49 | $I->wantTo('EA0301-UC01-T01 (& UC01-T02) 商品検索'); |
||
50 | |||
51 | ProductManagePage::go($I)->検索('ジェラート'); |
||
52 | |||
53 | $I->see('検索結果:1件が該当しました', ProductManagePage::$検索結果_メッセージ); |
||
54 | $I->see('彩のジェラートCUBE', ProductManagePage::$検索結果_一覧); |
||
55 | |||
56 | ProductManagePage::go($I)->検索('[email protected]'); |
||
57 | $I->see('検索結果:0件が該当しました', ProductManagePage::$検索結果_メッセージ); |
||
58 | } |
||
59 | |||
60 | public function product_商品検索エラー(\AcceptanceTester $I) |
||
61 | { |
||
62 | $I->wantTo('EA0301-UC01-T03 商品検索 エラー'); |
||
63 | |||
64 | // バリデーションエラーが発生するフォーム項目がないため, ダミーのステータスを作っておく |
||
65 | /** @var \Doctrine\ORM\EntityManager $em */ |
||
66 | $em = Fixtures::get('entityManager'); |
||
67 | $ProductStatus = new \Eccube\Entity\Master\ProductStatus(); |
||
68 | $ProductStatus->setName('ダミー'); |
||
69 | $ProductStatus->setSortNo(999); |
||
70 | $ProductStatus->setId(999); |
||
71 | $em->persist($ProductStatus); |
||
72 | $em->flush(); |
||
73 | |||
74 | // 商品一覧を表示 |
||
75 | $page = ProductManagePage::go($I); |
||
76 | |||
77 | // ダミーのステータスを削除する |
||
78 | $em->remove($ProductStatus); |
||
79 | $em->flush(); |
||
80 | |||
81 | // 存在しないステータスで検索するため, `有効な値ではありません`のバリデーションエラーが発生するはず |
||
82 | $page->詳細検索_ステータス(999); |
||
83 | $I->see('検索条件に誤りがあります', ProductManagePage::$検索結果_エラーメッセージ); |
||
84 | } |
||
85 | |||
86 | View Code Duplication | public function product_規格確認のポップアップ表示(\AcceptanceTester $I) |
|
87 | { |
||
88 | $I->wantTo('EA0301-UC01-T03 規格確認のポップアップを表示'); |
||
89 | |||
90 | ProductManagePage::go($I) |
||
91 | ->検索(1) |
||
92 | ->規格確認ボタンをクリック(1) |
||
93 | ->規格確認をキャンセル(); |
||
94 | |||
95 | $I->dontSeeElement(['css' => 'div.modal.show']); |
||
96 | } |
||
97 | |||
98 | View Code Duplication | public function product_ポップアップから規格編集画面に遷移(\AcceptanceTester $I) |
|
99 | { |
||
100 | $I->wantTo('EA0301-UC01-T04 ポップアップから規格編集画面に遷移'); |
||
101 | |||
102 | ProductManagePage::go($I) |
||
103 | ->検索(1) |
||
104 | ->規格確認ボタンをクリック(1) |
||
105 | ->規格編集画面に遷移(); |
||
106 | |||
107 | $I->see('商品規格登録商品管理', self::ページタイトルStyleGuide); |
||
108 | } |
||
109 | |||
110 | public function product_商品検索結果無(\AcceptanceTester $I) |
||
111 | { |
||
112 | $I->wantTo('EA0301-UC01-T02 商品検索 検索結果なし'); |
||
113 | |||
114 | ProductManagePage::go($I)->検索('お箸'); |
||
115 | |||
116 | $I->see('検索条件に合致するデータが見つかりませんでした', ProductManagePage::$検索結果_結果なしメッセージ); |
||
117 | } |
||
118 | |||
119 | /** |
||
120 | * @env firefox |
||
121 | * @env chrome |
||
122 | */ |
||
123 | public function product_CSV出力(\AcceptanceTester $I) |
||
124 | { |
||
125 | $I->wantTo('EA0301-UC02-T01 CSV出力'); |
||
126 | |||
127 | $findProducts = Fixtures::get('findProducts'); |
||
128 | $Products = $findProducts(); |
||
129 | ProductManagePage::go($I) |
||
130 | ->検索() |
||
131 | ->CSVダウンロード(); |
||
132 | |||
133 | $I->see('検索結果:'.count($Products).'件が該当しました', ProductManagePage::$検索結果_メッセージ); |
||
134 | |||
135 | $ProductCSV = $I->getLastDownloadFile('/^product_\d{14}\.csv$/'); |
||
136 | $I->assertGreaterOrEquals(count($Products), count(file($ProductCSV)), '検索結果以上の行数があるはず'); |
||
137 | } |
||
138 | |||
139 | View Code Duplication | public function product_CSV出力項目設定(\AcceptanceTester $I) |
|
140 | { |
||
141 | $I->wantTo('EA0301-UC02-T02 CSV出力項目設定'); |
||
142 | |||
143 | ProductManagePage::go($I) |
||
144 | ->検索() |
||
145 | ->CSV出力項目設定(); |
||
146 | |||
147 | $I->see('CSV出力項目設定店舗設定', self::ページタイトルStyleGuide); |
||
148 | $value = $I->grabValueFrom(CsvSettingsPage::$CSVタイプ); |
||
149 | $I->assertEquals('1', $value); |
||
150 | } |
||
151 | |||
152 | public function product_一覧からの規格編集規格なし失敗(\AcceptanceTester $I) |
||
153 | { |
||
154 | $I->wantTo('EA0310-UC01-T02 一覧からの規格編集 規格なし 失敗'); |
||
155 | |||
156 | ProductManagePage::go($I) |
||
157 | ->検索('規格なし商品') |
||
158 | ->検索結果_選択(1); |
||
159 | |||
160 | ProductEditPage::at($I) |
||
161 | ->規格管理(); |
||
162 | |||
163 | ProductClassEditPage::at($I) |
||
164 | ->規格設定(); |
||
165 | |||
166 | $I->seeElement(['css' => '#product_class_matrix_class_name1:invalid']); //規格1がエラー |
||
167 | $I->dontSeeElement(ProductClassEditPage::$規格一覧); // 規格編集行が表示されていない |
||
168 | } |
||
169 | |||
170 | public function product_一覧からの規格編集規格なし_(\AcceptanceTester $I) |
||
171 | { |
||
172 | $I->wantTo('EA0310-UC01-T01 一覧からの規格編集 規格なし'); |
||
173 | |||
174 | ProductManagePage::go($I) |
||
175 | ->検索('規格なし商品') |
||
176 | ->検索結果_選択(1); |
||
177 | |||
178 | ProductEditPage::at($I) |
||
179 | ->規格管理(); |
||
180 | |||
181 | $ProductClassEditPage = ProductClassEditPage::at($I) |
||
182 | ->入力_規格1('フレーバー') |
||
183 | ->規格設定(); |
||
184 | |||
185 | $I->see('3件の組み合わせがあります', 'div.c-contentsArea__cols > div > div > form div.card-header > div > div.col-6 > span'); |
||
186 | |||
187 | $ProductClassEditPage |
||
188 | ->選択(1) |
||
189 | ->入力_在庫数無制限(1) |
||
190 | ->入力_販売価格(1, 1000) |
||
191 | ->選択(2) |
||
192 | ->入力_在庫数無制限(2) |
||
193 | ->入力_販売価格(2, 1000) |
||
194 | ->選択(3) |
||
195 | ->入力_在庫数無制限(3) |
||
196 | ->入力_販売価格(3, 1000) |
||
197 | ->登録(); |
||
198 | |||
199 | $I->waitForElement(ProductClassEditPage::$登録完了メッセージ); |
||
200 | $I->see('保存しました', ProductClassEditPage::$登録完了メッセージ); |
||
201 | $I->seeElement(ProductClassEditPage::$初期化ボタン); |
||
202 | } |
||
203 | |||
204 | public function product_一覧からの規格編集規格あり2(\AcceptanceTester $I) |
||
205 | { |
||
206 | $I->wantTo('EA0310-UC02-T02 一覧からの規格編集 規格あり2'); |
||
207 | |||
208 | $findProducts = Fixtures::get('findProducts'); |
||
209 | $Products = array_filter($findProducts(), function ($Product) { |
||
210 | return $Product->hasProductClass(); |
||
211 | }); |
||
212 | $Product = array_pop($Products); |
||
213 | ProductManagePage::go($I) |
||
214 | ->検索($Product->getName()) |
||
215 | ->検索結果_選択(1); |
||
216 | |||
217 | ProductEditPage::at($I) |
||
218 | ->規格管理(); |
||
219 | |||
220 | ProductClassEditPage::at($I) |
||
221 | ->登録(); |
||
222 | |||
223 | $I->see('保存しました', ProductClassEditPage::$登録完了メッセージ); |
||
224 | } |
||
225 | |||
226 | public function product_一覧からの商品複製(\AcceptanceTester $I) |
||
227 | { |
||
228 | $I->wantTo('EA0310-UC05-T02 一覧からの商品複製'); |
||
229 | |||
230 | $findProducts = Fixtures::get('findProducts'); |
||
231 | $Products = array_filter($findProducts(), function ($Product) { |
||
232 | return $Product->hasProductClass(); |
||
233 | }); |
||
234 | $Product = array_pop($Products); |
||
235 | ProductManagePage::go($I) |
||
236 | ->検索($Product->getName()) |
||
237 | ->検索結果_複製(1) |
||
238 | ->Accept_複製する(1); |
||
239 | |||
240 | $I->see('商品を複製しました', ProductEditPage::$登録結果メッセージ); |
||
241 | } |
||
242 | |||
243 | /** |
||
244 | * ATTENTION 削除すると後続の規格編集関連のテストが失敗するため、最後に実行する |
||
245 | */ |
||
246 | public function product_一覧からの規格編集規格あり1(\AcceptanceTester $I) |
||
247 | { |
||
248 | $I->wantTo('EA0310-UC02-T01 一覧からの規格編集 規格あり1'); |
||
249 | |||
250 | $findProducts = Fixtures::get('findProducts'); |
||
251 | $Products = array_filter($findProducts(), function ($Product) { |
||
252 | return $Product->hasProductClass(); |
||
253 | }); |
||
254 | $Product = array_pop($Products); |
||
255 | ProductManagePage::go($I) |
||
256 | ->検索($Product->getName()) |
||
257 | ->検索結果_選択(1); |
||
258 | |||
259 | ProductEditPage::at($I) |
||
260 | ->規格管理(); |
||
261 | |||
262 | $I->seeElement(ProductClassEditPage::$規格一覧); |
||
263 | |||
264 | ProductClassEditPage::at($I) |
||
265 | ->規格初期化(); |
||
266 | |||
267 | $I->see('商品規格を初期化しました', ProductClassEditPage::$登録完了メッセージ); |
||
268 | $I->dontSeeElement(ProductClassEditPage::$規格一覧); |
||
269 | } |
||
270 | |||
271 | View Code Duplication | public function product_商品登録非公開(\AcceptanceTester $I) |
|
272 | { |
||
273 | $I->wantTo('EA0302-UC01-T01 商品登録 非公開'); |
||
274 | |||
275 | ProductEditPage::go($I) |
||
276 | ->入力_商品名('test product1') |
||
277 | ->入力_販売価格('1000') |
||
278 | ->入力_カテゴリ(1) |
||
279 | ->登録(); |
||
280 | |||
281 | $I->see('保存しました', ProductEditPage::$登録結果メッセージ); |
||
282 | } |
||
283 | |||
284 | View Code Duplication | public function product_商品登録公開(\AcceptanceTester $I) |
|
285 | { |
||
286 | $I->wantTo('EA0302-UC01-T02 商品登録 公開'); |
||
287 | |||
288 | ProductEditPage::go($I) |
||
289 | ->入力_商品名('test product2') |
||
290 | ->入力_販売価格('1000') |
||
291 | ->入力_カテゴリ(1) |
||
292 | ->入力_公開() |
||
293 | ->登録(); |
||
294 | |||
295 | $I->see('保存しました', ProductEditPage::$登録結果メッセージ); |
||
296 | } |
||
297 | |||
298 | public function product_商品編集規格なし(\AcceptanceTester $I) |
||
299 | { |
||
300 | $I->wantTo('EA0302-UC01-T03 商品編集 規格なし'); |
||
301 | |||
302 | ProductManagePage::go($I) |
||
303 | ->検索('test product1') |
||
304 | ->検索結果_選択(1); |
||
305 | |||
306 | ProductEditPage::at($I) |
||
307 | ->入力_商品名('test product11') |
||
308 | ->入力_カテゴリ(1) |
||
309 | ->入力_カテゴリ(2) |
||
310 | ->登録(); |
||
311 | |||
312 | $I->see('保存しました', ProductEditPage::$登録結果メッセージ); |
||
313 | } |
||
314 | |||
315 | public function product_商品編集規格あり(\AcceptanceTester $I) |
||
316 | { |
||
317 | $I->wantTo('EA0302-UC01-T04 商品編集 規格あり'); |
||
318 | |||
319 | // 規格なし商品では商品種別等が編集可能 |
||
320 | ProductManagePage::go($I) |
||
321 | ->検索('チェリーアイスサンド') |
||
322 | ->検索結果_選択(1); |
||
323 | ProductEditPage::at($I); |
||
324 | |||
325 | $I->seeElement(ProductEditPage::$販売種別); |
||
326 | $I->seeElement(ProductEditPage::$販売価格); |
||
327 | $I->waitForElement(ProductEditPage::$通常価格); |
||
328 | $I->seeElement(ProductEditPage::$在庫数); |
||
329 | $I->waitForElement(ProductEditPage::$商品コード); |
||
330 | $I->seeElement(ProductEditPage::$販売制限数); |
||
331 | $I->seeElement(ProductEditPage::$お届可能日); |
||
332 | |||
333 | // 規格あり商品では商品種別等が編集不可 |
||
334 | ProductManagePage::go($I) |
||
335 | ->検索('彩のジェラートCUBE') |
||
336 | ->検索結果_選択(1); |
||
337 | $ProductEditPage = ProductEditPage::at($I); |
||
338 | |||
339 | $I->dontSeeElements([ |
||
340 | ProductEditPage::$販売種別, |
||
341 | ProductEditPage::$販売価格, |
||
342 | ProductEditPage::$通常価格, |
||
343 | ProductEditPage::$在庫数, |
||
344 | ProductEditPage::$商品コード, |
||
345 | ProductEditPage::$販売制限数, |
||
346 | ProductEditPage::$お届可能日, |
||
347 | ]); |
||
348 | |||
349 | $ProductEditPage->登録(); |
||
350 | $I->see('保存しました', ProductEditPage::$登録結果メッセージ); |
||
351 | } |
||
352 | |||
353 | public function product_新製品はタグを持っています(\AcceptanceTester $I) |
||
354 | { |
||
355 | $I->wantTo('EA0302-UC01-T05-タグを商品に追加する'); |
||
356 | |||
357 | ProductEditPage::go($I) |
||
358 | ->入力_商品名('規格なし商品') |
||
359 | ->入力_販売価格(50000) |
||
360 | ->クリックして開くタグリスト() |
||
361 | ->クリックして選択タグ(2) |
||
362 | ->クリックして選択タグ(3) |
||
363 | ->クリックして選択タグ(4) |
||
364 | ->登録(); |
||
365 | $I->see('保存しました', 'div.c-container > div.c-contentsArea > div.alert'); |
||
366 | |||
367 | $I->seeElement(['xpath' => '//*[@id="tag"]/div/div[1]/button']); |
||
368 | $I->seeElement(['xpath' => '//*[@id="tag"]/div/div[2]/button']); |
||
369 | $I->seeElement(['xpath' => '//*[@id="tag"]/div/div[3]/button']); |
||
370 | } |
||
371 | |||
372 | public function product_商品の一括削除_正常(\AcceptanceTester $I) |
||
373 | { |
||
374 | $I->wantTo('EA0302-UC05-T04 商品の一括削除(正常)'); |
||
375 | |||
376 | $createProduct = Fixtures::get('createProduct'); |
||
377 | foreach (range(1, 5) as $i) { |
||
378 | $createProduct("一括削除用_${i}"); |
||
379 | } |
||
380 | $ProductManagePage = ProductManagePage::go($I) |
||
381 | ->検索('一括削除用') |
||
382 | ->すべて選択(); |
||
383 | |||
384 | $I->see('検索結果:5件が該当しました', ProductManagePage::$検索結果_メッセージ); |
||
385 | |||
386 | $ProductManagePage |
||
387 | ->完全に削除() |
||
388 | ->一括削除完了(); |
||
389 | |||
390 | $I->see('検索結果:0件が該当しました', ProductManagePage::$検索結果_メッセージ); |
||
391 | } |
||
392 | |||
393 | public function product_商品の一括削除_削除エラー(\AcceptanceTester $I) |
||
394 | { |
||
395 | $I->wantTo('EA0302-UC05-T04 商品の一括削除(正常)'); |
||
396 | |||
397 | $createProduct = Fixtures::get('createProduct'); |
||
398 | $createOrders = Fixtures::get('createOrders'); |
||
399 | |||
400 | $timestamp = time(); |
||
401 | // 受注に紐付いていない商品と紐付いている商品を作成 |
||
402 | foreach (range(1, 5) as $i) { |
||
403 | $createProduct("一括削除用_${timestamp}_受注なし_${i}"); |
||
404 | } |
||
405 | $Customer = (Fixtures::get('createCustomer'))(); |
||
406 | foreach (range(1, 5) as $i) { |
||
407 | $Product = $createProduct("一括削除用_${timestamp}_受注あり_${i}"); |
||
408 | $createOrders($Customer, 1, $Product->getProductClasses()->toArray()); |
||
409 | } |
||
410 | |||
411 | $ProductManagePage = ProductManagePage::go($I) |
||
412 | ->検索("一括削除用_${timestamp}") |
||
413 | ->すべて選択(); |
||
414 | |||
415 | $I->see('検索結果:10件が該当しました', ProductManagePage::$検索結果_メッセージ); |
||
416 | $I->see("一括削除用_${timestamp}_受注あり", ProductManagePage::$検索結果_一覧); |
||
417 | $I->see("一括削除用_${timestamp}_受注なし", ProductManagePage::$検索結果_一覧); |
||
418 | |||
419 | $ProductManagePage->完全に削除(); |
||
420 | |||
421 | $I->see("一括削除用_${timestamp}_受注あり_1", ProductManagePage::$一括削除エラー); |
||
422 | $I->see("一括削除用_${timestamp}_受注あり_2", ProductManagePage::$一括削除エラー); |
||
423 | $I->see("一括削除用_${timestamp}_受注あり_3", ProductManagePage::$一括削除エラー); |
||
424 | $I->see("一括削除用_${timestamp}_受注あり_4", ProductManagePage::$一括削除エラー); |
||
425 | $I->see("一括削除用_${timestamp}_受注あり_5", ProductManagePage::$一括削除エラー); |
||
426 | |||
427 | $ProductManagePage->一括削除完了(); |
||
428 | |||
429 | $I->see('検索結果:5件が該当しました', ProductManagePage::$検索結果_メッセージ); |
||
430 | $I->see("一括削除用_${timestamp}_受注あり", ProductManagePage::$検索結果_一覧); |
||
431 | $I->dontSee("一括削除用_${timestamp}_受注なし", ProductManagePage::$検索結果_一覧); |
||
432 | } |
||
433 | |||
434 | View Code Duplication | public function product_規格登録_(\AcceptanceTester $I) |
|
435 | { |
||
436 | $I->wantTo('EA0303-UC01-T01 規格登録'); |
||
437 | |||
438 | ClassNameManagePage::go($I) |
||
439 | ->入力_管理名('backend test class1') |
||
440 | ->入力_表示名('display test class1') |
||
441 | ->規格作成(); |
||
442 | |||
443 | $I->see('保存しました', ClassNameManagePage::$登録完了メッセージ); |
||
444 | } |
||
445 | |||
446 | public function product_規格登録未登録時(\AcceptanceTester $I) |
||
447 | { |
||
448 | $I->wantTo('EA0303-UC01-T02 規格登録 未登録時'); |
||
449 | // TODO [fixture] 規格が1件も登録されていない状態にする |
||
450 | } |
||
451 | |||
452 | public function product_規格編集(\AcceptanceTester $I) |
||
453 | { |
||
454 | $I->wantTo('EA0303-UC02-T01 規格編集'); |
||
455 | |||
456 | $ProductClassPage = ClassNameManagePage::go($I)->一覧_編集(3); |
||
457 | |||
458 | $backendValue = $I->grabValueFrom(ClassNameManagePage::$管理名編集3); |
||
459 | $I->assertEquals('backend test class1', $backendValue); |
||
460 | |||
461 | $displayValue = $I->grabValueFrom(ClassNameManagePage::$表示名編集3); |
||
462 | $I->assertEquals('display test class1', $displayValue); |
||
463 | |||
464 | $ProductClassPage->規格編集(3); |
||
465 | |||
466 | $I->see('保存しました', ClassNameManagePage::$登録完了メッセージ); |
||
467 | // remove added class |
||
468 | ClassNameManagePage::go($I)->一覧_削除(2) |
||
469 | ->acceptModal(); |
||
470 | } |
||
471 | |||
472 | View Code Duplication | public function product_規格削除(\AcceptanceTester $I) |
|
473 | { |
||
474 | $I->wantTo('EA0303-UC03-T01 規格削除'); |
||
475 | |||
476 | // Create a class name for test |
||
477 | ClassNameManagePage::go($I) |
||
478 | ->入力_管理名('backend test class1') |
||
479 | ->入力_表示名('display test class1') |
||
480 | ->規格作成(); |
||
481 | |||
482 | ClassNameManagePage::go($I)->一覧_削除(2) |
||
483 | ->acceptModal(); |
||
484 | |||
485 | $I->see('削除しました', ClassNameManagePage::$登録完了メッセージ); |
||
486 | } |
||
487 | |||
488 | View Code Duplication | public function product_規格表示順の変更(\AcceptanceTester $I) |
|
489 | { |
||
490 | $I->wantTo('EA0308-UC01-T01 規格表示順の変更'); |
||
491 | |||
492 | $ProductClassPage = ClassNameManagePage::go($I); |
||
493 | $I->see('サイズ', $ProductClassPage->一覧_名称(3)); |
||
494 | $I->see('フレーバー', $ProductClassPage->一覧_名称(4)); |
||
495 | |||
496 | $ProductClassPage->一覧_下に(3); |
||
497 | $I->see('フレーバー', $ProductClassPage->一覧_名称(3)); |
||
498 | $I->see('サイズ', $ProductClassPage->一覧_名称(4)); |
||
499 | |||
500 | $ProductClassPage->一覧_上に(4); |
||
501 | $I->see('サイズ', $ProductClassPage->一覧_名称(3)); |
||
502 | $I->see('フレーバー', $ProductClassPage->一覧_名称(4)); |
||
503 | } |
||
504 | |||
505 | View Code Duplication | public function product_分類表示順の変更(\AcceptanceTester $I) |
|
506 | { |
||
507 | $I->wantTo('EA0311-UC01-T01 分類表示順の変更'); |
||
508 | |||
509 | ClassNameManagePage::go($I) |
||
510 | ->一覧_分類登録(3); |
||
511 | |||
512 | $ProductClassCategoryPage = ClassCategoryManagePage::at($I); |
||
513 | $I->see('16mm × 16mm', $ProductClassCategoryPage->一覧_名称(3)); |
||
514 | $I->see('32mm × 32mm', $ProductClassCategoryPage->一覧_名称(4)); |
||
515 | $I->see('64cm × 64cm', $ProductClassCategoryPage->一覧_名称(5)); |
||
516 | |||
517 | $ProductClassCategoryPage->一覧_下に(3); |
||
518 | $I->see('32mm × 32mm', $ProductClassCategoryPage->一覧_名称(3)); |
||
519 | $I->see('16mm × 16mm', $ProductClassCategoryPage->一覧_名称(4)); |
||
520 | $I->see('64cm × 64cm', $ProductClassCategoryPage->一覧_名称(5)); |
||
521 | |||
522 | $ProductClassCategoryPage->一覧_下に(4); |
||
523 | $I->see('32mm × 32mm', $ProductClassCategoryPage->一覧_名称(3)); |
||
524 | $I->see('64cm × 64cm', $ProductClassCategoryPage->一覧_名称(4)); |
||
525 | $I->see('16mm × 16mm', $ProductClassCategoryPage->一覧_名称(5)); |
||
526 | |||
527 | $ProductClassCategoryPage->一覧_上に(5); |
||
528 | $I->see('32mm × 32mm', $ProductClassCategoryPage->一覧_名称(3)); |
||
529 | $I->see('16mm × 16mm', $ProductClassCategoryPage->一覧_名称(4)); |
||
530 | $I->see('64cm × 64cm', $ProductClassCategoryPage->一覧_名称(5)); |
||
531 | |||
532 | $ProductClassCategoryPage->一覧_上に(4); |
||
533 | $I->see('16mm × 16mm', $ProductClassCategoryPage->一覧_名称(3)); |
||
534 | $I->see('32mm × 32mm', $ProductClassCategoryPage->一覧_名称(4)); |
||
535 | $I->see('64cm × 64cm', $ProductClassCategoryPage->一覧_名称(5)); |
||
536 | } |
||
537 | |||
538 | public function product_分類登録(\AcceptanceTester $I) |
||
539 | { |
||
540 | $I->wantTo('EA0304-UC01-T01(& UC01-T02/UC02-T01/UC03-T01) 分類登録/編集/削除'); |
||
541 | |||
542 | $ProductClassPage = ClassNameManagePage::go($I) |
||
543 | ->入力_管理名('test class2') |
||
544 | ->入力_表示名('test class2') |
||
545 | ->規格作成(); |
||
546 | |||
547 | $I->see('保存しました', ClassNameManagePage::$登録完了メッセージ); |
||
548 | |||
549 | $ProductClassPage->一覧_分類登録(3); |
||
550 | $I->see('test class2', '#page_admin_product_class_category > div > div.c-contentsArea > div.c-contentsArea__cols > div > div.c-primaryCol > div:nth-child(1) > div.card-body > div:nth-child(2) > div:nth-child(2) > span'); |
||
551 | |||
552 | // Create a class category |
||
553 | $ProductClassCategoryPage = ClassCategoryManagePage::at($I) |
||
554 | ->入力_分類名('test class2 category1') |
||
555 | ->分類作成(); |
||
556 | |||
557 | $I->see('保存しました', ClassCategoryManagePage::$登録完了メッセージ); |
||
558 | $I->see('test class2 category1', $ProductClassCategoryPage->一覧_名称(3)); |
||
559 | |||
560 | // Edit class category 1 |
||
561 | $ProductClassCategoryPage->一覧_編集(3) |
||
562 | ->一覧_入力_分類名(3, 'edit class category') |
||
563 | ->一覧_分類作成(3); |
||
564 | |||
565 | $I->see('保存しました', ClassCategoryManagePage::$登録完了メッセージ); |
||
566 | $I->see('edit class category', $ProductClassCategoryPage->一覧_名称(3)); |
||
567 | |||
568 | // delete test |
||
569 | $ProductClassCategoryPage->一覧_削除(3) |
||
570 | ->acceptModal(); |
||
571 | |||
572 | $I->see('削除しました', ClassCategoryManagePage::$登録完了メッセージ); |
||
573 | } |
||
574 | |||
575 | public function product_カテゴリ登録(\AcceptanceTester $I) |
||
576 | { |
||
577 | $I->wantTo('EA0305-UC01-T01(& UC01-T02/UC02-T01/UC04-T01) カテゴリ登録/編集/削除'); |
||
578 | |||
579 | $CategoryPage = CategoryManagePage::go($I) |
||
580 | ->入力_カテゴリ名('test category1') |
||
581 | ->カテゴリ作成(); |
||
582 | |||
583 | $I->see('保存しました', CategoryManagePage::$登録完了メッセージ); |
||
584 | |||
585 | $CategoryPage->一覧_編集(3); |
||
586 | |||
587 | $I->seeElement('body > div > div.c-contentsArea > div.c-contentsArea__cols > div.c-contentsArea__primaryCol > div > div > div > div > ul > li:nth-child(3) > form.mode-edit'); |
||
588 | |||
589 | $CategoryPage->一覧_インライン編集_カテゴリ名(3, 'test category11') |
||
590 | ->一覧_インライン編集_決定(3); |
||
591 | |||
592 | $I->see('保存しました', CategoryManagePage::$登録完了メッセージ); |
||
593 | |||
594 | // csv EA0305-UC04-T01 |
||
595 | $CategoryPage |
||
596 | ->CSVダウンロード実行(); |
||
597 | /* csvがダウンロードされたかは確認不可 */ |
||
598 | |||
599 | // csv EA0305-UC04-T02 |
||
600 | $CategoryPage->CSV出力項目設定(); |
||
601 | |||
602 | CsvSettingsPage::at($I); |
||
603 | $value = $I->grabValueFrom(CsvSettingsPage::$CSVタイプ); |
||
604 | $I->assertEquals('5', $value); |
||
605 | |||
606 | // サブカテゴリ EA0305-UC01-03 & UC01-04 |
||
607 | $CategoryPage = CategoryManagePage::go($I) |
||
608 | ->一覧_選択(3); |
||
609 | |||
610 | $I->see('test category11', CategoryManagePage::$パンくず_1階層); |
||
611 | |||
612 | $CategoryPage |
||
613 | ->入力_カテゴリ名('test category11-1') |
||
614 | ->カテゴリ作成(); |
||
615 | $I->see('保存しました', CategoryManagePage::$登録完了メッセージ); |
||
616 | |||
617 | // カテゴリ削除 (children) |
||
618 | $CategoryPage->一覧_削除(3) |
||
619 | ->acceptModal(); |
||
620 | |||
621 | // Delete category root |
||
622 | CategoryManagePage::go($I)->一覧_削除(3) |
||
623 | ->acceptModal(); |
||
624 | } |
||
625 | |||
626 | View Code Duplication | public function product_カテゴリ表示順の変更(\AcceptanceTester $I) |
|
627 | { |
||
628 | $I->wantTo('EA0309-UC01-T01 カテゴリ表示順の変更'); |
||
629 | |||
630 | $CategoryPage = CategoryManagePage::go($I); |
||
631 | $I->see('新入荷', $CategoryPage->一覧_名称(3)); |
||
632 | $I->see('ジェラート', $CategoryPage->一覧_名称(4)); |
||
633 | $I->see('アイスサンド', $CategoryPage->一覧_名称(5)); |
||
634 | |||
635 | $CategoryPage->一覧_下に(3); |
||
636 | $I->see('ジェラート', $CategoryPage->一覧_名称(3)); |
||
637 | $I->see('新入荷', $CategoryPage->一覧_名称(4)); |
||
638 | $I->see('アイスサンド', $CategoryPage->一覧_名称(5)); |
||
639 | |||
640 | $CategoryPage->一覧_下に(4); |
||
641 | $I->see('ジェラート', $CategoryPage->一覧_名称(3)); |
||
642 | $I->see('アイスサンド', $CategoryPage->一覧_名称(4)); |
||
643 | $I->see('新入荷', $CategoryPage->一覧_名称(5)); |
||
644 | |||
645 | $CategoryPage->一覧_上に(5); |
||
646 | $I->see('ジェラート', $CategoryPage->一覧_名称(3)); |
||
647 | $I->see('新入荷', $CategoryPage->一覧_名称(4)); |
||
648 | $I->see('アイスサンド', $CategoryPage->一覧_名称(5)); |
||
649 | |||
650 | $CategoryPage->一覧_上に(4); |
||
651 | $I->see('新入荷', $CategoryPage->一覧_名称(3)); |
||
652 | $I->see('ジェラート', $CategoryPage->一覧_名称(4)); |
||
653 | $I->see('アイスサンド', $CategoryPage->一覧_名称(5)); |
||
654 | } |
||
655 | |||
656 | View Code Duplication | public function product_商品CSV登録(\AcceptanceTester $I) |
|
657 | { |
||
658 | $I->wantTo('EA0306-UC01-T01 商品CSV登録'); |
||
659 | |||
660 | ProductManagePage::go($I)->検索('アップロード商品'); |
||
661 | $I->see('検索条件に合致するデータが見つかりませんでした', ProductManagePage::$検索結果_結果なしメッセージ); |
||
662 | |||
663 | ProductCsvUploadPage::go($I) |
||
664 | ->入力_CSVファイル('product.csv') |
||
665 | ->CSVアップロード(); |
||
666 | $I->see('CSVファイルをアップロードしました', ProductCsvUploadPage::$完了メッセージ); |
||
667 | |||
668 | ProductManagePage::go($I)->検索('アップロード商品'); |
||
669 | $I->see('検索結果:3件が該当しました', ProductManagePage::$検索結果_メッセージ); |
||
670 | } |
||
671 | |||
672 | /** |
||
673 | * @env firefox |
||
674 | * @env chrome |
||
675 | */ |
||
676 | View Code Duplication | public function product_商品CSV登録雛形ファイルダウンロード(\AcceptanceTester $I) |
|
677 | { |
||
678 | $I->wantTo('EA0306-UC01-T02 商品CSV登録雛形ファイルダウンロード'); |
||
679 | |||
680 | ProductCsvUploadPage::go($I)->雛形ダウンロード(); |
||
681 | $ProductTemplateCSV = $I->getLastDownloadFile('/^product\.csv$/'); |
||
682 | $I->assertEquals(1, count(file($ProductTemplateCSV)), 'ヘッダ行だけのファイル'); |
||
683 | } |
||
684 | |||
685 | public function product_カテゴリCSV登録(\AcceptanceTester $I) |
||
686 | { |
||
687 | $I->wantTo('EA0307-UC01-T01(& UC01-T02) カテゴリCSV登録'); |
||
688 | |||
689 | CategoryManagePage::go($I); |
||
690 | $I->dontSeeElement(['xpath' => '//div[@id="sortable_list_box"]//a[contains(text(), "アップロードカテゴリ")]']); |
||
691 | |||
692 | CategoryCsvUploadPage::go($I) |
||
693 | ->入力_CSVファイル('category.csv') |
||
694 | ->CSVアップロード(); |
||
695 | |||
696 | $I->see('CSVファイルをアップロードしました', CategoryCsvUploadPage::$完了メッセージ); |
||
697 | |||
698 | CategoryManagePage::go($I); |
||
699 | |||
700 | $I->seeElement(['xpath' => CategoryManagePage::XPathでタグを取得する('アップロードカテゴリ1')]); |
||
701 | $I->seeElement(['xpath' => CategoryManagePage::XPathでタグを取得する('アップロードカテゴリ2')]); |
||
702 | $I->seeElement(['xpath' => CategoryManagePage::XPathでタグを取得する('アップロードカテゴリ3')]); |
||
703 | } |
||
704 | |||
705 | /** |
||
706 | * @env firefox |
||
707 | * @env chrome |
||
708 | */ |
||
709 | View Code Duplication | public function product_カテゴリCSV登録雛形ファイルダウンロード(\AcceptanceTester $I) |
|
710 | { |
||
711 | $I->wantTo('EA0307-UC01-T02 カテゴリCSV登録雛形ファイルダウンロード'); |
||
712 | |||
713 | // 雛形のダウンロード |
||
714 | CategoryCsvUploadPage::go($I)->雛形ダウンロード(); |
||
715 | $CategoryTemplateCSV = $I->getLastDownloadFile('/^category\.csv$/'); |
||
716 | $I->assertEquals(1, count(file($CategoryTemplateCSV)), 'ヘッダ行だけのファイル'); |
||
717 | } |
||
718 | |||
719 | public function product_一覧からの商品確認(\AcceptanceTester $I) |
||
720 | { |
||
721 | $I->wantTo('EA0310-UC05-T01 一覧からの商品確認'); |
||
722 | |||
723 | ProductManagePage::go($I) |
||
724 | ->検索('チェリーアイスサンド') |
||
725 | ->検索結果_確認(1); |
||
726 | |||
727 | $I->switchToNewWindow(); |
||
728 | $I->seeInCurrentUrl('/products/detail/'); |
||
729 | } |
||
730 | |||
731 | View Code Duplication | public function product_商品編集からの商品確認_公開(\AcceptanceTester $I) |
|
0 ignored issues
–
show
|
|||
732 | { |
||
733 | $I->wantTo('EA0310-UC05-T02 編集からの商品確認 公開'); |
||
734 | |||
735 | ProductManagePage::go($I) |
||
736 | ->検索('チェリーアイスサンド') |
||
737 | ->検索結果_選択(1); |
||
738 | |||
739 | ProductEditPage::at($I) |
||
740 | ->入力_公開() |
||
741 | ->登録() |
||
742 | ->プレビュー(); |
||
743 | |||
744 | $I->switchToNewWindow(); |
||
745 | $I->seeInCurrentUrl('/products/detail/'); |
||
746 | } |
||
747 | |||
748 | View Code Duplication | public function product_商品編集からの商品確認_非公開(\AcceptanceTester $I) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
749 | { |
||
750 | $I->wantTo('EA0310-UC05-T03 編集からの商品確認 非公開'); |
||
751 | |||
752 | ProductManagePage::go($I) |
||
753 | ->検索('チェリーアイスサンド') |
||
754 | ->検索結果_選択(1); |
||
755 | |||
756 | ProductEditPage::at($I) |
||
757 | ->入力_非公開() |
||
758 | ->登録() |
||
759 | ->プレビュー(); |
||
760 | |||
761 | $I->switchToNewWindow(); |
||
762 | $I->seeInCurrentUrl('/products/detail/'); |
||
763 | } |
||
764 | } |
||
765 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.