|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* This file is part of EC-CUBE |
|
4
|
|
|
* |
|
5
|
|
|
* Copyright(c) 2000-2017 LOCKON CO.,LTD. All Rights Reserved. |
|
6
|
|
|
* |
|
7
|
|
|
* http://www.lockon.co.jp/ |
|
8
|
|
|
* |
|
9
|
|
|
* This program is free software; you can redistribute it and/or |
|
10
|
|
|
* modify it under the terms of the GNU General Public License |
|
11
|
|
|
* as published by the Free Software Foundation; either version 2 |
|
12
|
|
|
* of the License, or (at your option) any later version. |
|
13
|
|
|
* |
|
14
|
|
|
* This program is distributed in the hope that it will be useful, |
|
15
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17
|
|
|
* GNU General Public License for more details. |
|
18
|
|
|
* |
|
19
|
|
|
* You should have received a copy of the GNU General Public License |
|
20
|
|
|
* along with this program; if not, write to the Free Software |
|
21
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
22
|
|
|
*/ |
|
23
|
|
|
|
|
24
|
|
|
namespace Page\Front; |
|
25
|
|
|
|
|
26
|
|
|
|
|
27
|
|
|
class CartPage extends AbstractFrontPage |
|
28
|
|
|
{ |
|
29
|
|
|
public function __construct(\AcceptanceTester $I) |
|
30
|
|
|
{ |
|
31
|
|
|
parent::__construct($I); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
public static function go($I) { |
|
35
|
|
|
$page = new self($I); |
|
36
|
|
|
$page->goPage('/cart'); |
|
37
|
|
|
return $page; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public static function at($I) |
|
41
|
|
|
{ |
|
42
|
|
|
$page = new self($I); |
|
43
|
|
|
$page->tester->see('ショッピングカート', ['css' => 'div.ec-pageHeader h1']); |
|
44
|
|
|
return $page; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
public function 商品名($index) |
|
48
|
|
|
{ |
|
49
|
|
|
return $this->tester->grabTextFrom(["xpath" => "//div[@class='ec-cartRole']//ul[@class='ec-cartRow'][position()=${index}]//div[@class='ec-cartRow__name']"]); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
public function 商品数量($index) |
|
53
|
|
|
{ |
|
54
|
|
|
return $this->tester->grabTextFrom(["xpath" => "//div[@class='ec-cartRole']//ul[@class='ec-cartRow'][position()=${index}]//div[@class='ec-cartRow__amount']"]); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function 明細数() |
|
58
|
|
|
{ |
|
59
|
|
|
return count($this->tester->grabMultiple(['css' => 'ul.ec-cartRow'])); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function 商品数量増やす($index) |
|
63
|
|
|
{ |
|
64
|
|
|
$this->tester->click(["xpath" => "//div[@class='ec-cartRole']//ul[@class='ec-cartRow'][position()=${index}]//div[@class='ec-cartRow__amountUpDown']/a[contains(@class, 'ec-cartRow__amountUpButton')]"]); |
|
65
|
|
|
return $this; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function 商品数量減らす($index) |
|
69
|
|
|
{ |
|
70
|
|
|
$this->tester->click(["xpath" => "//div[@class='ec-cartRole']//ul[@class='ec-cartRow'][position()=${index}]//div[@class='ec-cartRow__amountUpDown']/a[contains(@class, 'ec-cartRow__amountDownButton')]"]); |
|
71
|
|
|
return $this; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public function 商品削除($index) |
|
75
|
|
|
{ |
|
76
|
|
|
$this->tester->click(["xpath" => "//div[@class='ec-cartRole']//ul[@class='ec-cartRow'][position()=${index}]//li[@class='ec-cartRow__delColumn']/a"]); |
|
77
|
|
|
$this->tester->acceptPopup(); |
|
78
|
|
|
return $this; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
public function エラーメッセージ() |
|
82
|
|
|
{ |
|
83
|
|
|
return $this->tester->grabTextFrom(["css" => 'div.ec-cartRole__error div.ec-alert-warning__text']); |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* @return ShoppingPage |
|
88
|
|
|
*/ |
|
89
|
|
|
public function レジに進む() |
|
90
|
|
|
{ |
|
91
|
|
|
$this->tester->click(['css' => 'div.ec-cartRole__actions a.ec-blockBtn--action']); |
|
92
|
|
|
return new ShoppingPage($this->tester); |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* @return TopPage |
|
97
|
|
|
*/ |
|
98
|
|
|
public function お買い物を続ける() |
|
99
|
|
|
{ |
|
100
|
|
|
$this->tester->click(['css' => 'div.ec-cartRole__actions a.ec-blockBtn--cancel']); |
|
101
|
|
|
return new TopPage($this->tester); |
|
102
|
|
|
} |
|
103
|
|
|
} |