Completed
Push — apply-codeceptions ( 341052...a29855 )
by Kentaro
53:23 queued 21:51
created

EA03ProductCest   A

Complexity

Total Complexity 39

Size/Duplication

Total Lines 713
Duplicated Lines 22.16 %

Coupling/Cohesion

Components 1
Dependencies 13

Importance

Changes 0
Metric Value
dl 158
loc 713
rs 9.167
c 0
b 0
f 0
wmc 39
lcom 1
cbo 13

36 Methods

Rating   Name   Duplication   Size   Complexity  
A _before() 0 6 1
A _after() 0 3 1
A product_商品検索() 12 12 1
A product_商品検索エラー() 0 25 1
A product_規格確認のポップアップ表示() 0 11 1
A product_ポップアップから規格編集画面に遷移() 0 11 1
A product_商品検索結果無() 0 8 1
A product_CSV出力() 0 15 1
A product_CSV出力項目設定() 12 12 1
A product_一覧からの規格編集規格なし失敗() 0 17 1
A product_一覧からの規格編集規格なし_() 0 33 1
A product_一覧からの規格編集規格あり2() 0 21 1
A product_新製品はタグを持っています() 0 18 1
A product_一覧からの商品削除() 0 10 1
A product_商品の一括削除_正常() 0 20 2
A product_商品の一括削除_削除エラー() 0 40 3
A product_規格登録_() 0 11 1
A product_規格登録未登録時() 0 5 1
A product_規格編集() 0 19 1
A product_規格削除() 0 15 1
A product_規格表示順の変更() 16 16 1
A product_分類表示順の変更() 32 32 1
A product_分類登録() 0 36 1
A product_カテゴリ登録() 0 50 1
A product_カテゴリ表示順の変更() 29 29 1
A product_商品CSV登録() 15 15 1
A product_商品CSV登録雛形ファイルダウンロード() 8 8 1
A product_カテゴリCSV登録() 0 19 1
A product_カテゴリCSV登録雛形ファイルダウンロード() 9 9 1
A product_一覧からの商品確認() 0 11 1
A product_一覧からの商品複製() 0 16 1
A product_一覧からの規格編集規格あり1() 0 24 1
A product_商品登録非公開() 12 12 1
A product_商品登録公開() 13 13 1
A product_商品編集規格なし() 0 16 1
A product_商品編集規格あり() 0 37 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
use Codeception\Util\Fixtures;
4
use Page\Admin\CategoryCsvUploadPage;
5
use Page\Admin\CategoryManagePage;
6
use Page\Admin\CsvSettingsPage;
7
use Page\Admin\ClassCategoryManagePage;
8
use Page\Admin\ClassNameManagePage;
9
use Page\Admin\ProductClassEditPage;
10
use Page\Admin\ProductCsvUploadPage;
11
use Page\Admin\ProductManagePage;
12
use Page\Admin\ProductEditPage;
13
14
/**
15
 * @group admin
16
 * @group admin01
17
 * @group product
18
 * @group ea3
19
 */
20
class EA03ProductCest
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
21
{
22
    const ページタイトル = '#main .page-header';
23
    const ページタイトルStyleGuide = '.c-pageTitle';
24
25
    public function _before(\AcceptanceTester $I)
26
    {
27
        // すべてのテストケース実施前にログインしておく
28
        // ログイン後は管理アプリのトップページに遷移している
29
        $I->loginAsAdmin();
30
    }
31
32
    public function _after(\AcceptanceTester $I)
0 ignored issues
show
Unused Code introduced by
The parameter $I 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...
33
    {
34
    }
35
36 View Code Duplication
    public function product_商品検索(\AcceptanceTester $I)
0 ignored issues
show
Duplication introduced by
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...
37
    {
38
        $I->wantTo('EA0301-UC01-T01 (& UC01-T02) 商品検索');
39
40
        ProductManagePage::go($I)->検索('フォーク');
41
42
        $I->see("検索結果:1件が該当しました", ProductManagePage::$検索結果_メッセージ);
43
        $I->see("ディナーフォーク", ProductManagePage::$検索結果_一覧);
44
45
        ProductManagePage::go($I)->検索('[email protected]');
46
        $I->see('検索結果:0件が該当しました', ProductManagePage::$検索結果_メッセージ);
47
    }
48
49
    public function product_商品検索エラー(\AcceptanceTester $I)
50
    {
51
        $I->wantTo('EA0301-UC01-T03 商品検索 エラー');
52
53
        // バリデーションエラーが発生するフォーム項目がないため, ダミーのステータスを作っておく
54
        /** @var \Doctrine\ORM\EntityManager $em */
55
        $em = Fixtures::get('entityManager');
56
        $ProductStatus = new \Eccube\Entity\Master\ProductStatus();
57
        $ProductStatus->setName('ダミー');
58
        $ProductStatus->setSortNo(999);
59
        $ProductStatus->setId(999);
60
        $em->persist($ProductStatus);
61
        $em->flush();
62
63
        // 商品一覧を表示
64
        $page = ProductManagePage::go($I);
65
66
        // ダミーのステータスを削除する
67
        $em->remove($ProductStatus);
68
        $em->flush();
69
70
        // 存在しないステータスで検索するため, `有効な値ではありません`のバリデーションエラーが発生するはず
0 ignored issues
show
Unused Code Comprehensibility introduced by
38% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

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