Failed Conditions
Pull Request — experimental/sf (#3225)
by Kentaro
58:20 queued 49:13
created

codeception/acceptance/EF03OrderCest.php (3 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
use Codeception\Util\Fixtures;
4
use Page\Front\CartPage;
5
use Page\Front\ProductDetailPage;
6
use Page\Front\ShippingEditPage;
7
use Page\Front\ShoppingCompletePage;
8
use Page\Front\ShoppingConfirmPage;
9
use Page\Front\ShoppingLoginPage;
10
use Page\Front\ShoppingPage;
11
use Page\Front\MultipleShippingPage;
12
use Page\Front\CustomerAddressAddPage;
13
14
/**
15
 * @group front
16
 * @group order
17
 * @group ef3
18
 */
19
class EF03OrderCest
20
{
21
    public function _before(\AcceptanceTester $I)
22
    {
23
    }
24
25
    public function _after(\AcceptanceTester $I)
26
    {
27
    }
28
29
    public function order_カート買い物を続ける(\AcceptanceTester $I)
30
    {
31
        $I->wantTo('EF0301-UC01-T01 カート 買い物を続ける');
32
        $createCustomer = Fixtures::get('createCustomer');
33
        $customer = $createCustomer();
34
        $I->loginAsMember($customer->getEmail(), 'password');
35
36
        // 商品詳細パーコレータ カートへ
37
        ProductDetailPage::go($I, 2)
38
            ->カートに入れる(1);
39
40
        $I->acceptPopup();
41
42
        CartPage::go($I)
43
            ->お買い物を続ける();
44
45
        // トップページ
46
        $I->see('新着情報', '.ec-news__title');
47
    }
48
49 View Code Duplication
    public function order_カート削除(\AcceptanceTester $I)
50
    {
51
        $I->wantTo('EF0301-UC01-T02 カート 削除');
52
        $createCustomer = Fixtures::get('createCustomer');
53
        $customer = $createCustomer();
54
        $I->loginAsMember($customer->getEmail(), 'password');
55
56
        ProductDetailPage::go($I, 2)
57
            ->カートに入れる(1);
58
59
        $I->acceptPopup();
60
61
        CartPage::go($I)
62
            ->商品削除(1);
63
    }
64
65 View Code Duplication
    public function order_カート数量増やす(\AcceptanceTester $I)
66
    {
67
        $I->wantTo('EF0301-UC01-T03 カート 数量増やす');
68
69
        $createCustomer = Fixtures::get('createCustomer');
70
        $customer = $createCustomer();
71
        $I->loginAsMember($customer->getEmail(), 'password');
72
73
        // 商品詳細パーコレータ カートへ
74
        ProductDetailPage::go($I, 2)
75
            ->カートに入れる(1);
76
77
        $I->acceptPopup();
78
79
        $cartPage = CartPage::go($I)
80
            ->商品数量増やす(1);
81
82
        // 確認
83
        $I->assertEquals('2', $cartPage->商品数量(1));
84
85
    }
86
87 View Code Duplication
    public function order_カート数量減らす(\AcceptanceTester $I)
88
    {
89
        $I->wantTo('EF0301-UC01-T04 カート 数量減らす');
90
        $createCustomer = Fixtures::get('createCustomer');
91
        $customer = $createCustomer();
92
        $I->loginAsMember($customer->getEmail(), 'password');
93
94
        // 商品詳細パーコレータ カートへ
95
        ProductDetailPage::go($I, 2)
96
            ->カートに入れる(2);
97
98
        $I->acceptPopup();
99
100
        $cartPage = CartPage::go($I)
101
            ->商品数量減らす(1);
102
103
        // 確認
104
        $I->assertEquals('1', $cartPage->商品数量(1));
105
    }
106
107
    public function order_ログインユーザ購入(\AcceptanceTester $I)
108
    {
109
        $I->wantTo('EF0302-UC01-T01 ログインユーザ購入');
110
        $I->logoutAsMember();
111
        $createCustomer = Fixtures::get('createCustomer');
112
        $customer = $createCustomer();
113
        $BaseInfo = Fixtures::get('baseinfo');
114
115
        // 商品詳細パーコレータ カートへ
116
        ProductDetailPage::go($I, 2)
117
            ->カートに入れる(1);
118
119
        $I->acceptPopup();
120
121
        CartPage::go($I)
122
            ->レジに進む();
123
124
        // ログイン
125
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
126
127
        $I->resetEmails();
128
129
        ShoppingPage::at($I)->確認する();
130
        ShoppingConfirmPage::at($I)->注文する();
131
132
        $I->wait(1);
133
134
        // メール確認
135
        $I->seeEmailCount(2);
136
        foreach (array($customer->getEmail(), $BaseInfo->getEmail01()) as $email) {
137
            // TODO 注文した商品の内容もチェックしたい
138
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
139
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
140
            $I->seeInLastEmailTo($email, 'お名前 :'.$customer->getName01().' '.$customer->getName02().' 様');
141
            $I->seeInLastEmailTo($email, 'お名前(フリガナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
142
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getZip01().'-'.$customer->getZip02());
143
            $I->seeInLastEmailTo($email, '住所  :'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
144
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getTel01().'-'.$customer->getTel02().'-'.$customer->getTel03());
145
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
146
        }
147
148
        // 完了画面 -> topへ
149
        ShoppingCompletePage::at($I)->TOPへ();
150
        $I->see('新着情報', '.ec-news__title');
151
    }
152
153
    public function order_ゲスト購入(\AcceptanceTester $I)
154
    {
155
        $I->wantTo('EF0302-UC02-T01 ゲスト購入');
156
        $I->logoutAsMember();
157
158
        $faker = Fixtures::get('faker');
159
        $new_email = microtime(true).'.'.$faker->safeEmail;
160
        $BaseInfo = Fixtures::get('baseinfo');
161
162
        ProductDetailPage::go($I, 2)
163
            ->カートに入れる(1);
164
165
        $I->acceptPopup();
166
167
        CartPage::go($I)
168
            ->レジに進む();
169
170
        $ShoppingPage = ShoppingLoginPage::at($I)->ゲスト購入();
171
        $ShoppingPage
172
            ->入力_姓('姓03')
173
            ->入力_名('名03')
174
            ->入力_セイ('セイ')
175
            ->入力_メイ('メイ')
176
            ->入力_郵便番号1('530')
177
            ->入力_郵便番号2('0001');
178
179
        // TODO: 郵便番号入力後のcodeceptionの入力後にJSが走ってしまい「梅田」が2重で入力されてしまう。
180
        // 上記を回避するためにwait関数を入れる。
181
        // こちらは本体のmasterブランチで修正されているので、master -> sf マージ後には不要になる見込み。
182
        $I->wait(5);
183
184
        $ShoppingPage
185
            ->入力_都道府県(['value' => '27'])
186
            ->入力_市区町村名('大阪市北区')
187
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F')
188
            ->入力_電話番号1('111')
189
            ->入力_電話番号2('111')
190
            ->入力_電話番号3('111')
191
            ->入力_Eメール($new_email)
192
            ->入力_Eメール確認($new_email)
193
            ->次へ();
194
195
        $I->resetEmails();
196
197
        ShoppingPage::at($I)->確認する();
198
        ShoppingConfirmPage::at($I)->注文する();
199
200
        $I->wait(1);
201
202
        // 確認
203
        $I->seeEmailCount(2);
204 View Code Duplication
        foreach (array($new_email, $BaseInfo->getEmail01()) as $email) {
205
            // TODO 注文した商品の内容もチェックしたい
206
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
207
            $I->seeInLastEmailTo($email, '姓03 名03 様');
208
            $I->seeInLastEmailTo($email, 'お名前 :姓03 名03 様');
209
            $I->seeInLastEmailTo($email, 'お名前(フリガナ):セイ メイ 様');
210
            $I->seeInLastEmailTo($email, '郵便番号:〒530-0001');
211
            $I->seeInLastEmailTo($email, '住所  :大阪府大阪市北区梅田2-4-9 ブリーゼタワー13F');
212
            $I->seeInLastEmailTo($email, '電話番号:111-111-111');
213
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$new_email);
214
        }
215
216
        // 完了画面 -> topへ
217
        ShoppingCompletePage::at($I)->TOPへ();
218
        $I->see('新着情報', '.ec-news__title');
219
    }
220
221
    public function order_ゲスト購入情報変更(\AcceptanceTester $I)
222
    {
223
        $I->wantTo('EF0305-UC02-T01 ゲスト購入 情報変更'); // EF0305-UC04-T01も一緒にテスト
224
        $I->logoutAsMember();
225
226
        $faker = Fixtures::get('faker');
227
        $new_email = microtime(true).'.'.$faker->safeEmail;
228
        $BaseInfo = Fixtures::get('baseinfo');
229
230
        // 商品詳細パーコレータ カートへ
231
        ProductDetailPage::go($I, 2)
232
            ->カートに入れる(1);
233
234
        $I->acceptPopup();
235
236
        CartPage::go($I)
237
            ->レジに進む();
238
239
        $ShoppingPage = ShoppingLoginPage::at($I)->ゲスト購入();
240
        $ShoppingPage
241
            ->入力_姓('姓03')
242
            ->入力_名('名03')
243
            ->入力_セイ('セイ')
244
            ->入力_メイ('メイ')
245
            ->入力_郵便番号1('530')
246
            ->入力_郵便番号2('0001');
247
248
        // TODO: 郵便番号入力後のcodeceptionの入力後にJSが走ってしまい「梅田」が2重で入力されてしまう。
249
        // 上記を回避するためにwait関数を入れる。
250
        // こちらは本体のmasterブランチで修正されているので、master -> sf マージ後には不要になる見込み。
251
        $I->wait(5);
252
253
        $ShoppingPage
254
            ->入力_都道府県(['value' => '27'])
255
            ->入力_市区町村名('大阪市北区')
256
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F')
257
            ->入力_電話番号1('111')
258
            ->入力_電話番号2('111')
259
            ->入力_電話番号3('111')
260
            ->入力_Eメール($new_email)
261
            ->入力_Eメール確認($new_email)
262
            ->次へ();
263
264
        // 確認
265
        $ShoppingPage = ShoppingPage::at($I)
266
            ->お客様情報変更()
267
            ->入力_姓('姓0301')
268
            ->お客様情報変更OK();
269
270
        // 確認
271
        $I->see('姓0301', '#shopping-form .customer-name01');
272
273
        // 配送情報
274
        $ShoppingPage->お届け先変更();
275
276
        ShippingEditPage::at($I)
277
            ->入力_姓('姓0302')
278
            ->登録する();
279
280
        $I->see('姓0302', 'div.ec-orderRole div.ec-orderDelivery__address');
281
282
        $I->resetEmails();
283
284
        ShoppingPage::at($I)->確認する();
285
        ShoppingConfirmPage::at($I)->注文する();
286
287
        $I->seeEmailCount(2);
288 View Code Duplication
        foreach (array($new_email, $BaseInfo->getEmail01()) as $email) {
289
            // TODO 注文した商品の内容もチェックしたい
290
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
291
            $I->seeInLastEmailTo($email, '姓0301 名03 様');
292
            $I->seeInLastEmailTo($email, 'お名前 :姓0302 名03 様', '変更後のお届け先');
293
            $I->seeInLastEmailTo($email, '郵便番号:〒530-0001');
294
            $I->seeInLastEmailTo($email, '住所  :大阪府大阪市北区梅田2-4-9 ブリーゼタワー13F');
295
            $I->seeInLastEmailTo($email, '電話番号:111-111-111');
296
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$new_email);
297
        }
298
299
        // topへ
300
        ShoppingCompletePage::at($I)->TOPへ();
301
        $I->see('新着情報', '.ec-news__title');
302
    }
303
304
    /**
305
     * @see https://github.com/EC-CUBE/ec-cube/pull/3133
306
     */
307
    public function order_ログインしてカートをマージ(\AcceptanceTester $I)
308
    {
309
        $I->wantTo('EF0305-UC07-T01 ログインしてカートをマージ');
310
        $I->logoutAsMember();
311
        $createCustomer = Fixtures::get('createCustomer');
312
        $customer = $createCustomer();
313
        $BaseInfo = Fixtures::get('baseinfo');
314
315
        // 商品詳細パーコレータ カートへ
316
        ProductDetailPage::go($I, 2)
317
            ->カートに入れる(1);
318
319
        $I->acceptPopup();
320
321
        CartPage::go($I)
322
            ->レジに進む();
323
324
        // ログイン
325
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
326
327
        $I->resetEmails();
328
329
        ShoppingPage::at($I)->確認する();
330
        $I->logoutAsMember();
331
332
        // 商品詳細フォーク カートへ
333
        ProductDetailPage::go($I, 1)
334
            ->規格選択(['プラチナ', '150cm'])
335
            ->カートに入れる(1);
336
337
        $I->acceptPopup();
338
339
        CartPage::go($I)
340
            ->レジに進む();
341
342
        // ログイン
343
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
344
345
        ShoppingPage::at($I)->確認する();
346
        ShoppingConfirmPage::at($I)->注文する();
347
348
        $I->wait(1);
349
350
        // メール確認
351
        $I->seeEmailCount(2);
352
        foreach (array($customer->getEmail(), $BaseInfo->getEmail01()) as $email) {
353
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
354
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
355
            $I->seeInLastEmailTo($email, 'お名前 :'.$customer->getName01().' '.$customer->getName02().' 様');
356
            $I->seeInLastEmailTo($email, 'お名前(フリガナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
357
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getZip01().'-'.$customer->getZip02());
358
            $I->seeInLastEmailTo($email, '住所  :'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
359
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getTel01().'-'.$customer->getTel02().'-'.$customer->getTel03());
360
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
361
362
            $I->seeInLastEmailTo($email, '商品名: パーコレーター');
363
            $I->seeInLastEmailTo($email, '商品名: ディナーフォーク  プラチナ  150cm');
364
        }
365
366
        // 完了画面 -> topへ
367
        ShoppingCompletePage::at($I)->TOPへ();
368
        $I->see('新着情報', '.ec-news__title');
369
    }
370
371
    public function order_ログインユーザ購入複数配送(\AcceptanceTester $I)
372
    {
373
        // チェック用変数
374
        // 追加するお届け作の名前
375
        $nameSei = '姓0302';
376
        $nameMei = '名0302';
377
        // カートへ入れる商品の数
378
        $cart_quantity = 1;
379
        // お届け先ごとに設定する商品の数
380
        $shipping1_quantity = 2;
381
        $shipping2_quantity = 3;
382
383
        $I->wantTo('EF0305-UC05-T01 お届け先の追加');
384
        $I->logoutAsMember();
385
        $createCustomer = Fixtures::get('createCustomer');
386
        /** @var \Eccube\Entity\CustomerAddress $customer */
387
        $customer = $createCustomer();
388
        $BaseInfo = Fixtures::get('baseinfo');
389
390
        // 商品詳細パーコレータ カートへ
391
        ProductDetailPage::go($I, 2)
392
            ->カートに入れる($cart_quantity);
393
394
        $I->acceptPopup();
395
396
        CartPage::go($I)
397
            ->レジに進む();
398
399
        // ログイン
400
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
401
402
        $I->resetEmails();
403
404
        // -------- EF0305-UC05-T01_お届け先の追加 --------
405
        ShoppingPage::at($I)->お届け先追加();
406
407
        // 新規お届け先追加
408
        MultipleShippingPage::at($I)->新規お届け先を追加する();
409
        CustomerAddressAddPage::at($I)
410
            ->入力_姓($nameSei)
411
            ->入力_名($nameMei)
412
            ->入力_セイ('セイ')
413
            ->入力_メイ('メイ')
414
            ->入力_郵便番号1('530')
415
            ->入力_郵便番号2('0001')
416
            ->入力_都道府県(['value' => '27'])
417
            ->入力_市区町村名('大阪市北区2')
418
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F2')
419
            ->入力_電話番号1('222')
420
            ->入力_電話番号2('222')
421
            ->入力_電話番号3('222')
422
            ->登録する();
423
424
        // 新規お届け先が追加されていることを確認
425
        $I->see($nameSei, '#form_shipping_multiple_0_shipping_0_customer_address > option:nth-child(2)');
426
427
        // -------- EF0305-UC06-T01_複数配送 - 同じ商品種別(同一配送先) --------
428
        // 複数配送設定
429
        MultipleShippingPage::at($I)
430
            ->お届け先追加()
431
            ->入力_お届け先('0', '0', $customer->getName01())
432
            ->入力_お届け先('0', '1', $customer->getName01())
433
            ->入力_数量('0', '0', $shipping1_quantity)
434
            ->入力_数量('0', '1', $shipping2_quantity)
435
            ->選択したお届け先に送る()
436
        ;
437
438
        // 配送先が1個なので数量をまとめる
439
        $sum_quantity = $shipping1_quantity + $shipping2_quantity;
440
441
        // 複数配送設定がされておらず、個数が1明細にまとめられていることを確認
442
        $I->see('お届け先', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
443
        $I->dontSee('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
444
        $I->dontSee('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
445
        $I->see(' × '.$sum_quantity, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(3) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
446
        $I->see($customer->getName01(), '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
447
448
        // -------- EF0305-UC06-T02_複数配送 - 同じ商品種別(別配送先) --------
449
450
        ShoppingPage::at($I)->お届け先追加();
451
452
        // 複数配送設定
453
        MultipleShippingPage::at($I)
454
            ->お届け先追加()
455
            ->入力_お届け先('0', '0', $customer->getName01())
456
            ->入力_お届け先('0', '1', $nameSei)
457
            ->入力_数量('0', '0', $shipping1_quantity)
458
            ->入力_数量('0', '1', $shipping2_quantity)
459
            ->選択したお届け先に送る()
460
        ;
461
462
        // 名前を比較してお届け先が上下どちらに表示されるか判断
463
        $compared = strnatcmp($customer->getName01(), $nameSei);
464
        if($compared === 0) {
465
            $compared = strnatcmp($customer->getName02(), $nameMei);
466
        }
467
        // 上下それぞれで名前、商品個数を設定
468 View Code Duplication
        if($compared < 0) {
469
            $quantity1 = $shipping1_quantity;
470
            $quantity2 = $shipping2_quantity;
471
            $name1 = $customer->getName01();
472
            $name2 = $nameSei;
473
        } else {
474
            $quantity1 = $shipping2_quantity;
475
            $quantity2 = $shipping1_quantity;
476
            $name1 = $nameSei;
477
            $name2 = $customer->getName01();
478
        }
479
480
        // 複数配送設定ができていることを確認
481
        $I->see('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
482
        $I->see(' × '.$quantity1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(3) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
483
        $I->see($name1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
484
        $I->see('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
485
        $I->see(' × '.$quantity2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(7) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
486
        $I->see($name2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(8) > p:nth-child(1)');
487
488
        ShoppingPage::at($I)->確認する();
489
        ShoppingConfirmPage::at($I)->注文する();
490
491
        $I->wait(1);
492
493
        // メール確認
494
        $I->seeEmailCount(2);
495 View Code Duplication
        foreach (array($customer->getEmail(), $BaseInfo->getEmail01()) as $email) {
496
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
497
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
498
            $I->seeInLastEmailTo($email, 'お名前 :'.$customer->getName01().' '.$customer->getName02().' 様');
499
            $I->seeInLastEmailTo($email, 'お名前(フリガナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
500
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getZip01().'-'.$customer->getZip02());
501
            $I->seeInLastEmailTo($email, '住所  :'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
502
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getTel01().'-'.$customer->getTel02().'-'.$customer->getTel03());
503
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
504
            $I->seeInLastEmailTo($email, '◎お届け先1');
505
            $I->seeInLastEmailTo($email, 'お名前 :'.$nameSei);
506
            $I->seeInLastEmailTo($email, '数量:3');
507
            $I->seeInLastEmailTo($email, '◎お届け先2');
508
            $I->seeInLastEmailTo($email, '数量:2');
509
        }
510
511
        // 完了画面 -> topへ
512
        ShoppingCompletePage::at($I)->TOPへ();
513
        $I->see('新着情報', '.ec-news__title');
514
    }
515
516
517
    public function order_ログイン後に複数カートになればカートに戻す(\AcceptanceTester $I)
0 ignored issues
show
Method name "EF03OrderCest::order_ログイン後に複数カートになればカートに戻す" is not in camel caps format
Loading history...
518
    {
519
        $I->wantTo('EF0303-UC01-T01_購入フローでログインしたタイミングで複数カートになったらログイン後にカート画面に戻す');
520
        $I->logoutAsMember();
521
        $createCustomer = Fixtures::get('createCustomer');
522
        $customer = $createCustomer();
523
        $I->loginAsMember($customer->getEmail(), 'password');
524
525
        // 商品詳細パーコレータ カートへ
526
        ProductDetailPage::go($I, 2)
527
            ->カートに入れる(1);
528
529
        $I->wait(3);
530
531
        $I->acceptPopup();
532
533
        CartPage::go($I)
534
            ->レジに進む();
535
536
        // ログアウト
537
        $I->logoutAsMember();
538
539
        $createProduct = Fixtures::get('createProduct');
540
        $Product = $createProduct();
541
542
543
        $entityManager = Fixtures::get('entityManager');
544
        $ProductClass = $Product->getProductClasses()[0];
545
        $SaleType = $entityManager->find(\Eccube\Entity\Master\SaleType::class, 2);
546
        $ProductClass->setSaleType($SaleType);
547
        $entityManager->persist($ProductClass);
548
        $entityManager->flush();
549
550
        if ($ProductClass->getClassCategory2()) {
551
            // 商品詳細
552
            ProductDetailPage::go($I, $Product->getId())
553
                ->規格選択([$ProductClass->getClassCategory1(), $ProductClass->getClassCategory2()])
554
                ->カートに入れる(1);
555
        } else {
556
            ProductDetailPage::go($I, $Product->getId())
557
                ->規格選択([$ProductClass->getClassCategory1()])
558
                ->カートに入れる(1);
559
        }
560
561
        $I->wait(3);
562
        $I->acceptPopup();
563
564
        CartPage::go($I)
565
            ->レジに進む();
566
567
        // ログイン
568
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
569
570
        $I->see('同時購入できない商品がカートに含まれています', '.ec-alert-warning__text');
571
    }
572
573
    /**
574
     * カートに変更が無ければ、お届け先の設定が引き継がれる.
575
     */
576
    public function order_購入確認画面からカートに戻る(\AcceptanceTester $I)
0 ignored issues
show
Method name "EF03OrderCest::order_購入確認画面からカートに戻る" is not in camel caps format
Loading history...
577
    {
578
        // チェック用変数
579
        // 追加するお届け作の名前
580
        $nameSei = '姓0302';
581
        $nameMei = '名0302';
582
        // カートへ入れる商品の数
583
        $cart_quantity = 1;
584
        // お届け先ごとに設定する商品の数
585
        $shipping1_quantity = 2;
586
        $shipping2_quantity = 3;
587
588
        $I->wantTo('EF0305-UC08-T01 購入確認画面からカートに戻る');
589
        $I->logoutAsMember();
590
        $createCustomer = Fixtures::get('createCustomer');
591
        /** @var \Eccube\Entity\CustomerAddress $customer */
592
        $customer = $createCustomer();
593
        $BaseInfo = Fixtures::get('baseinfo');
594
595
        // 商品詳細パーコレータ カートへ
596
        ProductDetailPage::go($I, 2)
597
            ->カートに入れる($cart_quantity);
598
599
        $I->acceptPopup();
600
601
        CartPage::go($I)
602
            ->レジに進む();
603
604
        // ログイン
605
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
606
607
        $I->resetEmails();
608
609
        // -------- EF0305-UC05-T01_お届け先の追加 --------
610
        ShoppingPage::at($I)->お届け先追加();
611
612
        // 新規お届け先追加
613
        MultipleShippingPage::at($I)->新規お届け先を追加する();
614
        CustomerAddressAddPage::at($I)
615
            ->入力_姓($nameSei)
616
            ->入力_名($nameMei)
617
            ->入力_セイ('セイ')
618
            ->入力_メイ('メイ')
619
            ->入力_郵便番号1('530')
620
            ->入力_郵便番号2('0001')
621
            ->入力_都道府県(['value' => '27'])
622
            ->入力_市区町村名('大阪市北区2')
623
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F2')
624
            ->入力_電話番号1('222')
625
            ->入力_電話番号2('222')
626
            ->入力_電話番号3('222')
627
            ->登録する();
628
629
        // 新規お届け先が追加されていることを確認
630
        $I->see($nameSei, '#form_shipping_multiple_0_shipping_0_customer_address > option:nth-child(2)');
631
632
        // -------- EF0305-UC06-T01_複数配送 - 同じ商品種別(同一配送先) --------
633
        // 複数配送設定
634
        MultipleShippingPage::at($I)
635
            ->お届け先追加()
636
            ->入力_お届け先('0', '0', $customer->getName01())
637
            ->入力_お届け先('0', '1', $customer->getName01())
638
            ->入力_数量('0', '0', $shipping1_quantity)
639
            ->入力_数量('0', '1', $shipping2_quantity)
640
            ->選択したお届け先に送る()
641
        ;
642
643
        // 配送先が1個なので数量をまとめる
644
        $sum_quantity = $shipping1_quantity + $shipping2_quantity;
645
646
        // 複数配送設定がされておらず、個数が1明細にまとめられていることを確認
647
        $I->see('お届け先', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
648
        $I->dontSee('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
649
        $I->dontSee('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
650
        $I->see(' × '.$sum_quantity, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(3) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
651
        $I->see($customer->getName01(), '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
652
653
        // -------- EF0305-UC06-T02_複数配送 - 同じ商品種別(別配送先) --------
654
655
        ShoppingPage::at($I)->お届け先追加();
656
657
        // 複数配送設定
658
        MultipleShippingPage::at($I)
659
            ->お届け先追加()
660
            ->入力_お届け先('0', '0', $customer->getName01())
661
            ->入力_お届け先('0', '1', $nameSei)
662
            ->入力_数量('0', '0', $shipping1_quantity)
663
            ->入力_数量('0', '1', $shipping2_quantity)
664
            ->選択したお届け先に送る()
665
        ;
666
667
        // 名前を比較してお届け先が上下どちらに表示されるか判断
668
        $compared = strnatcmp($customer->getName01(), $nameSei);
669
        if($compared === 0) {
670
            $compared = strnatcmp($customer->getName02(), $nameMei);
671
        }
672
        // 上下それぞれで名前、商品個数を設定
673 View Code Duplication
        if($compared < 0) {
674
            $quantity1 = $shipping1_quantity;
675
            $quantity2 = $shipping2_quantity;
676
            $name1 = $customer->getName01();
677
            $name2 = $nameSei;
678
        } else {
679
            $quantity1 = $shipping2_quantity;
680
            $quantity2 = $shipping1_quantity;
681
            $name1 = $nameSei;
682
            $name2 = $customer->getName01();
683
        }
684
685
        // 複数配送設定ができていることを確認
686
        $I->see('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
687
        $I->see(' × '.$quantity1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(3) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
688
        $I->see($name1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
689
        $I->see('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
690
        $I->see(' × '.$quantity2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(7) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
691
        $I->see($name2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(8) > p:nth-child(1)');
692
693
        // 一旦カートに戻る
694
        CartPage::go($I)
695
            ->レジに進む();
696
697
        // お届け先が復元されている
698
        $I->see('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
699
        $I->see(' × '.$quantity1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(3) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
700
        $I->see($name1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
701
        $I->see('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
702
        $I->see(' × '.$quantity2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(7) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
703
        $I->see($name2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(8) > p:nth-child(1)');
704
705
        ShoppingPage::at($I)->確認する();
706
        ShoppingConfirmPage::at($I)->注文する();
707
708
        $I->wait(1);
709
710
        // メール確認
711
        $I->seeEmailCount(2);
712 View Code Duplication
        foreach (array($customer->getEmail(), $BaseInfo->getEmail01()) as $email) {
713
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
714
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
715
            $I->seeInLastEmailTo($email, 'お名前 :'.$customer->getName01().' '.$customer->getName02().' 様');
716
            $I->seeInLastEmailTo($email, 'お名前(フリガナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
717
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getZip01().'-'.$customer->getZip02());
718
            $I->seeInLastEmailTo($email, '住所  :'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
719
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getTel01().'-'.$customer->getTel02().'-'.$customer->getTel03());
720
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
721
            $I->seeInLastEmailTo($email, '◎お届け先1');
722
            $I->seeInLastEmailTo($email, 'お名前 :'.$nameSei);
723
            $I->seeInLastEmailTo($email, '数量:3');
724
            $I->seeInLastEmailTo($email, '◎お届け先2');
725
            $I->seeInLastEmailTo($email, '数量:2');
726
        }
727
728
        // 完了画面 -> topへ
729
        ShoppingCompletePage::at($I)->TOPへ();
730
        $I->see('新着情報', '.ec-news__title');
731
    }
732
733
    /**
734
     * カートに変更があれば、お届け先の設定は初期化される.
735
     */
736
    public function order_購入確認画面からカートに戻るWithお届け先初期化(\AcceptanceTester $I)
0 ignored issues
show
Method name "EF03OrderCest::order_購入確認画面からカートに戻るWithお届け先初期化" is not in camel caps format
Loading history...
737
    {
738
        // チェック用変数
739
        // 追加するお届け作の名前
740
        $nameSei = '姓0302';
741
        $nameMei = '名0302';
742
        // カートへ入れる商品の数
743
        $cart_quantity = 1;
744
        // お届け先ごとに設定する商品の数
745
        $shipping1_quantity = 1;
746
        $shipping2_quantity = 2;
747
748
        $I->wantTo('EF0305-UC08-T02 購入確認画面からカートに戻る(お届け先初期化)');
749
        $I->logoutAsMember();
750
        $createCustomer = Fixtures::get('createCustomer');
751
        /** @var \Eccube\Entity\CustomerAddress $customer */
752
        $customer = $createCustomer();
753
        $BaseInfo = Fixtures::get('baseinfo');
754
755
        // 商品詳細パーコレータ カートへ
756
        ProductDetailPage::go($I, 2)
757
            ->カートに入れる($cart_quantity);
758
759
        $I->acceptPopup();
760
761
        CartPage::go($I)
762
            ->レジに進む();
763
764
        // ログイン
765
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
766
767
        $I->resetEmails();
768
769
        // -------- EF0305-UC05-T01_お届け先の追加 --------
770
        ShoppingPage::at($I)->お届け先追加();
771
772
        // 新規お届け先追加
773
        MultipleShippingPage::at($I)->新規お届け先を追加する();
774
        CustomerAddressAddPage::at($I)
775
            ->入力_姓($nameSei)
776
            ->入力_名($nameMei)
777
            ->入力_セイ('セイ')
778
            ->入力_メイ('メイ')
779
            ->入力_郵便番号1('530')
780
            ->入力_郵便番号2('0001')
781
            ->入力_都道府県(['value' => '27'])
782
            ->入力_市区町村名('大阪市北区2')
783
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F2')
784
            ->入力_電話番号1('222')
785
            ->入力_電話番号2('222')
786
            ->入力_電話番号3('222')
787
            ->登録する();
788
789
        // 新規お届け先が追加されていることを確認
790
        $I->see($nameSei, '#form_shipping_multiple_0_shipping_0_customer_address > option:nth-child(2)');
791
792
        // -------- EF0305-UC06-T01_複数配送 - 同じ商品種別(同一配送先) --------
793
        // 複数配送設定
794
        MultipleShippingPage::at($I)
795
            ->お届け先追加()
796
            ->入力_お届け先('0', '0', $customer->getName01())
797
            ->入力_お届け先('0', '1', $customer->getName01())
798
            ->入力_数量('0', '0', $shipping1_quantity)
799
            ->入力_数量('0', '1', $shipping2_quantity)
800
            ->選択したお届け先に送る()
801
        ;
802
803
        // 配送先が1個なので数量をまとめる
804
        $sum_quantity = $shipping1_quantity + $shipping2_quantity;
805
806
        // 複数配送設定がされておらず、個数が1明細にまとめられていることを確認
807
        $I->see('お届け先', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
808
        $I->dontSee('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
809
        $I->dontSee('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
810
        $I->see(' × '.$sum_quantity, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(3) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
811
        $I->see($customer->getName01(), '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
812
813
        // -------- EF0305-UC06-T02_複数配送 - 同じ商品種別(別配送先) --------
814
815
        ShoppingPage::at($I)->お届け先追加();
816
817
        // 複数配送設定
818
        MultipleShippingPage::at($I)
819
            ->お届け先追加()
820
            ->入力_お届け先('0', '0', $customer->getName01())
821
            ->入力_お届け先('0', '1', $nameSei)
822
            ->入力_数量('0', '0', $shipping1_quantity)
823
            ->入力_数量('0', '1', $shipping2_quantity)
824
            ->選択したお届け先に送る()
825
        ;
826
827
        // 名前を比較してお届け先が上下どちらに表示されるか判断
828
        $compared = strnatcmp($customer->getName01(), $nameSei);
829
        if($compared === 0) {
830
            $compared = strnatcmp($customer->getName02(), $nameMei);
831
        }
832
        // 上下それぞれで名前、商品個数を設定
833 View Code Duplication
        if($compared < 0) {
834
            $quantity1 = $shipping1_quantity;
835
            $quantity2 = $shipping2_quantity;
836
            $name1 = $customer->getName01();
837
            $name2 = $nameSei;
838
        } else {
839
            $quantity1 = $shipping2_quantity;
840
            $quantity2 = $shipping1_quantity;
841
            $name1 = $nameSei;
842
            $name2 = $customer->getName01();
843
        }
844
845
        // 複数配送設定ができていることを確認
846
        $I->see('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
847
        $I->see(' × '.$quantity1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(3) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
848
        $I->see($name1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
849
        $I->see('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
850
        $I->see(' × '.$quantity2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(7) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
851
        $I->see($name2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(8) > p:nth-child(1)');
852
853
        // 商品詳細パーコレータ カートへ
854
        ProductDetailPage::go($I, 2)
855
            ->カートに入れる($cart_quantity);
856
857
        $I->acceptPopup();
858
859
        // 一旦カートに戻る
860
        CartPage::go($I)
861
            ->レジに進む();
862
863
        // カートに変更があったため、お届け先を初期化
864
        $I->see('お届け先', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
865
        $I->dontSee('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
866
        $I->dontSee('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
867
        $I->see(' × '.($sum_quantity + $cart_quantity), '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(3) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
868
        $I->see($customer->getName01(), '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
869
870
        ShoppingPage::at($I)->確認する();
871
        ShoppingConfirmPage::at($I)->注文する();
872
873
        $I->wait(1);
874
875
        // メール確認
876
        $I->seeEmailCount(2);
877
        foreach (array($customer->getEmail(), $BaseInfo->getEmail01()) as $email) {
878
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
879
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
880
            $I->seeInLastEmailTo($email, 'お名前 :'.$customer->getName01().' '.$customer->getName02().' 様');
881
            $I->seeInLastEmailTo($email, 'お名前(フリガナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
882
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getZip01().'-'.$customer->getZip02());
883
            $I->seeInLastEmailTo($email, '住所  :'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
884
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getTel01().'-'.$customer->getTel02().'-'.$customer->getTel03());
885
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
886
            $I->seeInLastEmailTo($email, '◎お届け先');
887
            $I->seeInLastEmailTo($email, 'お名前 :'.$customer->getName01());
888
            $I->seeInLastEmailTo($email, '数量:'.($sum_quantity + $cart_quantity));
889
        }
890
891
        // 完了画面 -> topへ
892
        ShoppingCompletePage::at($I)->TOPへ();
893
        $I->see('新着情報', '.ec-news__title');
894
    }
895
}
896