Failed Conditions
Pull Request — experimental/sf (#3236)
by Kentaro
144:19 queued 116:23
created

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