Completed
Pull Request — 4.0 (#3601)
by Kiyotaka
09:33 queued 03:09
created

ProductListPage::at()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
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 カートに入れる($productId)
53
    {
54
        $this->tester->click(['css' => "button[data-cartid='${productId}']"]);
55
        $this->tester->waitForElementVisible(['css' => 'div.ec-modal-box']);
56
57
        return $this;
58
    }
59
60
    public function カートへ進む()
61
    {
62
        $this->tester->click('div.ec-modal-box > div > a');
63
64
        return CartPage::at($this->tester);
65
    }
66
}
67