Failed Conditions
Pull Request — 4.0 (#3831)
by Ryo
31:54 queued 17:09
created

LayoutEditPage::選択_プレビューページ()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
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\Admin;
15
16
class LayoutEditPage extends AbstractAdminPageStyleGuide
17
{
18
    public static $未使用ブロックアイテム = ['css' => '#unused-block div.sort'];
19
    public static $登録完了メッセージ = ['xpath' => "//div[@class='alert alert-success alert-dismissible fade show m-3']"];
20
21
    /**
22
     * LayoutEditPage constructor.
23
     */
24
    public function __construct(\AcceptanceTester $I)
25
    {
26
        parent::__construct($I);
27
    }
28
29
    public static function at($I)
30
    {
31
        $page = new self($I);
32
        return $page->atPage('レイアウト管理コンテンツ管理');
33
    }
34
35
    public function 登録()
36
    {
37
        $this->tester->waitForElementVisible('#form1 > div > div.c-conversionArea > div > div > div:nth-child(2) > div > div > button');
38
        $this->tester->click('#form1 > div > div.c-conversionArea > div > div > div:nth-child(2) > div > div > button');
39
        return $this;
40
    }
41
42
    public function ブロックを移動($blockName, $dest, $timeout = 10)
43
    {
44
        $this->tester->waitForElementVisible(['xpath' => "//div[contains(@id, 'detail_box__layout_item')][div[div[1][span[text()='${blockName}']]]]"], $timeout);
45
        $this->tester->dragAndDrop(['xpath' => "//div[contains(@id, 'detail_box__layout_item')][div[div[1][span[text()='${blockName}']]]]"], $dest);
46
        return $this;
47
    }
48
49
    public function コンテキストメニューを開く($blockName)
50
    {
51
        $this->tester->click(['xpath' => "//div[contains(@id, 'detail_box__layout_item')][div[div[1][span[text()='${blockName}']]]]/div/div[2]"]);
52
        return $this;
53
    }
54
55 View Code Duplication
    public function コンテキストメニューで上に移動($blockName)
0 ignored issues
show
Duplication introduced by
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...
56
    {
57
        $this->コンテキストメニューを開く($blockName);
58
        $this->tester->waitForElementVisible(['xpath' => "//div[contains(@id, 'popover')]/div[2]/div/a[1]"]);
59
        $this->tester->click(['xpath' => "//div[contains(@id, 'popover')]/div[2]/div/a[1]"]);
60
        return $this;
61
    }
62
63 View Code Duplication
    public function コンテキストメニューで下に移動($blockName)
0 ignored issues
show
Duplication introduced by
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...
64
    {
65
        $this->コンテキストメニューを開く($blockName);
66
        $this->tester->waitForElementVisible(['xpath' => "//div[contains(@id, 'popover')]/div[2]/div/a[2]"]);
67
        $this->tester->click(['xpath' => "//div[contains(@id, 'popover')]/div[2]/div/a[2]"]);
68
        return $this;
69
    }
70
71
    public function コンテキストメニューでセクションに移動($blockName)
72
    {
73
        $this->コンテキストメニューを開く($blockName);
74
        $this->tester->waitForElementVisible(['xpath' => "//div[contains(@id, 'popover')]/div[2]/div/a[3]"]);
75
        $this->tester->wait(1);
76
        $this->tester->click(['xpath' => "//div[contains(@id, 'popover')]/div[2]/div/a[3]"]);
77
        $this->tester->waitForElementVisible(['id' => "move-to-section"]);
78
        $this->tester->wait(1);
79
        $this->tester->click(['id' => "move-to-section"]);
80
        $this->tester->waitForElementNotVisible(['id' => "move-to-section"]);
81
        $this->tester->wait(1);
82
        return $this;
83
    }
84
85
    public function コンテキストメニューでコードプレビュー($blockName, $element = null, $timeout = 10)
86
    {
87
        $this->コンテキストメニューを開く($blockName);
88
        $this->tester->scrollTo(['xpath' => "//div[contains(@id, 'popover')]/div[2]/div/a[4]"], 0, 0);
89
        $this->tester->wait(1);
90
        $this->tester->click(['xpath' => "//div[contains(@id, 'popover')]/div[2]/div/a[4]"]);
91
        $this->tester->waitForElementVisible(['id' => "codePreview"]);
92
        if ($element) {
93
            $this->tester->waitForElementVisible($element, $timeout);
94
        }
95
        $this->tester->click(['xpath' => "//*[@id='codePreview']/div/div/div[3]/button[1]"]);
96
        return $this;
97
    }
98
99
    public function 選択_プレビューページ($value) {
100
        $this->tester->selectOption(['id' => 'admin_layout_Page'], $value);
101
        return $this;
102
    }
103
104
    public function プレビュー()
105
    {
106
        $this->tester->click("#preview-button");
107
        return $this;
108
    }
109
110
    public function 検索ブロック名($value)
111
    {
112
        $this->tester->fillField(['css' => '#unused-block div.first input'], $value);
113
        return $this;
114
    }
115
}
116