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

EA08SysteminfoCest::systeminfo_権限管理追加()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
1
<?php
2
3
use Codeception\Util\Fixtures;
4
use Page\Admin\AuthorityManagePage;
5
6
/**
7
 * @group admin
8
 * @group admin03
9
 * @group systeminformation
10
 * @group ea8
11
 */
12
class EA08SysteminfoCest
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
13
{
14
    public function _before(\AcceptanceTester $I)
15
    {
16
        $I->loginAsAdmin();
17
    }
18
19
    public function _after(\AcceptanceTester $I)
0 ignored issues
show
Unused Code introduced by
The parameter $I 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...
20
    {
21
    }
22
23
    public function systeminfo_システム情報(\AcceptanceTester $I)
24
    {
25
        $I->wantTo('EA0801-UC01-T01 システム情報');
26
27
        // 表示
28
        $config = Fixtures::get('config');
29
        $I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/system');
30
        $I->see('システム情報システム設定', '.c-pageTitle__titles');
31
32
        $I->see('システム情報', '#server_info_box__header .card-title');
33
        $I->see('PHP情報', '#php_info_box__header .card-title');
34
    }
35
36
    public function systeminfo_メンバー管理表示(\AcceptanceTester $I)
37
    {
38
        $I->wantTo('EA0802-UC01-T01 メンバー管理 - 表示');
39
40
        // 表示
41
        $config = Fixtures::get('config');
42
        $I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/member');
43
        $I->see('システム設定メンバー管理', '.c-pageTitle');
44
45
        $I->see('メンバー管理', '.c-contentsArea__primaryCol .card-header .card-title');
46
        $I->see('新規登録', '.c-contentsArea__primaryCol .btn-area-bottom .btn-ec-regular');
47
    }
48
49 View Code Duplication
    public function systeminfo_メンバー管理登録実施(\AcceptanceTester $I)
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...
50
    {
51
        $I->wantTo('EA0803-UC01-T01 メンバー管理 - 登録 - 登録実施');
52
53
        // 表示
54
        $config = Fixtures::get('config');
55
        $I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/member');
56
        $I->see('システム設定メンバー管理', '.c-pageTitle');
57
58
        $I->click('.c-contentsArea__primaryCol .card .btn-area-bottom .btn');
59
        $I->see('メンバー登録・編集', '#member_form .c-contentsArea__primaryCol .card-header .card-title');
60
61
        $I->fillField(['id' => 'admin_member_name'], 'admintest');
62
        $I->fillField(['id' => 'admin_member_department'], 'admintest department');
63
        $I->fillField(['id' => 'admin_member_login_id'], 'admintest');
64
        $I->fillField(['id' => 'admin_member_password_first'], 'password');
65
        $I->fillField(['id' => 'admin_member_password_second'], 'password');
66
        $I->selectOption(['id' => 'admin_member_Authority'], 'システム管理者');
67
        $I->selectOption(['id' => 'admin_member_Work_1'], '稼働');
68
        $I->click('#member_form .c-conversionArea__container button');
69
        $I->see('メンバーを保存しました。', '.c-contentsArea .alert-success');
70
71
        $I->see('メンバー管理', '.c-contentsArea__primaryCol .card-header .card-title');
72
        $I->see('admintest', '#search_result tbody tr:nth-child(1) td:nth-child(1)');
73
    }
74
75 View Code Duplication
    public function systeminfo_メンバー管理登録未実施(\AcceptanceTester $I)
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...
76
    {
77
        $I->wantTo('EA0803-UC01-T02 メンバー管理 - 登録 - 登録未実施');
78
79
        // 表示
80
        $config = Fixtures::get('config');
81
        $I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/member');
82
        $I->see('システム設定メンバー管理', '.c-pageTitle');
83
84
        $I->click('.c-contentsArea__primaryCol .card .btn-area-bottom .btn');
85
        $I->see('メンバー登録・編集', '#member_form .c-contentsArea__primaryCol .card-header .card-title');
86
87
        $I->fillField(['id' => 'admin_member_name'], 'admintest2');
88
        $I->fillField(['id' => 'admin_member_department'], 'admintest department');
89
        $I->fillField(['id' => 'admin_member_login_id'], 'admintest');
90
        $I->fillField(['id' => 'admin_member_password_first'], 'password');
91
        $I->fillField(['id' => 'admin_member_password_second'], 'password');
92
        $I->selectOption(['id' => 'admin_member_Authority'], 'システム管理者');
93
        $I->selectOption(['id' => 'admin_member_Work_1'], '稼働');
94
        $I->click('#member_form .c-conversionArea__container .c-conversionArea__leftBlockItem a');
95
96
        $I->see('メンバー管理', '.c-contentsArea__primaryCol .card-header .card-title');
97
        $I->dontSee('admintest2', '#search_result tbody tr:nth-child(1) td:nth-child(1)');
98
    }
99
100 View Code Duplication
    public function systeminfo_メンバー管理登録異常(\AcceptanceTester $I)
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...
101
    {
102
        $I->wantTo('EA0803-UC01-T03 メンバー管理 - 登録 - 異常パターン');
103
104
        // 表示
105
        $config = Fixtures::get('config');
106
        $I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/member');
107
        $I->see('システム設定メンバー管理', '.c-pageTitle');
108
109
        $I->click('.c-contentsArea__primaryCol .card .btn-area-bottom .btn');
110
        $I->see('メンバー登録・編集', '#member_form .c-contentsArea__primaryCol .card-header .card-title');
111
112
        $I->click('#member_form .c-conversionArea__container button');
113
        $I->see('入力されていません。', '#member_form div:nth-child(1) div');
114
    }
115
116
    public function systeminfo_メンバー管理編集実施(\AcceptanceTester $I)
117
    {
118
        $I->wantTo('EA0803-UC02-T01 メンバー管理 - 編集 - 編集実施');
119
120
        // 表示
121
        $config = Fixtures::get('config');
122
        $I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/member');
123
        $I->see('システム設定メンバー管理', '.c-pageTitle');
124
125
        $I->click('#search_result tbody tr:nth-child(1) .action-edit');
126
        $I->see('メンバー登録・編集', '#member_form .c-contentsArea__primaryCol .card-header .card-title');
127
128
        $I->fillField(['id' => 'admin_member_name'], 'administrator');
129
        $I->click('#member_form .c-conversionArea__container button');
130
131
        // FIXME 以下の不具合のためシステムエラーが発生する
132
        // https://github.com/EC-CUBE/eccube-api/pull/60
133
        $findPluginByCode = Fixtures::get('findPluginByCode');
134
        $Plugin = $findPluginByCode('EccubeApi');
135
        if ($Plugin) {
136
            $I->amGoingTo('EccubeApi プラグインを発見したため、不具合を回避しました。 詳細: https://github.com/EC-CUBE/eccube-api/pull/60');
137
        } else {
138
            $I->see('メンバーを保存しました。', '.c-contentsArea .alert-success');
139
            $I->see('メンバー管理', '.c-contentsArea__primaryCol .card-header .card-title');
140
            $I->see('administrator', '#search_result tbody tr:nth-child(1) td:nth-child(1)');
141
        }
142
    }
143
144 View Code Duplication
    public function systeminfo_メンバー管理編集未実施(\AcceptanceTester $I)
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...
145
    {
146
        $I->wantTo('EA0803-UC02-T02 メンバー管理 - 編集 - 編集未実施');
147
148
        // 表示
149
        $config = Fixtures::get('config');
150
        $I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/member');
151
        $I->see('システム設定メンバー管理', '.c-pageTitle');
152
153
        $I->click('#search_result tbody tr:nth-child(1) .action-edit');
154
        $I->see('メンバー登録・編集', '#member_form .c-contentsArea__primaryCol .card-header .card-title');
155
156
        $I->fillField(['id' => 'admin_member_name'], 'administrator2');
157
        $I->click('#member_form .c-conversionArea__container .c-conversionArea__leftBlockItem a');
158
159
        $I->see('メンバー管理', '.c-contentsArea__primaryCol .card-header .card-title');
160
        $I->dontSee('administrator2', '#search_result tbody tr:nth-child(1) td:nth-child(1)');
161
    }
162
163 View Code Duplication
    public function systeminfo_メンバー管理編集異常(\AcceptanceTester $I)
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...
164
    {
165
        $I->wantTo('EA0803-UC03-T01 メンバー管理 - 編集 - 異常パターン');
166
167
        // 表示
168
        $config = Fixtures::get('config');
169
        $I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/member');
170
        $I->see('システム設定メンバー管理', '.c-pageTitle');
171
172
        $I->click('#search_result tbody tr:nth-child(1) .action-edit');
173
        $I->see('メンバー登録・編集', '#member_form .c-contentsArea__primaryCol .card-header .card-title');
174
175
        $I->fillField(['id' => 'admin_member_name'], '');
176
        $I->click('#member_form .c-conversionArea__container button');
177
178
        $I->see('入力されていません。', '#member_form div:nth-child(1) div');
179
    }
180
181 View Code Duplication
    public function systeminfo_メンバー管理登録下へ(\AcceptanceTester $I)
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...
182
    {
183
        $I->wantTo('EA0802-UC01-T02 メンバー管理 - 下へ');
184
185
        // 表示
186
        $config = Fixtures::get('config');
187
        $I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/member');
188
        $I->see('システム設定メンバー管理', '.c-pageTitle');
189
190
        $I->click('#search_result tbody tr:nth-child(1) .action-down');
191
192
        $I->waitForElementNotVisible(['css' => '.modal-backdrop']);
193
194
        $I->see('管理者', '#search_result tbody tr:nth-child(1) td:nth-child(1)');
195
    }
196
197 View Code Duplication
    public function systeminfo_メンバー管理登録上へ(\AcceptanceTester $I)
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...
198
    {
199
        $I->wantTo('EA0802-UC01-T03 メンバー管理 - 上へ');
200
201
        // 表示
202
        $config = Fixtures::get('config');
203
        $I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/member');
204
        $I->see('システム設定メンバー管理', '.c-pageTitle');
205
206
        $I->click('#search_result tbody tr:nth-child(2) .action-up');
207
208
        $I->waitForElementNotVisible(['css' => '.modal-backdrop']);
209
210
        $I->see('管理者', '#search_result tbody tr:nth-child(2) td:nth-child(1)');
211
    }
212
213 View Code Duplication
    public function systeminfo_メンバー管理削除(\AcceptanceTester $I)
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...
214
    {
215
        $I->wantTo('EA0802-UC01-T06 メンバー管理 - 削除');
216
217
        // 表示
218
        $config = Fixtures::get('config');
219
        $I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/member');
220
        $I->see('システム設定メンバー管理', '.c-pageTitle');
221
222
        $I->click('#search_result tbody tr:nth-child(1) .action-delete');
223
        $I->waitForElementVisible(['css' => '#search_result tbody tr:nth-child(1) .modal']);
224
        $I->click('#search_result tbody tr:nth-child(1) .modal .btn-ec-delete');
225
226
        $I->see('メンバーを削除しました。', '.c-contentsArea .alert-success');
227
        $I->see('管理者', '#search_result tbody tr:nth-child(1) td:nth-child(1)');
228
    }
229
230
    public function systeminfo_メンバー管理自ユーザー削除(\AcceptanceTester $I)
231
    {
232
        $I->wantTo('EA0802-UC01-T07 メンバー管理 - 自ユーザー削除');
233
234
        // 表示
235
        $config = Fixtures::get('config');
236
        $I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/member');
237
        $I->see('システム設定メンバー管理', '.c-pageTitle');
238
239
        $href = $I->grabAttributeFrom('#member_list__menu_box--1 .action-delete', 'href');
240
        $I->assertEquals('', $href, $href.' が一致しません');
241
    }
242
243
    public function systeminfo_セキュリティ管理表示(\AcceptanceTester $I)
244
    {
245
        $I->wantTo('EA0804-UC01-T01 セキュリティ管理 - 表示');
246
247
        // 表示
248
        $config = Fixtures::get('config');
249
        $I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/security');
250
        $I->see('セキュリティ管理システム設定', '#page_admin_setting_system_security .c-pageTitle__titles');
251
        $I->see('セキュリティ機能設定', '#page_admin_setting_system_security > div.c-container > div.c-contentsArea div.c-contentsArea__primaryCol > div.c-primaryCol > div:nth-child(1) > div.card-header > div > div.col-8 > div');
252
    }
253
254 View Code Duplication
    public function systeminfo_セキュリティ管理ディレクトリ名(\AcceptanceTester $I)
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...
255
    {
256
        $I->wantTo('EA0804-UC01-T02 セキュリティ管理 - ディレクトリ名変更');
257
258
        // 表示
259
        $config = Fixtures::get('config');
260
        $I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/security');
261
        $I->see('セキュリティ管理システム設定', '#page_admin_setting_system_security .c-pageTitle__titles');
262
263
        $I->fillField(['id' => 'admin_security_admin_route_dir'], 'admin2');
264
        $I->click('#page_admin_setting_system_security form div.c-contentsArea__cols > div.c-conversionArea > div > div > div:nth-child(2) > div > div > button');
265
        $I->loginAsAdmin('', '', 'admin2');
266
267
        $I->amOnPage('/admin2/setting/system/security');
268
        $I->fillField(['id' => 'admin_security_admin_route_dir'], $config['eccube_admin_route']);
269
        $I->click('#page_admin_setting_system_security form div.c-contentsArea__cols > div.c-conversionArea > div > div > div:nth-child(2) > div > div > button');
270
        $I->loginAsAdmin();
271
    }
272
273
    public function systeminfo_セキュリティ管理SSL(\AcceptanceTester $I)
274
    {
275
        $I->wantTo('EA0804-UC01-T04 セキュリティ管理 - SSL強制');
276
277
        $I->getScenario()->skip('このテストを通すと以降のテストが通らなくなってしまっているので一時的にスキップ');
278
279
        $httpBaseUrl = $I->getBaseUrl();
280
        $I->amOnUrl($httpBaseUrl);
281
        $I->assertRegExp('/^http:\/\//', $I->executeJS('return location.href'), 'httpsにリダイレクトされない');
282
283
        $config = Fixtures::get('config');
284
        $httpsBaseUrl = str_replace('http://', 'https://', $httpBaseUrl);
285
        $I->amOnUrl($httpsBaseUrl.$config['eccube_admin_route'].'/setting/system/security');
286
        $I->checkOption(['id' => 'admin_security_force_ssl']);
287
        $I->click('#page_admin_setting_system_security form div.c-contentsArea__cols > div.c-conversionArea > div > div > div:nth-child(2) > div > div > button');
288
289
        // httpでアクセスしたらhttpsにリダイレクトされる
290
        $I->amOnUrl($httpBaseUrl);
291
        $I->assertRegExp('/^https:\/\//', $I->executeJS('return location.href'), 'httpsにリダイレクトされる');
292
293
        // 後続テストのために戻しておく
294
        $I->amOnUrl($httpsBaseUrl.$config['eccube_admin_route'].'/setting/system/security');
295
        $I->uncheckOption(['id' => 'admin_security_force_ssl']);
296
        $I->click('#page_admin_setting_system_security form div.c-contentsArea__cols > div.c-conversionArea > div > div > div:nth-child(2) > div > div > button');
297
    }
298
299
    public function systeminfo_権限管理追加(\AcceptanceTester $I)
300
    {
301
        $I->wantTo('EA0805-UC01-T01 権限管理 - 追加');
302
303
        AuthorityManagePage::go($I)
304
            ->行追加()
305
            ->入力(1, ['0' => 'システム管理者'], '/content')
306
            ->入力(2, ['0' => 'システム管理者'], '/store')
307
            ->登録();
308
309
        $I->see('権限設定を保存しました。', AuthorityManagePage::$完了メッセージ);
310
        $I->dontSee('コンテンツ管理', 'nav .c-mainNavArea__nav');
311
        $I->dontSee('オーナーズストア', 'nav .c-mainNavArea__nav');
312
    }
313
314
    public function systeminfo_権限管理削除(\AcceptanceTester $I)
315
    {
316
        $I->wantTo('EA0805-UC02-T01 権限管理 - 削除');
317
318
        AuthorityManagePage::go($I)
319
            ->行削除(2)
320
            ->行削除(1)
321
            ->登録();
322
323
        $I->see('権限設定を保存しました。', AuthorityManagePage::$完了メッセージ);
324
        $I->see('コンテンツ管理', 'nav .c-mainNavArea__nav');
325
        $I->see('オーナーズストア', 'nav .c-mainNavArea__nav');
326
    }
327
328
    public function systeminfo_ログ表示(\AcceptanceTester $I)
329
    {
330
        $I->wantTo('EA0806-UC01-T01 ログ表示');
331
332
        // 表示
333
        $config = Fixtures::get('config');
334
        $I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/log');
335
        $I->see('ログ表示システム設定', '.c-pageTitle');
336
337
        $option = $I->grabTextFrom('#admin_system_log_files option:nth-child(1)');
338
        $I->selectOption("#admin_system_log_files", $option);
339
340
        $I->fillField(['id' => 'line-max'], '1');
341
        $I->click(['css' => '#form1 button']);
342
343
        $I->seeInField(['id' => 'line-max'], '1');
344
    }
345
346
    public function systeminfo_マスターデータ管理(\AcceptanceTester $I)
347
    {
348
        $I->wantTo('EA0807-UC01-T01 マスターデータ管理');
349
350
        // 表示
351
        $config = Fixtures::get('config');
352
        $I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/masterdata');
353
        $I->see('マスターデータ管理システム設定', '.c-pageTitle');
354
355
        $I->selectOption(['id' => 'admin_system_masterdata_masterdata'], ['Eccube-Entity-Master-Sex' => 'mtb_sex']);
356
        $I->click('#form1 button');
357
358
        $I->fillField(['css' => '#form2 table tbody tr:nth-child(3) td:nth-child(1) input'], '3');
359
        $I->fillField(['css' => '#form2 table tbody tr:nth-child(3) td:nth-child(2) input'], '無回答');
360
361
        $I->click(['css' => '#form2 .c-conversionArea .ladda-button']);
362
363
        $I->see('登録が完了しました。', '.c-contentsArea .alert-success');
364
        $I->amOnPage('/'.$config['eccube_admin_route'].'/customer/new');
365
        $I->see('無回答', '#customer_form #admin_customer_sex');
366
    }
367
368
    /**
369
     * ATTENTION 後続のテストが失敗するため、最後に実行する必要がある
370
     */
371
    public function systeminfo_セキュリティ管理IP制限(\AcceptanceTester $I)
372
    {
373
        $I->wantTo('EA0804-UC01-T03 セキュリティ管理 - IP制限');
374
375
        $findPlugins = Fixtures::get('findPlugins');
376
        $Plugins = $findPlugins();
377
        if (is_array($Plugins) && count($Plugins) > 0) {
378
            $I->getScenario()->skip('プラグインのアンインストールが必要なため、テストをスキップします');
379
        }
380
381
        // 表示
382
        $config = Fixtures::get('config');
383
        $I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/security');
384
        $I->see('セキュリティ管理システム設定', '#page_admin_setting_system_security .c-pageTitle__titles');
385
386
        $I->fillField(['id' => 'admin_security_admin_allow_hosts'], '1.1.1.1');
387
        $I->click('#page_admin_setting_system_security form div.c-contentsArea__cols > div.c-conversionArea > div > div > div:nth-child(2) > div > div > button');
388
389
        $I->amOnPage('/'.$config['eccube_admin_route']);
390
        $I->see('アクセスできません。', '.ec-layoutRole .ec-reportHeading');
391
    }
392
}
393