Skip to content
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] 管理画面>コンテンツ管理>ページ管理のテストを追加 #5313

Merged
merged 2 commits into from Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/penetration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- 'test/admin/content_layout.test.ts'
- 'test/admin/content_layout_delete.test.ts'
- 'test/admin/order_mail.test.ts'
- 'test/admin/content_page.test.ts'
- 'test/admin/change_password.test.ts'

steps:
Expand Down
47 changes: 47 additions & 0 deletions zap/selenium/ci/TypeScript/test/admin/content_page.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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 + '/content/page';

test.describe.serial('ページ管理>コンテンツ管理のテストをします', () => {
let page: Page;
test.beforeAll(async () => {
await zapClient.setMode(Mode.Protect);
await zapClient.newSession('/zap/wrk/sessions/admin_content_page', 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__title')
.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([]));
});
});
});