Skip to content

Commit

Permalink
Merge pull request #5328 from carkn/zap_category_export
Browse files Browse the repository at this point in the history
[OWASP ZAP]会員管理 会員一覧を追加
  • Loading branch information
chihiro-adachi authored Apr 22, 2022
2 parents f0b4346 + 2906af1 commit f29bcec
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/penetration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
- 'test/front_guest/contact.test.ts'
- 'test/admin/content_layout.test.ts'
- 'test/admin/content_layout_delete.test.ts'
- 'test/admin/customer.test.ts'
- 'test/admin/content_cache.test.ts'
- 'test/admin/customer_edit.test.ts'
- 'test/admin/product_class_name.test.ts'
Expand Down
45 changes: 45 additions & 0 deletions zap/selenium/ci/TypeScript/test/admin/customer.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { test, expect, chromium, Page } from '@playwright/test';
import { intervalRepeater } from '../../utils/Progress';
import { ZapClient, Mode, ContextType, Risk, HttpMessage } from '../../utils/ZapClient';
const zapClient = new ZapClient('http://127.0.0.1:8090');

const baseURL = 'https://ec-cube/admin';
const url = baseURL + '/customer';

test.describe.serial('会員管理 会員一覧のテストをします', () => {
let page: Page;
test.beforeAll(async () => {
await zapClient.setMode(Mode.Protect);
await zapClient.newSession('/zap/wrk/sessions/admin_customer', 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 expect(page.locator('.c-pageTitle__titles')).toContainText('会員管理');
});

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([]));
});
});
});

0 comments on commit f29bcec

Please sign in to comment.