-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[OWASP ZAP] 会員管理 会員登録 #5330
Merged
Merged
[OWASP ZAP] 会員管理 会員登録 #5330
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
330cb72
[OWASP ZAP] 会員管理 会員の登録
carkn 1d85464
[OWASP ZAP] 会員管理 会員登録
carkn e0edae9
[OWASP ZAP] 会員管理 会員登録
carkn 0aa78ab
modified ユーザ情報入力を修正
carkn f83e840
Added 顧客情報追加を抑止
carkn bf53cc2
Added 顧客情報追加を抑止
carkn 8d7962d
Merge branch '4.1' into zap_admin_customer_new
chihiro-adachi a6e784b
Merge branch '4.1' into zap_admin_customer_new
chihiro-adachi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
zap/selenium/ci/TypeScript/test/admin/customer_new.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,89 @@ | ||||||
import { test, expect, chromium, Page } from '@playwright/test'; | ||||||
import PlaywrightConfig from '../../playwright.config'; | ||||||
import { intervalRepeater } from '../../utils/Progress'; | ||||||
import { ZapClient, Mode, ContextType, Risk, HttpMessage } from '../../utils/ZapClient'; | ||||||
import { ECCUBE_ADMIN_ROUTE } from '../../config/default.config'; | ||||||
|
||||||
const zapClient = new ZapClient(); | ||||||
|
||||||
const url = `${PlaywrightConfig.use.baseURL}/${ECCUBE_ADMIN_ROUTE}/customer/new`; | ||||||
|
||||||
test.describe.serial('会員管理 会員登録のテストを行います', () => { | ||||||
let page: Page; | ||||||
test.beforeAll(async () => { | ||||||
await zapClient.setMode(Mode.Protect); | ||||||
await zapClient.newSession('/zap/wrk/sessions/admin_customer_new', 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).toHaveTitle(/会員登録/); | ||||||
}); | ||||||
|
||||||
test('タイトルを確認します', async () => { | ||||||
await page.textContent('.c-pageTitle__subTitle') | ||||||
.then(title => expect(title).toContain('会員管理')); | ||||||
}); | ||||||
|
||||||
test.describe('テストを実行します[GET] @attack', () => { | ||||||
let scanId: number; | ||||||
test('アクティブスキャンを実行します', async () => { | ||||||
scanId = await zapClient.activeScanAsUser(url, 2, 55, false, null, 'GET'); | ||||||
await intervalRepeater(async () => await zapClient.getActiveScanStatus(scanId), 5000, page); | ||||||
}); | ||||||
|
||||||
test('結果を確認します', async () => { | ||||||
await zapClient.getAlerts(url, 0, 1, Risk.High) | ||||||
.then(alerts => expect(alerts).toEqual([])); | ||||||
}); | ||||||
}); | ||||||
|
||||||
test('ユーザ情報を入力します', async () => { | ||||||
await page.fill('[placeholder="姓"]', '山田'); | ||||||
await page.fill('[placeholder="名"]', '太郎'); | ||||||
await page.fill('[placeholder="セイ"]', 'ヤマダ'); | ||||||
await page.fill('[placeholder="メイ"]', 'タロウ'); | ||||||
await page.fill('input[name="admin_customer\\[company_name\\]"]', 'イーシーキューブ'); | ||||||
await page.fill('[placeholder="例:5300001"]', '5300001'); | ||||||
await page.click('select[name="admin_customer\\[address\\]\\[pref\\]"]'); | ||||||
await page.selectOption('select[name="admin_customer\\[address\\]\\[pref\\]"]', '1'); | ||||||
await page.fill('[placeholder="市区町村名\\(例:大阪市北区\\)"]', '大阪市北区梅田'); | ||||||
await page.fill('[placeholder="番地・ビル名\\(例:西梅田1丁目6-8\\)"]', '2-4-9'); | ||||||
await page.fill('[placeholder="例:ec-cube\\@example\\.com"]', 'taro_yamada@test.local'); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. メールアドレスが固定されているため、 常に このメールアドレスは利用できません というエラーになってしまうようです。 |
||||||
await page.fill('[placeholder="例:11122223333"]', '0001112222'); | ||||||
await page.fill('input[name="admin_customer\\[password\\]\\[first\\]"]', 'password123'); | ||||||
await page.fill('input[name="admin_customer\\[password\\]\\[second\\]"]', 'password123'); | ||||||
await page.click('input[name="admin_customer\\[sex\\]"]'); | ||||||
await page.selectOption('select[name="admin_customer\\[job\\]"]', '3'); | ||||||
await page.fill('input[name="admin_customer\\[birth\\]"]', '1980-04-01'); | ||||||
await page.fill('input[name="admin_customer\\[point\\]"]', '10'); | ||||||
await page.fill('textarea[name="admin_customer\\[note\\]"]', '国語国語国語国語国語国語国語国語国語国語国語国語国語国語国語国語国語国語国語国語国語国語'); | ||||||
await page.click('button:has-text("登録")'); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
で、いかがでしょうか? |
||||||
}); | ||||||
|
||||||
let message: HttpMessage; | ||||||
test('HttpMessage を取得します', async () => { | ||||||
message = await zapClient.getLastMessage(url); | ||||||
}); | ||||||
|
||||||
test.describe('テストを実行します[POST][入力→登録] @attack', () => { | ||||||
let scanId: number; | ||||||
test('アクティブスキャンを実行します', async () => { | ||||||
scanId = await zapClient.activeScan(url, false, true, null, 'POST', message.requestBody); | ||||||
await intervalRepeater(async () => await zapClient.getActiveScanStatus(scanId), 5000, page); | ||||||
}); | ||||||
|
||||||
test('ユーザ登録の結果を確認します', async () => { | ||||||
await zapClient.getAlerts(url, 0, 1, Risk.High) | ||||||
.then(alerts => expect(alerts).toEqual([])); | ||||||
}); | ||||||
}); | ||||||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
エスケープ文字
\\
で煩雑な記述になっているため、ID 指定の方がシンプルに記述できそうですが、いかがでしょう?