Completed
Push — 4.0 ( 103006...239d44 )
by Ryo
05:55
created

PluginManagePage::ストアプラグイン_削除()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 10
rs 9.9332
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 PluginManagePage extends AbstractAdminPageStyleGuide
17
{
18
    const 完了メーッセージ = '#page_admin_store_plugin > div.c-container > div.c-contentsArea > div.alert.alert-success.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
     * @return PluginManagePage
36
     */
37
    public function ストアプラグイン_有効化($pluginCode)
38
    {
39
        return $this->ストアプラグイン_ボタンクリック($pluginCode, '有効化');
40
    }
41
42
    /**
43
     * @param $pluginCode
44
     *
45
     * @return PluginManagePage
46
     */
47
    public function ストアプラグイン_無効化($pluginCode)
48
    {
49
        return $this->ストアプラグイン_ボタンクリック($pluginCode, '無効化');
50
    }
51
52
    /**
53
     * @param $pluginCode
54
     *
55
     * @return PluginManagePage
56
     *
57
     * @throws \Exception
58
     */
59
    public function ストアプラグイン_削除($pluginCode)
60
    {
61
        $this->ストアプラグイン_ボタンクリック($pluginCode, '削除');
62
        $this->tester->waitForElementVisible(['id' => 'officialPluginDeleteButton']);
63
        $this->tester->click(['id' => 'officialPluginDeleteButton']);
64
        $this->tester->waitForElementVisible(['css' => '#officialPluginDeleteModal > div > div > div.modal-footer > button:nth-child(3)'], 30);
65
        $this->tester->click(['css' => '#officialPluginDeleteModal > div > div > div.modal-footer > button:nth-child(3)']);
66
67
        return $this;
68
    }
69
70 View Code Duplication
    private function ストアプラグイン_ボタンクリック($pluginCode, $label)
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...
71
    {
72
        $xpath = ['xpath' => '//*[@id="page_admin_store_plugin"]//div/h5[contains(text(), "オーナーズストアのプラグイン")]/../..//table/tbody//td[3]/p[contains(text(), "'.$pluginCode.'")]/../../td[6]//i[@data-original-title="'.$label.'"]/parent::node()'];
73
        $this->tester->click($xpath);
74
75
        return $this;
76
    }
77
78
    public function 独自プラグイン_有効化($pluginCode)
79
    {
80
        return $this->独自プラグイン_ボタンクリック($pluginCode, '有効化');
81
    }
82
83
    public function 独自プラグイン_無効化($pluginCode)
84
    {
85
        return $this->独自プラグイン_ボタンクリック($pluginCode, '無効化');
86
    }
87
88
    public function 独自プラグイン_削除($pluginCode)
89
    {
90
        $this->独自プラグイン_ボタンクリック($pluginCode, '削除');
91
        $this->tester->waitForElementVisible(['css' => '#localPluginDeleteModal .modal-footer a']);
92
        $this->tester->click(['css' => '#localPluginDeleteModal .modal-footer a']);
93
94
        return $this;
95
    }
96
97 View Code Duplication
    private function 独自プラグイン_ボタンクリック($pluginCode, $label)
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...
98
    {
99
        $xpath = ['xpath' => '//*[@id="page_admin_store_plugin"]//div/h5[contains(text(), "ユーザー独自プラグイン")]/../..//table/tbody//td[3][contains(text(), "'.$pluginCode.'")]/../td[6]//i[@data-original-title="'.$label.'"]/parent::node()'];
100
        $this->tester->click($xpath);
101
102
        return $this;
103
    }
104
}
105