Failed Conditions
Push — 4.0 ( 669dcd...af34e4 )
by
unknown
06:18
created

_support/Page/Admin/PluginManagePage.php (1 issue)

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
/*
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 PluginManagePage extends AbstractAdminPageStyleGuide
17
{
18
    const 完了メーッセージ = '#page_admin_store_plugin > div.c-container > div.c-contentsArea > div.alert.alert-dismissible.fade.show.m-3 > span';
19
20
    public function __construct(\AcceptanceTester $I)
21
    {
22
        parent::__construct($I);
23
    }
24
25
    public static function at($I)
26
    {
27
        $page = new self($I);
28
29
        return $page->atPage('インストールプラグイン一覧オーナーズストア');
30
    }
31
32
    /**
33
     * @param $pluginCode
34
     *
35
     * @param string $message
36
     * @return PluginManagePage
37
     */
38
    public function ストアプラグイン_有効化($pluginCode, $message = '有効にしました。')
39
    {
40
        $this->ストアプラグイン_ボタンクリック($pluginCode, '有効化');
41
        $this->tester->see($message, self::完了メーッセージ);
42
        return $this;
43
    }
44
45
    /**
46
     * @param $pluginCode
47
     *
48
     * @param string $message
49
     * @return PluginManagePage
50
     */
51
    public function ストアプラグイン_無効化($pluginCode, $message = '無効にしました。')
52
    {
53
        $this->ストアプラグイン_ボタンクリック($pluginCode, '無効化');
54
        $this->tester->see($message, self::完了メーッセージ);
55
        return $this;
56
    }
57
58
    /**
59
     * @param $pluginCode
60
     * @param string $message
61
     *
62
     * @return PluginManagePage
63
     *
64
     * @throws \Exception
65
     */
66 View Code Duplication
    public function ストアプラグイン_削除($pluginCode, $message = '削除が完了しました。')
0 ignored issues
show
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...
67
    {
68
        $this->ストアプラグイン_ボタンクリック($pluginCode, '削除');
69
        $this->tester->waitForElementVisible(['id' => 'officialPluginDeleteButton']);
70
        $this->tester->click(['id' => 'officialPluginDeleteButton']);
71
        $this->tester->waitForElementVisible(['css' => '#officialPluginDeleteModal > div > div > div.modal-footer > button:nth-child(3)'], 30);
72
        $this->tester->see($message, ['css' => '#officialPluginDeleteModal > div > div > div.modal-body.text-left > p']);
73
        $this->tester->click(['css' => '#officialPluginDeleteModal > div > div > div.modal-footer > button:nth-child(3)']);
74
75
        return $this;
76
    }
77
78
    /**
79
     * @param $pluginCode
80
     * @return PluginStoreUpgradePage
81
     */
82
    public function ストアプラグイン_アップデート($pluginCode)
83
    {
84
        echo $this->tester->grabTextFrom(['xpath' => '//*[@id="page_admin_store_plugin"]']);
85
        $this->tester->click(['xpath' => $this->ストアプラグイン_セレクタ($pluginCode).'/../../td[5]/a']);
86
        return PluginStoreUpgradePage::at($this->tester);
87
    }
88
89 View Code Duplication
    private function ストアプラグイン_ボタンクリック($pluginCode, $label)
90
    {
91
        $xpath = ['xpath' => $this->ストアプラグイン_セレクタ($pluginCode).'/../../td[6]//i[@data-original-title="'.$label.'"]/parent::node()'];
92
        $this->tester->click($xpath);
93
94
        return $this;
95
    }
96
97
    public function ストアプラグイン_セレクタ($pluginCode)
98
    {
99
        return '//*[@id="page_admin_store_plugin"]//div/h5[contains(text(), "オーナーズストアのプラグイン")]/../..//table/tbody//td[3]/p[contains(text(), "'.$pluginCode.'")]';
100
    }
101
102
    public function 独自プラグイン_有効化($pluginCode)
103
    {
104
        $this->独自プラグイン_ボタンクリック($pluginCode, '有効化');
105
        $this->tester->see('有効にしました。', self::完了メーッセージ);
106
        return $this;
107
    }
108
109
    public function 独自プラグイン_無効化($pluginCode)
110
    {
111
        $this->独自プラグイン_ボタンクリック($pluginCode, '無効化');
112
        $this->tester->see('無効にしました。', self::完了メーッセージ);
113
        return $this;
114
    }
115
116
    public function 独自プラグイン_削除($pluginCode)
117
    {
118
        $this->独自プラグイン_ボタンクリック($pluginCode, '削除');
119
        $this->tester->waitForElementVisible(['css' => '#localPluginDeleteModal .modal-footer a']);
120
        $this->tester->click(['css' => '#localPluginDeleteModal .modal-footer a']);
121
122
        return $this;
123
    }
124
125
    public function 独自プラグイン_アップデート($pluginCode, $fileName)
126
    {
127
        $this->tester->attachFile(['xpath' => $this->独自プラグイン_セレクタ($pluginCode).'/../td[5]//input[@type="file"]'], $fileName);
128
        $this->tester->click(['xpath' => $this->独自プラグイン_セレクタ($pluginCode).'/../td[5]//button']);
129
        $this->tester->see('アップデートしました。', self::完了メーッセージ);
130
        return $this;
131
    }
132
133 View Code Duplication
    private function 独自プラグイン_ボタンクリック($pluginCode, $label)
134
    {
135
        $xpath = ['xpath' => $this->独自プラグイン_セレクタ($pluginCode).'/../td[6]//i[@data-original-title="'.$label.'"]/parent::node()'];
136
        $this->tester->click($xpath);
137
138
        return $this;
139
    }
140
141
    private function 独自プラグイン_セレクタ($pluginCode)
142
    {
143
        return '//*[@id="page_admin_store_plugin"]//div/h5[contains(text(), "ユーザー独自プラグイン")]/../..//table/tbody//td[3][contains(text(), "'.$pluginCode.'")]/';
144
    }
145
}
146