|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of EC-CUBE |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright(c) LOCKON CO.,LTD. All Rights Reserved. |
|
7
|
|
|
* |
|
8
|
|
|
* http://www.lockon.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
|
|
|
namespace Page\Front; |
|
15
|
|
|
|
|
16
|
|
|
class ProductListPage extends AbstractFrontPage |
|
17
|
|
|
{ |
|
18
|
|
|
public static function at($I) |
|
19
|
|
|
{ |
|
20
|
|
|
$page = new self($I); |
|
21
|
|
|
$page->tester->seeInCurrentUrl('/products/list'); |
|
22
|
|
|
|
|
23
|
|
|
return $page; |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function __construct(\AcceptanceTester $I) |
|
27
|
|
|
{ |
|
28
|
|
|
parent::__construct($I); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function 表示件数設定($num) |
|
32
|
|
|
{ |
|
33
|
|
|
$this->tester->selectOption(['css' => "select[name = 'disp_number']"], "${num}件"); |
|
34
|
|
|
|
|
35
|
|
|
return $this; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function 表示順設定($sort) |
|
39
|
|
|
{ |
|
40
|
|
|
$this->tester->selectOption(['css' => "select[name = 'orderby']"], $sort); |
|
41
|
|
|
|
|
42
|
|
|
return $this; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function 一覧件数取得() |
|
46
|
|
|
{ |
|
47
|
|
|
$products = $this->tester->grabMultiple(['xpath' => "//*[@class='ec-shelfGrid__item']/a/p[1]"]); |
|
48
|
|
|
|
|
49
|
|
|
return count($products); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
public function カートに入れる($index, $num = 1, $category1 = null, $category2 = null) |
|
53
|
|
|
{ |
|
54
|
|
|
$this->tester->fillField(['css' => "ul.ec-shelfGrid li.ec-shelfGrid__item:nth-child(${index}) form input[name='quantity']"], $num); |
|
55
|
|
View Code Duplication |
if (!is_null($category1)) { |
|
56
|
|
|
$this->tester->selectOption(['css' => "ul.ec-shelfGrid li.ec-shelfGrid__item:nth-child(${index}) form select[name='classcategory_id1']"], $category1); |
|
57
|
|
|
if (!is_null($category2)) { |
|
58
|
|
|
$category2_id = current(array_keys($category2)); |
|
59
|
|
|
$this->tester->waitForElement(['xpath' => "//ul[@class='ec-shelfGrid']/li[@class='ec-shelfGrid__item'][${index}]//select[@name='classcategory_id2']/option[@value='${category2_id}']"]); |
|
60
|
|
|
$this->tester->selectOption(['css' => "ul.ec-shelfGrid li.ec-shelfGrid__item:nth-child(${index}) form select[name='classcategory_id2']"], $category2); |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
$this->tester->click(['class' => 'add-cart']); |
|
64
|
|
|
$this->tester->waitForElementVisible(['css' => 'div.ec-modal-box']); |
|
65
|
|
|
|
|
66
|
|
|
return $this; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function カートへ進む() |
|
70
|
|
|
{ |
|
71
|
|
|
$this->tester->click('div.ec-modal-box > div > a'); |
|
72
|
|
|
|
|
73
|
|
|
return CartPage::at($this->tester); |
|
74
|
|
|
} |
|
75
|
|
|
} |
|
76
|
|
|
|