Failed Conditions
Pull Request — experimental/sf (#31)
by Kentaro
06:59
created

_support/Page/Admin/ShippingEditPage.php (2 issues)

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
namespace Page\Admin;
5
6
7
class ShippingEditPage extends AbstractAdminPageStyleGuide
8
{
9
10
    public static $姓_エラーメッセージ = '#shipmentOverview_0 > div > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div > div > div:nth-child(1) > span > span > span.form-error-message';
11
12
    public static $登録完了メッセージ = '#page_admin_shipping_edit > div > div.c-contentsArea > div.alert.alert-success.alert-dismissible.fade.show.m-3 > span';
13
14
    /**
15
     * ShippingRegisterPage constructor.
16
     */
17
    public function __construct(\AcceptanceTester $I)
18
    {
19
        parent::__construct($I);
20
    }
21
22
    public static function go($I)
23
    {
24
        $page = new self($I);
25
        $page->goPage('/shipping/new', '出荷登録受注管理');
26
        return $page;
27
    }
28
29
    /**
30
     * @param \AcceptanceTester $I
31
     */
32
    public static function at($I)
33
    {
34
        $page = new self($I);
35
        $page->atPage('出荷登録受注管理');
36
        return $page;
37
    }
38
39
    public function 入力_出荷日($value)
40
    {
41
        $this->tester->executeJS("document.getElementById('shipping_shipping_date').value = '{$value}'");
42
        return $this;
43
    }
44
45
    public function お届け先編集()
46
    {
47
        $this->tester->click(['id' => 'edit-shipping-addr']);
48
        $this->tester->waitForElementVisible(['id' => 'shipping_name_name01']);
49
        return $this;
50
    }
51
52
    /**
53
     * @param string $value
54
     */
55
    public function 入力_姓($value, $num = 0)
56
    {
57
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_name_name01'], $value);
58
        return $this;
59
    }
60
61
    /**
62
     * @param string $value
63
     */
64
    public function 入力_名($value, $num = 0)
65
    {
66
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_name_name02'], $value);
67
        return $this;
68
    }
69
70
    /**
71
     * @param string $value
72
     */
73
    public function 入力_セイ($value, $num = 0)
74
    {
75
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_kana_kana01'], $value);
76
        return $this;
77
    }
78
79
    /**
80
     * @param string $value
81
     */
82
    public function 入力_メイ($value, $num = 0)
83
    {
84
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_kana_kana02'], $value);
85
        return $this;
86
    }
87
88
    /**
89
     * @param string $value
90
     */
91
    public function 入力_郵便番号($value, $num = 0)
92
    {
93
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_postal_code'], $value);
94
95
        return $this;
96
    }
97
98
    public function 入力_都道府県($value, $num = 0)
99
    {
100
        $this->tester->selectOption(['id' => 'form_shippings_'.$num.'_address_pref'], $value);
101
        return $this;
102
    }
103
104
    /**
105
     * @param string $value
106
     */
107
    public function 入力_市区町村名($value, $num = 0)
108
    {
109
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_address_addr01'], $value);
110
        return $this;
111
    }
112
113
    /**
114
     * @param string $value
115
     */
116
    public function 入力_番地_ビル名($value, $num = 0)
117
    {
118
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_address_addr02'], $value);
119
        return $this;
120
    }
121
122
    /**
123
     * @param string $value
124
     */
125
    public function 入力_電話番号($value, $num = 0)
126
    {
127
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_phone_number'], $value);
128
129
        return $this;
130
    }
131
132
    public function 入力_出荷伝票番号($value, $num = 0)
133
    {
134
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_tracking_number'], $value);
135
        return $this;
136
    }
137
138
    public function 入力_配送業者($value, $num = 0)
139
    {
140
        $this->tester->selectOption(['id' => 'form_shippings_'.$num.'_Delivery'], $value);
141
        return $this;
142
    }
143
144
    public function 入力_配達用メモ($value, $num = 0)
145
    {
146
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_note'], $value);
147
        return $this;
148
    }
149
150 View Code Duplication
    public function 商品検索($value = '')
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...
151
    {
152
        $this->tester->scrollTo(['css' => '#shipping-product_1 > div > button'], 0, -50);
153
        $this->tester->click(['css' => '#shipping-product_1 > div > button']);
154
        $this->tester->waitForElementVisible(['id' => 'addProduct']);
155
        $this->tester->fillField(['id' => 'admin_search_product_id'], $value);
156
        $this->tester->click('#searchProductModalButton');
157
        $this->tester->waitForElementVisible('#searchProductModalList table');
158
        return $this;
159
    }
160
161
    public function 商品検索結果_選択($rowNum)
162
    {
163
        $rowNum = $rowNum * 2;
164
        $this->tester->click("#searchProductModalList > table > tbody > tr:nth-child(${rowNum}) > td.align-middle.pr-3.text-right > button");
165
        return $this;
166
    }
167
168
    public function 出荷情報登録()
169
    {
170
        $this->tester->click(['id' => 'btn_save']);
171
        return $this;
172
    }
173
174
    public function 出荷完了にする($num = 0)
175
    {
176
        $this->tester->scrollTo(['id' => 'shipmentOverview_'.$num], 0, 50);
177
        $this->tester->click('#shipmentOverview_'.$num.' > div > div:nth-child(4) > div:nth-child(2) > div:nth-child(3) > div > button');
178
        return $this;
179
    }
180
181 View Code Duplication
    public function 変更を確定()
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...
182
    {
183
        $this->tester->waitForElementVisible(['id' => 'bulkChange']);
184
        $this->tester->click(['id' => 'bulkChange']);
185
        $this->tester->waitForElementVisible(['id' => 'bulkChangeComplete']);
186
        $this->tester->click(['id' => 'bulkChangeComplete']);
187
        return $this;
188
    }
189
190
    public function 出荷先を追加()
191
    {
192
        $this->tester->scrollTo(['id' => 'addShipping'], 0, 50);
193
        $this->tester->click(['id' => 'addShipping']);
194
        return $this;
195
    }
196
197
    public function 出荷日を確認($num = 0)
198
    {
199
        $this->tester->scrollTo(['id' => 'shipmentOverview_'.$num], 0, 50);
200
        $this->tester->see((new \DateTime())->format('Y/m/d'),
201
                            '#shipmentOverview_'.$num.' > div > div:nth-child(4) > div:nth-child(2) > div:nth-child(3) > div > span');
202
    }
203
}
204