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

codeception/acceptance/EF03OrderCest.php (13 issues)

Upgrade to new PHP Analysis Engine

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

1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.ec-cube.co.jp/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
use Codeception\Util\Fixtures;
15
use Eccube\Entity\Customer;
16
use Page\Front\CartPage;
17
use Page\Front\CustomerAddressAddPage;
18
use Page\Front\MultipleShippingPage;
19
use Page\Front\ProductDetailPage;
20
use Page\Front\ShippingEditPage;
21
use Page\Front\ShoppingCompletePage;
22
use Page\Front\ShoppingConfirmPage;
23
use Page\Front\ShoppingLoginPage;
24
use Page\Front\ShoppingPage;
25
use Page\Front\TopPage;
26
27
/**
28
 * @group front
29
 * @group order
30
 * @group ef3
31
 */
32
class EF03OrderCest
33
{
34
    public function _before(\AcceptanceTester $I)
35
    {
36
        $I->setStock(2, 20);
37
    }
38
39
    public function _after(\AcceptanceTester $I)
0 ignored issues
show
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...
40
    {
41
    }
42
43 View Code Duplication
    public function order_カート買い物を続ける(\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...
44
    {
45
        $I->wantTo('EF0301-UC01-T01 カート 買い物を続ける');
46
        $createCustomer = Fixtures::get('createCustomer');
47
        $customer = $createCustomer();
48
        $I->loginAsMember($customer->getEmail(), 'password');
49
50
        // 商品詳細パーコレータ カートへ
51
        ProductDetailPage::go($I, 2)
52
            ->カートに入れる(1)
53
            ->カートへ進む();
54
55
        CartPage::go($I)
56
            ->お買い物を続ける();
57
58
        // トップページ
59
        $I->see('新着情報', '.ec-secHeading__ja');
60
    }
61
62
    public function order_一覧からカートに入れる(\AcceptanceTester $I)
63
    {
64
        $I->wantTo('EF0301-UC01-T02 カート 買い物を続ける');
65
66
        $ProductListPage = TopPage::go($I)
67
            ->検索('彩のジェラートCUBE');
68
69
        $CartPage = $ProductListPage
70
            ->カートに入れる(1, 1, [3 => 'チョコ'], [6 => '16mm × 16mm'])
71
            ->カートへ進む();
72
73
        $I->assertEquals(1, $CartPage->明細数());
74
        $I->assertContains('彩のジェラートCUBE', $CartPage->商品名(1));
75
        $I->assertContains('チョコ', $CartPage->商品名(1));
76
        $I->assertContains('16mm × 16mm', $CartPage->商品名(1));
77
        $I->assertEquals(1, $CartPage->商品数量(1));
78
    }
79
80
    public function order_カート削除(\AcceptanceTester $I)
81
    {
82
        $I->wantTo('EF0301-UC01-T02 カート 削除');
83
        $createCustomer = Fixtures::get('createCustomer');
84
        $customer = $createCustomer();
85
        $I->loginAsMember($customer->getEmail(), 'password');
86
87
        ProductDetailPage::go($I, 2)
88
            ->カートに入れる(1)
89
            ->カートへ進む();
90
91
        CartPage::go($I)
92
            ->商品削除(1);
93
    }
94
95 View Code Duplication
    public function order_カート数量増やす(\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...
96
    {
97
        $I->wantTo('EF0301-UC01-T03 カート 数量増やす');
98
99
        $createCustomer = Fixtures::get('createCustomer');
100
        $customer = $createCustomer();
101
        $I->loginAsMember($customer->getEmail(), 'password');
102
103
        // 商品詳細パーコレータ カートへ
104
        ProductDetailPage::go($I, 2)
105
            ->カートに入れる(1)
106
            ->カートへ進む();
107
108
        $cartPage = CartPage::go($I)
109
            ->商品数量増やす(1);
110
111
        // 確認
112
        $I->assertEquals('2', $cartPage->商品数量(1));
113
    }
114
115 View Code Duplication
    public function order_カート数量減らす(\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...
116
    {
117
        $I->wantTo('EF0301-UC01-T04 カート 数量減らす');
118
        $createCustomer = Fixtures::get('createCustomer');
119
        $customer = $createCustomer();
120
        $I->loginAsMember($customer->getEmail(), 'password');
121
122
        // 商品詳細パーコレータ カートへ
123
        ProductDetailPage::go($I, 2)
124
            ->カートに入れる(2)
125
            ->カートへ進む();
126
127
        $cartPage = CartPage::go($I)
128
            ->商品数量減らす(1);
129
130
        // 確認
131
        $I->assertEquals('1', $cartPage->商品数量(1));
132
    }
133
134
    public function order_ログインユーザ購入(\AcceptanceTester $I)
135
    {
136
        $I->wantTo('EF0302-UC01-T01 ログインユーザ購入');
137
        $I->logoutAsMember();
138
        $createCustomer = Fixtures::get('createCustomer');
139
        $customer = $createCustomer();
140
        $BaseInfo = Fixtures::get('baseinfo');
141
142
        // 商品詳細パーコレータ カートへ
143
        ProductDetailPage::go($I, 2)
144
            ->カートに入れる(1)
145
            ->カートへ進む();
146
147
        CartPage::go($I)
148
            ->レジに進む();
149
150
        // ログイン
151
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
152
153
        $I->resetEmails();
154
155
        ShoppingPage::at($I)->確認する();
156
        ShoppingConfirmPage::at($I)->注文する();
157
158
        $I->wait(1);
159
160
        // メール確認
161
        $I->seeEmailCount(2);
162
        foreach ([$customer->getEmail(), $BaseInfo->getEmail01()] as $email) {
163
            // TODO 注文した商品の内容もチェックしたい
164
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
165
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
166
            $I->seeInLastEmailTo($email, 'お名前:'.$customer->getName01().' '.$customer->getName02().' 様');
167
            $I->seeInLastEmailTo($email, 'お名前(カナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
168
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getPostalCode());
169
            $I->seeInLastEmailTo($email, '住所:'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
170
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getPhoneNumber());
171
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
172
        }
173
174
        // 完了画面 -> topへ
175
        ShoppingCompletePage::at($I)->TOPへ();
176
        $I->see('新着情報', '.ec-secHeading__ja');
177
    }
178
179
    public function order_ゲスト購入(\AcceptanceTester $I)
180
    {
181
        $I->wantTo('EF0302-UC02-T01 ゲスト購入');
182
        $I->logoutAsMember();
183
184
        $faker = Fixtures::get('faker');
185
        $new_email = microtime(true).'.'.$faker->safeEmail;
186
        $BaseInfo = Fixtures::get('baseinfo');
187
188
        ProductDetailPage::go($I, 2)
189
            ->カートに入れる(1)
190
            ->カートへ進む();
191
192
        CartPage::go($I)
193
            ->レジに進む();
194
195
        $ShoppingPage = ShoppingLoginPage::at($I)->ゲスト購入();
196
        $ShoppingPage
197
            ->入力_姓('姓03')
198
            ->入力_名('名03')
199
            ->入力_セイ('セイ')
200
            ->入力_メイ('メイ')
201
            ->入力_郵便番号('530-0001');
202
203
        // TODO: 郵便番号入力後のcodeceptionの入力後にJSが走ってしまい「梅田」が2重で入力されてしまう。
204
        // 上記を回避するためにwait関数を入れる。
205
        // こちらは本体のmasterブランチで修正されているので、master -> sf マージ後には不要になる見込み。
206
        $I->wait(5);
207
208
        $ShoppingPage
209
            ->入力_都道府県(['value' => '27'])
210
            ->入力_市区町村名('大阪市北区')
211
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F')
212
            ->入力_電話番号('111-111-111')
213
            ->入力_Eメール($new_email)
214
            ->入力_Eメール確認($new_email)
215
            ->次へ();
216
217
        $I->resetEmails();
218
219
        ShoppingPage::at($I)->確認する();
220
        ShoppingConfirmPage::at($I)->注文する();
221
222
        $I->wait(1);
223
224
        // 確認
225
        $I->seeEmailCount(2);
226 View Code Duplication
        foreach ([$new_email, $BaseInfo->getEmail01()] as $email) {
227
            // TODO 注文した商品の内容もチェックしたい
228
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
229
            $I->seeInLastEmailTo($email, '姓03 名03 様');
230
            $I->seeInLastEmailTo($email, 'お名前:姓03 名03 様');
231
            $I->seeInLastEmailTo($email, 'お名前(カナ):セイ メイ 様');
232
            $I->seeInLastEmailTo($email, '郵便番号:〒5300001');
233
            $I->seeInLastEmailTo($email, '住所:大阪府大阪市北区梅田2-4-9 ブリーゼタワー13F');
234
            $I->seeInLastEmailTo($email, '電話番号:111111111');
235
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$new_email);
236
        }
237
238
        // 完了画面 -> topへ
239
        ShoppingCompletePage::at($I)->TOPへ();
240
        $I->see('新着情報', '.ec-secHeading__ja');
241
    }
242
243
    public function order_ゲスト購入情報変更(\AcceptanceTester $I)
244
    {
245
        $I->wantTo('EF0305-UC02-T01 ゲスト購入 情報変更'); // EF0305-UC04-T01も一緒にテスト
246
        $I->logoutAsMember();
247
248
        $faker = Fixtures::get('faker');
249
        $new_email = microtime(true).'.'.$faker->safeEmail;
250
        $BaseInfo = Fixtures::get('baseinfo');
251
252
        // 商品詳細パーコレータ カートへ
253
        ProductDetailPage::go($I, 2)
254
            ->カートに入れる(1)
255
            ->カートへ進む();
256
257
        CartPage::go($I)
258
            ->レジに進む();
259
260
        $ShoppingPage = ShoppingLoginPage::at($I)->ゲスト購入();
261
        $ShoppingPage
262
            ->入力_姓('姓03')
263
            ->入力_名('名03')
264
            ->入力_セイ('セイ')
265
            ->入力_メイ('メイ')
266
            ->入力_郵便番号('530-0001');
267
268
        // TODO: 郵便番号入力後のcodeceptionの入力後にJSが走ってしまい「梅田」が2重で入力されてしまう。
269
        // 上記を回避するためにwait関数を入れる。
270
        // こちらは本体のmasterブランチで修正されているので、master -> sf マージ後には不要になる見込み。
271
        $I->wait(5);
272
273
        $ShoppingPage
274
            ->入力_都道府県(['value' => '27'])
275
            ->入力_市区町村名('大阪市北区')
276
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F')
277
            ->入力_電話番号('111-111-111')
278
            ->入力_Eメール($new_email)
279
            ->入力_Eメール確認($new_email)
280
            ->次へ();
281
282
        // 確認
283
        $ShoppingPage = ShoppingPage::at($I)
284
            ->お客様情報変更()
285
            ->入力_姓('姓0301')
286
            ->お客様情報変更OK();
287
288
        // 確認
289
        $I->see('姓0301', '#shopping-form .customer-name01');
290
291
        // 配送情報
292
        $ShoppingPage->お届け先変更();
293
294
        ShippingEditPage::at($I)
295
            ->入力_姓('姓0302')
296
            ->登録する();
297
298
        $I->see('姓0302', 'div.ec-orderRole div.ec-orderDelivery__address');
299
300
        $I->resetEmails();
301
302
        ShoppingPage::at($I)->確認する();
303
        ShoppingConfirmPage::at($I)->注文する();
304
305
        $I->seeEmailCount(2);
306 View Code Duplication
        foreach ([$new_email, $BaseInfo->getEmail01()] as $email) {
307
            // TODO 注文した商品の内容もチェックしたい
308
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
309
            $I->seeInLastEmailTo($email, '姓0301 名03 様');
310
            $I->seeInLastEmailTo($email, 'お名前:姓0302 名03 様', '変更後のお届け先');
311
            $I->seeInLastEmailTo($email, '郵便番号:〒5300001');
312
            $I->seeInLastEmailTo($email, '住所:大阪府大阪市北区梅田2-4-9 ブリーゼタワー13F');
313
            $I->seeInLastEmailTo($email, '電話番号:111111111');
314
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$new_email);
315
        }
316
317
        // topへ
318
        ShoppingCompletePage::at($I)->TOPへ();
319
        $I->see('新着情報', '.ec-secHeading__ja');
320
    }
321
322
    /**
323
     * @see https://github.com/EC-CUBE/ec-cube/pull/3133
324
     */
325
    public function order_ログインしてカートをマージ(\AcceptanceTester $I)
326
    {
327
        $I->wantTo('EF0305-UC07-T01 ログインしてカートをマージ');
328
        $I->logoutAsMember();
329
        $createCustomer = Fixtures::get('createCustomer');
330
        $customer = $createCustomer();
331
        $BaseInfo = Fixtures::get('baseinfo');
332
333
        // 商品詳細パーコレータ カートへ
334
        ProductDetailPage::go($I, 2)
335
            ->カートに入れる(1)
336
            ->カートへ進む();
337
338
        CartPage::go($I)
339
            ->レジに進む();
340
341
        // ログイン
342
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
343
344
        $I->resetEmails();
345
346
        ShoppingPage::at($I)->確認する();
347
        $I->logoutAsMember();
348
349
        // 商品詳細ジェラート カートへ
350
        ProductDetailPage::go($I, 1)
351
            ->規格選択(['チョコ', '16mm × 16mm'])
352
            ->カートに入れる(1)
353
            ->カートへ進む();
354
355
        CartPage::go($I)
356
            ->レジに進む();
357
358
        // ログイン
359
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
360
361
        ShoppingPage::at($I)->確認する();
362
        ShoppingConfirmPage::at($I)->注文する();
363
364
        $I->wait(1);
365
366
        // メール確認
367
        $I->seeEmailCount(2);
368
        foreach ([$customer->getEmail(), $BaseInfo->getEmail01()] as $email) {
369
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
370
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
371
            $I->seeInLastEmailTo($email, 'お名前:'.$customer->getName01().' '.$customer->getName02().' 様');
372
            $I->seeInLastEmailTo($email, 'お名前(カナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
373
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getPostalCode());
374
            $I->seeInLastEmailTo($email, '住所:'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
375
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getPhoneNumber());
376
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
377
378
            $I->seeInLastEmailTo($email, '商品名:チェリーアイスサンド');
379
            $I->seeInLastEmailTo($email, '商品名:彩のジェラートCUBE  チョコ  16mm × 16mm');
380
        }
381
382
        // 完了画面 -> topへ
383
        ShoppingCompletePage::at($I)->TOPへ();
384
        $I->see('新着情報', '.ec-secHeading__ja');
385
    }
386
387
    public function order_ログインユーザ購入複数配送(\AcceptanceTester $I)
388
    {
389
        // チェック用変数
390
        // 追加するお届け作の名前
391
        $nameSei = 'あいおい0302';
392
        $nameMei = '名0302';
393
        // カートへ入れる商品の数
394
        $cart_quantity = 1;
395
        // お届け先ごとに設定する商品の数
396
        $shipping1_quantity = 2;
397
        $shipping2_quantity = 3;
398
399
        $I->wantTo('EF0305-UC05-T01 お届け先の追加');
400
        $I->logoutAsMember();
401
        $createCustomer = Fixtures::get('createCustomer');
402
        /** @var \Eccube\Entity\CustomerAddress $customer */
403
        $customer = $createCustomer();
404
        $BaseInfo = Fixtures::get('baseinfo');
405
406
        // 商品詳細パーコレータ カートへ
407
        ProductDetailPage::go($I, 2)
408
            ->カートに入れる($cart_quantity)
409
            ->カートへ進む();
410
411
        CartPage::go($I)
412
            ->レジに進む();
413
414
        // ログイン
415
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
0 ignored issues
show
The method getEmail() does not seem to exist on object<Eccube\Entity\CustomerAddress>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
416
417
        $I->resetEmails();
418
419
        // -------- EF0305-UC05-T01_お届け先の追加 --------
420
        ShoppingPage::at($I)->お届け先追加();
421
422
        // 新規お届け先追加
423
        MultipleShippingPage::at($I)->新規お届け先を追加する();
424
        CustomerAddressAddPage::at($I)
425
            ->入力_姓($nameSei)
426
            ->入力_名($nameMei)
427
            ->入力_セイ('セイ')
428
            ->入力_メイ('メイ')
429
            ->入力_郵便番号('530-0001')
430
            ->入力_都道府県(['value' => '27'])
431
            ->入力_市区町村名('大阪市北区2')
432
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F2')
433
            ->入力_電話番号('222-222-222')
434
            ->登録する();
435
436
        // 新規お届け先が追加されていることを確認
437
        $I->see($nameSei, '#form_shipping_multiple_0_shipping_0_customer_address > option:nth-child(2)');
438
439
        // -------- EF0305-UC06-T01_複数配送 - 同じ商品種別(同一配送先) --------
440
        // 複数配送設定
441
        MultipleShippingPage::at($I)
442
            ->お届け先追加()
443
            ->入力_お届け先('0', '0', $customer->getName01())
444
            ->入力_お届け先('0', '1', $customer->getName01())
445
            ->入力_数量('0', '0', $shipping1_quantity)
446
            ->入力_数量('0', '1', $shipping2_quantity)
447
            ->選択したお届け先に送る()
448
        ;
449
450
        // 配送先が1個なので数量をまとめる
451
        $sum_quantity = $shipping1_quantity + $shipping2_quantity;
452
453
        // 複数配送設定がされておらず、個数が1明細にまとめられていることを確認
454
        $I->see('お届け先', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
455
        $I->dontSee('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
456
        $I->dontSee('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
457
        $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)');
458
        $I->see($customer->getName01(), '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
459
460
        // -------- EF0305-UC06-T02_複数配送 - 同じ商品種別(別配送先) --------
461
462
        ShoppingPage::at($I)->お届け先追加();
463
464
        // 複数配送設定
465
        MultipleShippingPage::at($I)
466
            ->お届け先追加()
467
            ->入力_お届け先('0', '0', $customer->getName01())
468
            ->入力_お届け先('0', '1', $nameSei)
469
            ->入力_数量('0', '0', $shipping1_quantity)
470
            ->入力_数量('0', '1', $shipping2_quantity)
471
            ->選択したお届け先に送る()
472
        ;
473
474
        // 名前を比較してお届け先が上下どちらに表示されるか判断
475
        $compared = strnatcmp($customer->getName01(), $nameSei);
476
        if ($compared === 0) {
477
            $compared = strnatcmp($customer->getName02(), $nameMei);
478
        }
479
        // 上下それぞれで名前、商品個数を設定
480 View Code Duplication
        if ($compared < 0) {
481
            $quantity1 = $shipping1_quantity;
482
            $quantity2 = $shipping2_quantity;
483
            $name1 = $customer->getName01();
484
            $name2 = $nameSei;
485
        } else {
486
            $quantity1 = $shipping2_quantity;
487
            $quantity2 = $shipping1_quantity;
488
            $name1 = $nameSei;
489
            $name2 = $customer->getName01();
490
        }
491
492
        // 複数配送設定ができていることを確認
493
        $I->see('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
494
        $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)');
495
        $I->see($name1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
496
        $I->see('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
497
        $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)');
498
        $I->see($name2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(8) > p:nth-child(1)');
499
500
        ShoppingPage::at($I)->確認する();
501
        ShoppingConfirmPage::at($I)->注文する();
502
503
        $I->wait(1);
504
505
        // メール確認
506
        $I->seeEmailCount(2);
507 View Code Duplication
        foreach ([$customer->getEmail(), $BaseInfo->getEmail01()] as $email) {
0 ignored issues
show
The method getEmail() does not seem to exist on object<Eccube\Entity\CustomerAddress>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
508
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
509
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
510
            $I->seeInLastEmailTo($email, 'お名前:'.$customer->getName01().' '.$customer->getName02().' 様');
511
            $I->seeInLastEmailTo($email, 'お名前(カナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
512
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getPostalCode());
513
            $I->seeInLastEmailTo($email, '住所:'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
514
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getPhoneNumber());
515
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
0 ignored issues
show
The method getEmail() does not seem to exist on object<Eccube\Entity\CustomerAddress>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
516
            $I->seeInLastEmailTo($email, '◎お届け先1');
517
            $I->seeInLastEmailTo($email, 'お名前:'.$nameSei);
518
            $I->seeInLastEmailTo($email, '数量:3');
519
            $I->seeInLastEmailTo($email, '◎お届け先2');
520
            $I->seeInLastEmailTo($email, '数量:2');
521
        }
522
523
        // 完了画面 -> topへ
524
        ShoppingCompletePage::at($I)->TOPへ();
525
        $I->see('新着情報', '.ec-secHeading__ja');
526
    }
527
528
    public function order_ログイン後に複数カートになればカートに戻す(\AcceptanceTester $I)
529
    {
530
        $I->wantTo('EF0303-UC01-T01_購入フローでログインしたタイミングで複数カートになったらログイン後にカート画面に戻す');
531
        $I->logoutAsMember();
532
        $createCustomer = Fixtures::get('createCustomer');
533
        $customer = $createCustomer();
534
        $I->loginAsMember($customer->getEmail(), 'password');
535
536
        // 商品詳細パーコレータ カートへ
537
        ProductDetailPage::go($I, 2)
538
            ->カートに入れる(1)
539
            ->カートへ進む();
540
541
        CartPage::go($I)
542
            ->レジに進む();
543
544
        // ログアウト
545
        $I->logoutAsMember();
546
547
        $createProduct = Fixtures::get('createProduct');
548
        $Product = $createProduct();
549
550
        $entityManager = Fixtures::get('entityManager');
551
        $ProductClass = $Product->getProductClasses()[0];
552
        $SaleType = $entityManager->find(\Eccube\Entity\Master\SaleType::class, 2);
553
        $ProductClass->setSaleType($SaleType);
554
        $entityManager->persist($ProductClass);
555
        $entityManager->flush();
556
557
        if ($ProductClass->getClassCategory2()) {
558
            // 商品詳細
559
            ProductDetailPage::go($I, $Product->getId())
560
                ->規格選択([$ProductClass->getClassCategory1(), $ProductClass->getClassCategory2()])
561
                ->カートに入れる(1)
562
                ->カートへ進む();
563
        } else {
564
            ProductDetailPage::go($I, $Product->getId())
565
                ->規格選択([$ProductClass->getClassCategory1()])
566
                ->カートに入れる(1)
567
                ->カートへ進む();
568
        }
569
570
        CartPage::go($I)
571
            ->レジに進む();
572
573
        // ログイン
574
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
575
576
        $I->see('同時購入できない商品がカートに含まれています', '.ec-alert-warning__text');
577
    }
578
579
    /**
580
     * カートに変更が無ければ、お届け先の設定が引き継がれる.
581
     */
582
    public function order_購入確認画面からカートに戻る(\AcceptanceTester $I)
583
    {
584
        // チェック用変数
585
        // 追加するお届け作の名前
586
        $nameSei = 'あいおい0302';
587
        $nameMei = '名0302';
588
        // カートへ入れる商品の数
589
        $cart_quantity = 1;
590
        // お届け先ごとに設定する商品の数
591
        $shipping1_quantity = 2;
592
        $shipping2_quantity = 3;
593
594
        $I->wantTo('EF0305-UC08-T01 購入確認画面からカートに戻る');
595
        $I->logoutAsMember();
596
        $createCustomer = Fixtures::get('createCustomer');
597
        /** @var \Eccube\Entity\CustomerAddress $customer */
598
        $customer = $createCustomer();
599
        $BaseInfo = Fixtures::get('baseinfo');
600
601
        // 商品詳細パーコレータ カートへ
602
        ProductDetailPage::go($I, 2)
603
            ->カートに入れる($cart_quantity)
604
            ->カートへ進む();
605
606
        CartPage::go($I)
607
            ->レジに進む();
608
609
        // ログイン
610
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
0 ignored issues
show
The method getEmail() does not seem to exist on object<Eccube\Entity\CustomerAddress>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
611
612
        $I->resetEmails();
613
614
        // -------- EF0305-UC05-T01_お届け先の追加 --------
615
        ShoppingPage::at($I)->お届け先追加();
616
617
        // 新規お届け先追加
618
        MultipleShippingPage::at($I)->新規お届け先を追加する();
619
        CustomerAddressAddPage::at($I)
620
            ->入力_姓($nameSei)
621
            ->入力_名($nameMei)
622
            ->入力_セイ('セイ')
623
            ->入力_メイ('メイ')
624
            ->入力_郵便番号('530-0001')
625
            ->入力_都道府県(['value' => '27'])
626
            ->入力_市区町村名('大阪市北区2')
627
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F2')
628
            ->入力_電話番号('222-222-222')
629
            ->登録する();
630
631
        // 新規お届け先が追加されていることを確認
632
        $I->see($nameSei, '#form_shipping_multiple_0_shipping_0_customer_address > option:nth-child(2)');
633
634
        // -------- EF0305-UC06-T01_複数配送 - 同じ商品種別(同一配送先) --------
635
        // 複数配送設定
636
        MultipleShippingPage::at($I)
637
            ->お届け先追加()
638
            ->入力_お届け先('0', '0', $customer->getName01())
639
            ->入力_お届け先('0', '1', $customer->getName01())
640
            ->入力_数量('0', '0', $shipping1_quantity)
641
            ->入力_数量('0', '1', $shipping2_quantity)
642
            ->選択したお届け先に送る()
643
        ;
644
645
        // 配送先が1個なので数量をまとめる
646
        $sum_quantity = $shipping1_quantity + $shipping2_quantity;
647
648
        // 複数配送設定がされておらず、個数が1明細にまとめられていることを確認
649
        $I->see('お届け先', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
650
        $I->dontSee('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
651
        $I->dontSee('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
652
        $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)');
653
        $I->see($customer->getName01(), '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
654
655
        // -------- EF0305-UC06-T02_複数配送 - 同じ商品種別(別配送先) --------
656
657
        ShoppingPage::at($I)->お届け先追加();
658
659
        // 複数配送設定
660
        MultipleShippingPage::at($I)
661
            ->お届け先追加()
662
            ->入力_お届け先('0', '0', $customer->getName01())
663
            ->入力_お届け先('0', '1', $nameSei)
664
            ->入力_数量('0', '0', $shipping1_quantity)
665
            ->入力_数量('0', '1', $shipping2_quantity)
666
            ->選択したお届け先に送る()
667
        ;
668
669
        // 名前を比較してお届け先が上下どちらに表示されるか判断
670
        $compared = strnatcmp($customer->getName01(), $nameSei);
671
        if ($compared === 0) {
672
            $compared = strnatcmp($customer->getName02(), $nameMei);
673
        }
674
        // 上下それぞれで名前、商品個数を設定
675 View Code Duplication
        if ($compared < 0) {
676
            $quantity1 = $shipping1_quantity;
677
            $quantity2 = $shipping2_quantity;
678
            $name1 = $customer->getName01();
679
            $name2 = $nameSei;
680
        } else {
681
            $quantity1 = $shipping2_quantity;
682
            $quantity2 = $shipping1_quantity;
683
            $name1 = $nameSei;
684
            $name2 = $customer->getName01();
685
        }
686
687
        // 複数配送設定ができていることを確認
688
        $I->see('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
689
        $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)');
690
        $I->see($name1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
691
        $I->see('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
692
        $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)');
693
        $I->see($name2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(8) > p:nth-child(1)');
694
695
        // 一旦カートに戻る
696
        CartPage::go($I)
697
            ->レジに進む();
698
699
        // お届け先が復元されている
700
        $I->see('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
701
        $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)');
702
        $I->see($name1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
703
        $I->see('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
704
        $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)');
705
        $I->see($name2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(8) > p:nth-child(1)');
706
707
        ShoppingPage::at($I)->確認する();
708
        ShoppingConfirmPage::at($I)->注文する();
709
710
        $I->wait(1);
711
712
        // メール確認
713
        $I->seeEmailCount(2);
714 View Code Duplication
        foreach ([$customer->getEmail(), $BaseInfo->getEmail01()] as $email) {
0 ignored issues
show
The method getEmail() does not seem to exist on object<Eccube\Entity\CustomerAddress>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
715
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
716
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
717
            $I->seeInLastEmailTo($email, 'お名前:'.$customer->getName01().' '.$customer->getName02().' 様');
718
            $I->seeInLastEmailTo($email, 'お名前(カナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
719
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getPostalCode());
720
            $I->seeInLastEmailTo($email, '住所:'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
721
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getPhoneNumber());
722
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
0 ignored issues
show
The method getEmail() does not seem to exist on object<Eccube\Entity\CustomerAddress>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
723
            $I->seeInLastEmailTo($email, '◎お届け先1');
724
            $I->seeInLastEmailTo($email, 'お名前:'.$nameSei);
725
            $I->seeInLastEmailTo($email, '数量:3');
726
            $I->seeInLastEmailTo($email, '◎お届け先2');
727
            $I->seeInLastEmailTo($email, '数量:2');
728
        }
729
730
        // 完了画面 -> topへ
731
        ShoppingCompletePage::at($I)->TOPへ();
732
        $I->see('新着情報', '.ec-secHeading__ja');
733
    }
734
735
    /**
736
     * カートに変更があれば、お届け先の設定は初期化される.
737
     */
738
    public function order_購入確認画面からカートに戻るWithお届け先初期化(\AcceptanceTester $I)
739
    {
740
        // チェック用変数
741
        // 追加するお届け作の名前
742
        $nameSei = 'あいおい0302';
743
        $nameMei = '名0302';
744
        // カートへ入れる商品の数
745
        $cart_quantity = 1;
746
        // お届け先ごとに設定する商品の数
747
        $shipping1_quantity = 1;
748
        $shipping2_quantity = 2;
749
750
        $I->wantTo('EF0305-UC08-T02 購入確認画面からカートに戻る(お届け先初期化)');
751
        $I->logoutAsMember();
752
        $createCustomer = Fixtures::get('createCustomer');
753
        /** @var \Eccube\Entity\CustomerAddress $customer */
754
        $customer = $createCustomer();
755
        $BaseInfo = Fixtures::get('baseinfo');
756
757
        // 商品詳細パーコレータ カートへ
758
        ProductDetailPage::go($I, 2)
759
            ->カートに入れる($cart_quantity)
760
            ->カートへ進む();
761
762
        CartPage::go($I)
763
            ->レジに進む();
764
765
        // ログイン
766
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
0 ignored issues
show
The method getEmail() does not seem to exist on object<Eccube\Entity\CustomerAddress>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
767
768
        $I->resetEmails();
769
770
        // -------- EF0305-UC05-T01_お届け先の追加 --------
771
        ShoppingPage::at($I)->お届け先追加();
772
773
        // 新規お届け先追加
774
        MultipleShippingPage::at($I)->新規お届け先を追加する();
775
        CustomerAddressAddPage::at($I)
776
            ->入力_姓($nameSei)
777
            ->入力_名($nameMei)
778
            ->入力_セイ('セイ')
779
            ->入力_メイ('メイ')
780
            ->入力_郵便番号('530-0001')
781
            ->入力_都道府県(['value' => '27'])
782
            ->入力_市区町村名('大阪市北区2')
783
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F2')
784
            ->入力_電話番号('222-222-222')
785
            ->登録する();
786
787
        // 新規お届け先が追加されていることを確認
788
        $I->see($nameSei, '#form_shipping_multiple_0_shipping_0_customer_address > option:nth-child(2)');
789
790
        // -------- EF0305-UC06-T01_複数配送 - 同じ商品種別(同一配送先) --------
791
        // 複数配送設定
792
        MultipleShippingPage::at($I)
793
            ->お届け先追加()
794
            ->入力_お届け先('0', '0', $customer->getName01())
795
            ->入力_お届け先('0', '1', $customer->getName01())
796
            ->入力_数量('0', '0', $shipping1_quantity)
797
            ->入力_数量('0', '1', $shipping2_quantity)
798
            ->選択したお届け先に送る()
799
        ;
800
801
        // 配送先が1個なので数量をまとめる
802
        $sum_quantity = $shipping1_quantity + $shipping2_quantity;
803
804
        // 複数配送設定がされておらず、個数が1明細にまとめられていることを確認
805
        $I->see('お届け先', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
806
        $I->dontSee('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
807
        $I->dontSee('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
808
        $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)');
809
        $I->see($customer->getName01(), '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
810
811
        // -------- EF0305-UC06-T02_複数配送 - 同じ商品種別(別配送先) --------
812
813
        ShoppingPage::at($I)->お届け先追加();
814
815
        // 複数配送設定
816
        MultipleShippingPage::at($I)
817
            ->お届け先追加()
818
            ->入力_お届け先('0', '0', $customer->getName01())
819
            ->入力_お届け先('0', '1', $nameSei)
820
            ->入力_数量('0', '0', $shipping1_quantity)
821
            ->入力_数量('0', '1', $shipping2_quantity)
822
            ->選択したお届け先に送る()
823
        ;
824
825
        // 名前を比較してお届け先が上下どちらに表示されるか判断
826
        $compared = strnatcmp($customer->getName01(), $nameSei);
827
        if ($compared === 0) {
828
            $compared = strnatcmp($customer->getName02(), $nameMei);
829
        }
830
        // 上下それぞれで名前、商品個数を設定
831 View Code Duplication
        if ($compared < 0) {
832
            $quantity1 = $shipping1_quantity;
833
            $quantity2 = $shipping2_quantity;
834
            $name1 = $customer->getName01();
835
            $name2 = $nameSei;
836
        } else {
837
            $quantity1 = $shipping2_quantity;
838
            $quantity2 = $shipping1_quantity;
839
            $name1 = $nameSei;
840
            $name2 = $customer->getName01();
841
        }
842
843
        // 複数配送設定ができていることを確認
844
        $I->see('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
845
        $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)');
846
        $I->see($name1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
847
        $I->see('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
848
        $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)');
849
        $I->see($name2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(8) > p:nth-child(1)');
850
851
        // 商品詳細パーコレータ カートへ
852
        ProductDetailPage::go($I, 2)
853
            ->カートに入れる($cart_quantity)
854
            ->カートへ進む();
855
856
        // 一旦カートに戻る
857
        CartPage::go($I)
858
            ->レジに進む();
859
860
        // カートに変更があったため、お届け先を初期化
861
        $I->see('お届け先', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
862
        $I->dontSee('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
863
        $I->dontSee('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
864
        $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)');
865
        $I->see($customer->getName01(), '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
866
867
        ShoppingPage::at($I)->確認する();
868
        ShoppingConfirmPage::at($I)->注文する();
869
870
        $I->wait(1);
871
872
        // メール確認
873
        $I->seeEmailCount(2);
874
        foreach ([$customer->getEmail(), $BaseInfo->getEmail01()] as $email) {
0 ignored issues
show
The method getEmail() does not seem to exist on object<Eccube\Entity\CustomerAddress>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
875
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
876
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
877
            $I->seeInLastEmailTo($email, 'お名前:'.$customer->getName01().' '.$customer->getName02().' 様');
878
            $I->seeInLastEmailTo($email, 'お名前(カナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
879
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getPostalCode());
880
            $I->seeInLastEmailTo($email, '住所:'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
881
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getPhoneNumber());
882
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
0 ignored issues
show
The method getEmail() does not seem to exist on object<Eccube\Entity\CustomerAddress>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
883
            $I->seeInLastEmailTo($email, '◎お届け先');
884
            $I->seeInLastEmailTo($email, 'お名前:'.$customer->getName01());
885
            $I->seeInLastEmailTo($email, '数量:'.($sum_quantity + $cart_quantity));
886
        }
887
888
        // 完了画面 -> topへ
889
        ShoppingCompletePage::at($I)->TOPへ();
890
        $I->see('新着情報', '.ec-secHeading__ja');
891
    }
892
893
    public function order_複数配送設定画面での販売制限エラー(\AcceptanceTester $I)
894
    {
895
        /* @var Customer $Customer */
896
        $Customer = (Fixtures::get('createCustomer'))();
897
898
        ProductDetailPage::go($I, 2)
899
            ->カートに入れる(1)
900
            ->カートへ進む();
901
902
        CartPage::at($I)
903
            ->レジに進む();
904
905
        ShoppingLoginPage::at($I)
906
            ->ログイン($Customer->getEmail());
907
908
        ShoppingPage::at($I)
909
            ->お届け先追加();
910
911
        MultipleShippingPage::at($I)
912
            ->入力_数量('0', '0', 100)
913
            ->選択したお届け先に送る();
914
915
        ShoppingPage::at($I);
916
917
        $I->see('「チェリーアイスサンド」の在庫が不足しております。一度に在庫数を超える購入はできません。', 'div:nth-child(2) > div > div.ec-alert-warning__text');
918
    }
919
920
    public function order_複数ブラウザでログインしてカートに追加する(\AcceptanceTester $I)
921
    {
922
        $I->logoutAsMember();
923
        $I->saveSessionSnapshot('not_login');
924
925
        $createCustomer = Fixtures::get('createCustomer');
926
        /** @var Customer $customer */
927
        $customer = $createCustomer();
928
929
        // ブラウザ1ログイン
930
        $I->loginAsMember($customer->getEmail(), 'password');
931
        $I->saveSessionSnapshot('browser1');
932
933
        // ブラウザ2ログイン
934
        $I->loadSessionSnapshot('not_login');
935
        $I->loginAsMember($customer->getEmail(), 'password');
936
        $I->saveSessionSnapshot('browser2');
937
938
        /*
939
         * ブラウザ1でカートに商品を入れる
940
         */
941
        $I->loadSessionSnapshot('browser1');
942
943
        $CartPage = ProductDetailPage::go($I, 2)
944
            ->カートに入れる(1)
945
            ->カートへ進む();
946
947
        $I->assertEquals(1, $CartPage->明細数());
948
        $I->assertEquals('チェリーアイスサンド', $CartPage->商品名(1));
949
950
        /*
951
         * ブラウザ2にのカートにも反映されている
952
         */
953
        $I->loadSessionSnapshot('browser2');
954
955
        $CartPage = CartPage::go($I);
956
957
        $I->assertEquals(1, $CartPage->明細数());
958
        $I->assertEquals('チェリーアイスサンド', $CartPage->商品名(1));
959
    }
960
961
    public function order_複数ブラウザ_片方でログインしてカートに追加しもう一方にログインして別の商品を追加する(\AcceptanceTester $I)
962
    {
963
        $I->logoutAsMember();
964
        $I->saveSessionSnapshot('not_login');
965
966
        $createCustomer = Fixtures::get('createCustomer');
967
        /** @var Customer $customer */
968
        $customer = $createCustomer();
969
970
        // ブラウザ1ログイン
971
        $I->loginAsMember($customer->getEmail(), 'password');
972
        $I->saveSessionSnapshot('browser1');
973
974
        /*
975
         * ブラウザ1でカートに商品を入れる
976
         */
977
        $I->loadSessionSnapshot('browser1');
978
979
        $CartPage = ProductDetailPage::go($I, 2)
980
            ->カートに入れる(1)
981
            ->カートへ進む();
982
983
        $I->assertEquals(1, $CartPage->明細数());
984
        $I->assertContains('チェリーアイスサンド', $CartPage->商品名(1));
985
986
        /*
987
         * ブラウザ2で未ログインのまま別の商品を入れる
988
         */
989
        $I->loadSessionSnapshot('not_login');
990
        $CartPage = ProductDetailPage::go($I, 1)
991
            ->カートに入れる(1, ['1' => 'バニラ'], ['4' => '64cm × 64cm'])
992
            ->カートへ進む();
993
994
        $I->assertEquals(1, $CartPage->明細数());
995
        $I->assertContains('彩のジェラートCUBE', $CartPage->商品名(1));
996
997
        /*
998
         * ブラウザ2でログインするとブラウザ1のカートとマージされている
999
         */
1000
        $I->loginAsMember($customer->getEmail(), 'password');
1001
1002
        $CartPage = CartPage::go($I);
1003
        $I->assertEquals(2, $CartPage->明細数());
1004
        $itemNames = $I->grabMultiple(['css' => '.ec-cartRow__name a']);
1005
        $I->assertContains('彩のジェラートCUBE', $itemNames);
1006
        $I->assertContains('チェリーアイスサンド', $itemNames);
1007
1008
        /*
1009
         * ブラウザ1のカートもマージされている
1010
         */
1011
        $I->loadSessionSnapshot('browser1');
1012
1013
        $CartPage = CartPage::go($I);
1014
        $I->assertEquals(2, $CartPage->明細数());
1015
        $itemNames = $I->grabMultiple(['css' => '.ec-cartRow__name a']);
1016
        $I->assertContains('彩のジェラートCUBE', $itemNames);
1017
        $I->assertContains('チェリーアイスサンド', $itemNames);
1018
    }
1019
}
1020