Skip to content

Commit

Permalink
Merge pull request #515 from nanasess/fix-member_id
Browse files Browse the repository at this point in the history
管理画面ユーザーIDに記号を使用できなかったのを修正
  • Loading branch information
chihiro-adachi authored Jan 26, 2022
2 parents affb06a + e53ec10 commit 1b23522
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 2 deletions.
4 changes: 2 additions & 2 deletions data/class/pages/admin/system/LC_Page_Admin_System_Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ public function initForm(&$objFormParam, &$arrParams, $mode = '')
$objFormParam->addParam('メンバーID', 'member_id', INT_LEN, 'n', array('NUM_CHECK'));
$objFormParam->addParam('名前', 'name', STEXT_LEN, 'KV', array('EXIST_CHECK', 'MAX_LENGTH_CHECK'));
$objFormParam->addParam('所属', 'department', STEXT_LEN, 'KV', array('MAX_LENGTH_CHECK'));
$objFormParam->addParam('ログインID', 'login_id', '', '', array('EXIST_CHECK', 'ALNUM_CHECK'));
$objFormParam->addParam('変更前ログインID', 'old_login_id', '', '', array('ALNUM_CHECK'));
$objFormParam->addParam('ログインID', 'login_id', '', '', array('EXIST_CHECK', 'GRAPH_CHECK'));
$objFormParam->addParam('変更前ログインID', 'old_login_id', '', '', array('GRAPH_CHECK'));
if ($mode == 'edit' && $arrParams['password'] == DEFAULT_PASSWORD) {
$objFormParam->addParam('パスワード', 'password', '', '', array('EXIST_CHECK'));
$objFormParam->addParam('パスワード(確認)', 'password02', '', '', array('EXIST_CHECK'));
Expand Down
92 changes: 92 additions & 0 deletions e2e-tests/test/admin/system/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { test, expect, chromium, Page } from '@playwright/test';
import { ZapClient, Mode, ContextType } from '../../../utils/ZapClient';
import * as faker from 'faker/locale/ja';
import * as fakerEn from 'faker/locale/en';

import { ADMIN_DIR } from '../../../config/default.config';

const url = `/${ADMIN_DIR}system/index.php`;
const zapClient = new ZapClient();

test.describe.serial('システム設定>メンバー管理画面を確認をします', () => {
let page: Page;
test.beforeAll(async () => {
await zapClient.setMode(Mode.Protect);
await zapClient.newSession('/zap/wrk/sessions/admin_system_input', true);
await zapClient.importContext(ContextType.Admin);

if (!await zapClient.isForcedUserModeEnabled()) {
await zapClient.setForcedUserModeEnabled();
expect(await zapClient.isForcedUserModeEnabled()).toBeTruthy();
}

const browser = await chromium.launch();
page = await browser.newPage();
await page.goto(url);
});

test('メンバー管理画面を開きます', async () => {
await expect(page.locator('h1')).toContainText('システム設定>メンバー管理');
});

let popup: Page;
test('メンバー登録画面を開きます', async () => {
[ popup ] = await Promise.all([
page.waitForEvent('popup'),
page.click('text=メンバーを新規入力')
]);
await popup.waitForLoadState('load');
await expect(popup.locator('h2')).toContainText('メンバー登録/編集');
});

const name = faker.name.lastName();
const department = faker.company.companyName();
const user = fakerEn.internet.password();
const password = fakerEn.fake('{{internet.password}}{{datatype.number}}');
test('メンバー登録を確認します', async () => {
popup.on('dialog', dialog => dialog.accept());
await popup.fill('input[name=name]', name);
await popup.fill('input[name=department]', department);
await popup.fill('input[name=login_id]', user);
await popup.fill('input[name=password]', password);
await popup.fill('input[name=password02]', password);
await popup.selectOption('select[name=authority]', { label: 'システム管理者' });
await popup.check('#work_1');
await popup.click('text=この内容で登録する');
});

let edit: Page;
test('メンバー編集を確認します', async () => {
await expect(page.locator('table.list >> tr >> nth=1')).toContainText(name);

[ edit ] = await Promise.all([
page.waitForEvent('popup'),
page.click('table.list >> tr >> nth=1 >> text=編集')
]);
edit.on('dialog', dialog => dialog.accept());
expect(await edit.inputValue('input[name=name]')).toBe(name);
await edit.fill('input[name=department]', `${department} 変更`);
expect(await edit.inputValue('input[name=login_id]')).toBe(user);
await edit.fill('input[name=password]', password);
await edit.fill('input[name=password02]', password);
await edit.click('text=この内容で登録する');

await expect(page.locator('table.list >> tr >> nth=1')).toContainText(`${department} 変更`);
});

test('下へ移動を確認します', async () => {
await page.click('table.list >> tr >> nth=1 >> text=下へ');
await expect(page.locator('table.list >> tr >> nth=2')).toContainText(name);
});

test('上へ移動を確認します', async () => {
await page.click('table.list >> tr >> nth=2 >> text=上へ');
await expect(page.locator('table.list >> tr >> nth=1')).toContainText(name);
});

test('メンバー削除を確認します', async () => {
page.on('dialog', dialog => dialog.accept());
await page.click('table.list >> tr >> nth=1 >> text=削除');
await expect(page.locator('table.list >> tr >> nth=1')).not.toContainText(name);
});
});

0 comments on commit 1b23522

Please sign in to comment.