Skip to content

Commit

Permalink
E2E 権限管理_登録
Browse files Browse the repository at this point in the history
  • Loading branch information
h.matsuo committed Mar 16, 2022
1 parent 22439f2 commit 13dcd41
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 1 deletion.
83 changes: 83 additions & 0 deletions codeception/_support/Page/Admin/SystemMemberEditPage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php

/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Page\Admin;

class SystemMemberEditPage extends AbstractAdminPageStyleGuide
{
/**
* @param \AcceptanceTester $I
*/
public static function go_new($I)
{
$page = new self($I);

return $page->goPage('/setting/system/member/new', 'メンバー登録システム設定');
}

/**
* @param \AcceptanceTester $I
*/
public static function at($I)
{
$page = new self($I);
$page->atPage('メンバー登録システム設定');

return $page;
}

public function メンバー登録($form)
{
$form += [
'name' => 'name',
'department' => 'department',
'login_id' => 'id',
'password' => 'password',
'password_second' => 'password',
'authority' => 'システム管理者',
'work' => 1,
];

$this->tester->fillField('#admin_member_name', $form['name']);
$this->tester->fillField('#admin_member_department', $form['department']);
$this->tester->fillField('#admin_member_login_id', $form['login_id']);
$this->tester->fillField('#admin_member_plain_password_first', $form['password']);
$this->tester->fillField('#admin_member_plain_password_second', $form['password_second']);
$this->tester->selectOption('#admin_member_Authority', $form['authority']);
$this->tester->selectOption('input[name="admin_member[Work]"]', $form['work']);

return $this;
}

public function 入力_パスワード($password, $password_second)
{
$this->tester->fillField('#admin_member_plain_password_first', $password);
$this->tester->fillField('#admin_member_plain_password_second', $password_second);

return $this;
}

public function 入力_稼働($value)
{
$this->tester->selectOption('input[name="admin_member[Work]"]', $value);

return $this;
}

public function 登録()
{
$this->tester->click('.c-conversionArea .btn-ec-conversion');

return $this;
}
}
60 changes: 59 additions & 1 deletion codeception/acceptance/EA08SysteminfoCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Codeception\Util\Fixtures;
use Page\Admin\AuthorityManagePage;
use Page\Admin\LoginHistoryPage;
use Page\Admin\SystemMemberEditPage;

/**
* @group admin
Expand Down Expand Up @@ -352,6 +353,63 @@ public function systeminfo_セキュリティ管理IP制限_拒否リスト(Acce
$I->see('保存しました', AuthorityManagePage::$完了メッセージ);
}

/**
* @group vaddy
*/
public function systeminfo_権限管理登録(AcceptanceTester $I)
{
// 店舗オーナーアカウントを作成
$page = SystemMemberEditPage::go_new($I)
->メンバー登録([
'login_id' => 'shop_owner',
'authority' => '店舗オーナー',
])
->登録();

$I->wantTo('EA0805-UC01-T01 権限管理 - 登録');

// 設定を追加
AuthorityManagePage::go($I)
->行追加()
->入力(1, ['1' => '店舗オーナー'], '/setting')
->登録();
$I->see('保存しました', AuthorityManagePage::$完了メッセージ);

$I->wantTo('EA0805-UC01-T02 権限管理 - 登録');

// 店舗オーナーでログインし、ナビに表示されないことを確認
$I->logoutAsAdmin();
$I->loginAsAdmin('shop_owner', 'password');
$I->click(['css' => 'a[href="#nav-setting"]']);
$I->wait(1);
$I->dontSee('システム設定', '#nav-setting');

// URL直でもアクセスできないことを確認
$config = Fixtures::get('config');
$I->amOnPage("/${config['eccube_admin_route']}/setting/system/member");
$I->seeInTitle('アクセスできません');

// 設定を削除
$I->amOnPage("/{$config['eccube_admin_route']}/logout");
$I->loginAsAdmin();

AuthorityManagePage::go($I)
->行削除(1)
->登録();
$I->see('保存しました', AuthorityManagePage::$完了メッセージ);

// 店舗オーナーアカウントでアクセスできることを確認
$I->logoutAsAdmin();
$I->loginAsAdmin('shop_owner', 'password');

$I->click(['css' => 'a[href="#nav-setting"]']);
$I->wait(1);
$I->see('システム設定', '#nav-setting');

$I->amOnPage("/${config['eccube_admin_route']}/setting/system/member");
$I->seeInTitle('メンバー管理');
}

/**
* @group vaddy
*/
Expand Down Expand Up @@ -416,7 +474,7 @@ public function systeminfo_ログ表示(AcceptanceTester $I)
$I->click(['css' => '#form1 button']);

$logs = $I->grabTextFrom('.c-contentsArea textarea');
$I->assertLessThanOrEqual(10, count(explode("\n", $logs)), "ログ件数を確認");
$I->assertLessThanOrEqual(10, count(explode("\n", $logs)), 'ログ件数を確認');
$I->seeInField(['id' => 'admin_system_log_line_max'], '10');
}

Expand Down

0 comments on commit 13dcd41

Please sign in to comment.