Failed Conditions
Push — modify-scrutinizeryml ( 361e25...08b4c1 )
by Kentaro
63:54 queued 57:30
created

CategoryManagePage   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 97
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 97
rs 10
c 0
b 0
f 0
wmc 15
lcom 0
cbo 2

15 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A go() 0 5 1
A 入力_カテゴリ名() 0 5 1
A カテゴリ作成() 0 5 1
A 一覧_選択() 0 5 1
A 一覧_編集() 0 5 1
A 一覧_インライン編集_カテゴリ名() 0 5 1
A 一覧_インライン編集_決定() 0 5 1
A 一覧_削除() 0 5 1
A CSVダウンロード実行() 0 5 1
A CSV出力項目設定() 0 4 1
A 一覧_上に() 0 5 1
A 一覧_下に() 0 5 1
A 一覧_名称() 0 4 1
A XPathでタグを取得する() 0 3 1
1
<?php
2
3
namespace Page\Admin;
4
5
use Facebook\WebDriver\Interactions\WebDriverActions;
6
use Facebook\WebDriver\WebDriverBy;
7
8
class CategoryManagePage extends AbstractAdminPageStyleGuide
9
{
10
11
    public static $登録完了メッセージ = 'body > div > div.c-contentsArea > div.alert.alert-success.alert-dismissible.fade.show.m-3';
12
    public static $パンくず_1階層 = 'body > div > div.c-contentsArea > div.c-outsideBlock > div > div > div:nth-child(1) > nav > ol > li:nth-child(2) > a';
13
    public static $パンくず_2階層 = 'body > div > div.c-contentsArea > div.c-outsideBlock > div > div > div:nth-child(1) > nav > ol > li.nth-child(3) > a';
14
    public static $パンくず_3階層 = 'body > div > div.c-contentsArea > div.c-outsideBlock > div > div > div:nth-child(1) > nav > ol > li:nth-child(4) > a';
15
    public static $パンくず_4階層 = 'body > div > div.c-contentsArea > div.c-outsideBlock > div > div > div:nth-child(1) > nav > ol > li:nth-child(5) > a';
16
17
    /**
18
     * CategoryPage constructor.
19
     */
20
    public function __construct(\AcceptanceTester $I)
21
    {
22
        parent::__construct($I);
23
    }
24
25
    public static function go($I)
26
    {
27
        $page = new self($I);
28
        return $page->goPage('/product/category', '商品管理カテゴリ編集');
29
    }
30
31
    public function 入力_カテゴリ名($value)
32
    {
33
        $this->tester->fillField(['id' => 'admin_category_name'], $value);
34
        return $this;
35
    }
36
37
    public function カテゴリ作成()
38
    {
39
        $this->tester->click('#form1 > div:nth-child(2) > div:nth-child(2) > button');
40
        return $this;
41
    }
42
43
    public function 一覧_選択($rowNum)
44
    {
45
        $this->tester->click("body > div.c-container > div.c-contentsArea > div.c-contentsArea__cols > div.c-contentsArea__primaryCol > div > div > div > div > ul > li:nth-child(${rowNum}) > div > div.col.d-flex.align-items-center > a");
46
        return $this;
47
    }
48
49
    public function 一覧_編集($rowNum)
50
    {
51
        $this->tester->click("body > div > div.c-contentsArea > div.c-contentsArea__cols > div.c-contentsArea__primaryCol > div > div > div > div > ul > li:nth-child(${rowNum}) > div > div.col-auto.text-right > a:nth-child(3)");
52
        return $this;
53
    }
54
55
    public function 一覧_インライン編集_カテゴリ名($rowNum, $value)
56
    {
57
        $this->tester->fillField('body > div > div.c-contentsArea > div.c-contentsArea__cols > div.c-contentsArea__primaryCol > div > div > div > div > ul > li:nth-child('.$rowNum.') > form.mode-edit input[type="text"][name*="category_"]', $value);
58
        return $this;
59
    }
60
61
    public function 一覧_インライン編集_決定($rowNum)
62
    {
63
        $this->tester->click('body > div > div.c-contentsArea > div.c-contentsArea__cols > div.c-contentsArea__primaryCol > div > div > div > div > ul > li:nth-child('.$rowNum.') > form.mode-edit button[type="submit"]');
64
        return $this;
65
    }
66
67
    public function 一覧_削除($rowNum)
68
    {
69
        $this->tester->click("body > div > div.c-contentsArea > div.c-contentsArea__cols > div.c-contentsArea__primaryCol > div > div > div > div > ul > li:nth-child(${rowNum}) > div > div.col-auto.text-right > a:nth-child(4)");
70
        return $this;
71
    }
72
73
    public function CSVダウンロード実行()
74
    {
75
        $this->tester->click('body > div > div.c-contentsArea > div.c-outsideBlock > div > div > div.col-6.text-right > div > button:nth-child(1)');
76
        return $this;
77
    }
78
79
    public function CSV出力項目設定()
80
    {
81
        $this->tester->click('body > div > div.c-contentsArea > div.c-outsideBlock > div > div > div.col-6.text-right > div > button:nth-child(2)');
82
    }
83
84
    public function 一覧_上に($rowNum)
85
    {
86
        $this->tester->dragAndDropBy("body > div > div.c-contentsArea > div.c-contentsArea__cols > div.c-contentsArea__primaryCol > div > div > div > div > ul > li:nth-child($rowNum)", 0, -75);
87
        return $this;
88
    }
89
90
    public function 一覧_下に($rowNum)
91
    {
92
        $this->tester->dragAndDropBy("body > div > div.c-contentsArea > div.c-contentsArea__cols > div.c-contentsArea__primaryCol > div > div > div > div > ul > li:nth-child($rowNum)", 0, 75);
93
        return $this;
94
    }
95
96
    public function 一覧_名称($rowNum)
97
    {
98
        return "body > div > div.c-contentsArea > div.c-contentsArea__cols > div.c-contentsArea__primaryCol > div > div > div > div > ul > li:nth-child($rowNum) > div > div.col.d-flex.align-items-center > a";
99
    }
100
101
    public static function XPathでタグを取得する($textEl) {
102
        return '//*[@id="page_admin_product_category"]/div[1]/div[3]/div[3]/div[1]/div/div/div/div/ul/li/div/div[2]/a[contains(text(), "'.$textEl.'")]';
103
    }
104
}