Completed
Push — apply-codeceptions ( 341052...a29855 )
by Kentaro
53:23 queued 21:51
created

ShippingEditPage::__construct()   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
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
    public static function at($I)
30
    {
31
        $page = new self($I);
32
        $page->atPage('出荷登録受注管理');
33
        return $page;
34
    }
35
36
    public function 入力_出荷日($value)
37
    {
38
        $this->tester->executeJS("document.getElementById('shipping_shipping_date').value = '{$value}'");
39
        return $this;
40
    }
41
42
    public function お届け先編集()
43
    {
44
        $this->tester->click(['id' => 'edit-shipping-addr']);
45
        $this->tester->waitForElementVisible(['id' => 'shipping_name_name01']);
46
        return $this;
47
    }
48
49
    public function 入力_姓($value, $num = 0)
50
    {
51
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_name_name01'], $value);
52
        return $this;
53
    }
54
55
    public function 入力_名($value, $num = 0)
56
    {
57
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_name_name02'], $value);
58
        return $this;
59
    }
60
61
    public function 入力_セイ($value, $num = 0)
62
    {
63
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_kana_kana01'], $value);
64
        return $this;
65
    }
66
67
    public function 入力_メイ($value, $num = 0)
68
    {
69
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_kana_kana02'], $value);
70
        return $this;
71
    }
72
73
    public function 入力_郵便番号($value, $num = 0)
74
    {
75
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_postal_code'], $value);
76
77
        return $this;
78
    }
79
80
    public function 入力_都道府県($value, $num = 0)
81
    {
82
        $this->tester->selectOption(['id' => 'form_shippings_'.$num.'_address_pref'], $value);
83
        return $this;
84
    }
85
86
    public function 入力_市区町村名($value, $num = 0)
87
    {
88
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_address_addr01'], $value);
89
        return $this;
90
    }
91
92
    public function 入力_番地_ビル名($value, $num = 0)
93
    {
94
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_address_addr02'], $value);
95
        return $this;
96
    }
97
98
    public function 入力_電話番号($value, $num = 0)
99
    {
100
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_phone_number'], $value);
101
102
        return $this;
103
    }
104
105
    public function 入力_出荷伝票番号($value, $num = 0)
106
    {
107
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_tracking_number'], $value);
108
        return $this;
109
    }
110
111
    public function 入力_配送業者($value, $num = 0)
112
    {
113
        $this->tester->selectOption(['id' => 'form_shippings_'.$num.'_Delivery'], $value);
114
        return $this;
115
    }
116
117
    public function 入力_配達用メモ($value, $num = 0)
118
    {
119
        $this->tester->fillField(['id' => 'form_shippings_'.$num.'_note'], $value);
120
        return $this;
121
    }
122
123 View Code Duplication
    public function 商品検索($value = '')
0 ignored issues
show
Unused Code introduced by
The parameter $value is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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...
124
    {
125
        $this->tester->click(['xpath' => '//*[@id="shipmentItem"]/div/div/div/button']);
126
        $this->tester->waitForElementVisible(['id' => 'addProduct']);
127
        $this->tester->click(['id' => 'searchItemsButton']);
128
        return $this;
129
    }
130
131 View Code Duplication
    public function 商品検索結果_選択($rowNum)
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...
132
    {
133
        $this->tester->click(['xpath' => "//*[@id='searchItemsResult']/table/tbody/tr[${rowNum}]/td[5]/i"]);
134
        $this->tester->click(['xpath' => '//*[@id="addProduct"]/div/div/div[1]/button']);
135
        $this->tester->wait(1);
136
        return $this;
137
    }
138
139
    public function 出荷情報登録()
140
    {
141
        $this->tester->click(['id' => 'btn_save']);
142
        return $this;
143
    }
144
145
    public function 出荷完了にする($num = 0)
146
    {
147
        $this->tester->scrollTo(['id' => 'shipmentOverview_'.$num], 0, 50);
148
        $this->tester->click('#shipmentOverview_'.$num.' > div > div:nth-child(4) > div:nth-child(2) > div:nth-child(3) > div > button');
149
        return $this;
150
    }
151
152 View Code Duplication
    public function 変更を確定()
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...
153
    {
154
        $this->tester->waitForElementVisible(['id' => 'bulkChange']);
155
        $this->tester->click(['id' => 'bulkChange']);
156
        $this->tester->waitForElementVisible(['id' => 'bulkChangeComplete']);
157
        $this->tester->click(['id' => 'bulkChangeComplete']);
158
        return $this;
159
    }
160
161
    public function 出荷先を追加()
162
    {
163
        $this->tester->scrollTo(['id' => 'addShipping'], 0, 50);
164
        $this->tester->click(['id' => 'addShipping']);
165
        return $this;
166
    }
167
168
    public function 出荷日を確認($num = 0)
169
    {
170
        $this->tester->scrollTo(['id' => 'shipmentOverview_'.$num], 0, 50);
171
        $this->tester->see((new \DateTime())->format('Y/m/d'),
172
                           '#shipmentOverview_'.$num.' > div > div:nth-child(4) > div:nth-child(2) > div:nth-child(3) > div > span');
173
    }
174
}
175