Completed
Push — 4.0 ( 268f2c...88f012 )
by Hideki
05:48 queued 10s
created

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