From 0b61a729b80eb82ae6c0b0fbbdd0ca9f7a03b591 Mon Sep 17 00:00:00 2001 From: carkn Date: Tue, 1 Feb 2022 15:57:08 +0900 Subject: [PATCH 1/3] =?UTF-8?q?ZAP=20=E3=82=B7=E3=83=8A=E3=83=AA=E3=82=AA?= =?UTF-8?q?=20=E5=BD=93=E3=82=B5=E3=82=A4=E3=83=88=E3=81=AB=E3=81=A4?= =?UTF-8?q?=E3=81=84=E3=81=A6=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TypeScript/test/front_guest/about.test.ts | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 zap/selenium/ci/TypeScript/test/front_guest/about.test.ts diff --git a/zap/selenium/ci/TypeScript/test/front_guest/about.test.ts b/zap/selenium/ci/TypeScript/test/front_guest/about.test.ts new file mode 100644 index 00000000000..db728c2e78b --- /dev/null +++ b/zap/selenium/ci/TypeScript/test/front_guest/about.test.ts @@ -0,0 +1,40 @@ +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'; +const url = baseURL + '/help/about'; + +test.describe.serial('サイトについてのテストをします', () => { + let page: Page; + test.beforeAll(async () => { + await zapClient.setMode(Mode.Protect); + await zapClient.newSession('/zap/wrk/sessions/front_about', true); + await zapClient.importContext(ContextType.FrontGuest); + 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('.ec-pageHeader')).toContainText('当サイトについて'); + }); + + test.describe('テストを実行します[GET] @attack', () => { + let scanId: number; + test('アクティブスキャンを実行します', async () => { + scanId = await zapClient.activeScan(url, false, true, null, 'GET', null); + await intervalRepeater(async () => await zapClient.getActiveScanStatus(scanId), 5000, page); + }); + + test('結果を確認します', async () => { + await zapClient.getAlerts(url, 0, 1, Risk.High) + .then(alerts => expect(alerts).toEqual([])); + }); + }); +}); From 3ce399700fa78a5881a577c7f3fd22a6a8de2c77 Mon Sep 17 00:00:00 2001 From: carkn Date: Tue, 1 Feb 2022 16:46:56 +0900 Subject: [PATCH 2/3] =?UTF-8?q?penetration-test.yml=20=E3=81=B8about.test.?= =?UTF-8?q?ts=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/penetration-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/penetration-test.yml b/.github/workflows/penetration-test.yml index 018d107aef3..eb5443c56e9 100644 --- a/.github/workflows/penetration-test.yml +++ b/.github/workflows/penetration-test.yml @@ -13,6 +13,7 @@ jobs: operating-system: [ ubuntu-18.04 ] group: - 'test/front_login/contact.test.ts' + - 'test/front_guest/about.test.ts' - 'test/front_guest/contact.test.ts' - 'test/admin/order_mail.test.ts' From 0d45ceb83655d6ccf640a9b67f60c6988ba52d12 Mon Sep 17 00:00:00 2001 From: Chihiro Adachi <8196725+chihiro-adachi@users.noreply.github.com> Date: Fri, 11 Mar 2022 15:43:08 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E6=96=87=E8=A8=80=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ci/TypeScript/test/front_guest/about.test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/zap/selenium/ci/TypeScript/test/front_guest/about.test.ts b/zap/selenium/ci/TypeScript/test/front_guest/about.test.ts index db728c2e78b..4602256ba83 100644 --- a/zap/selenium/ci/TypeScript/test/front_guest/about.test.ts +++ b/zap/selenium/ci/TypeScript/test/front_guest/about.test.ts @@ -6,25 +6,25 @@ const zapClient = new ZapClient('http://127.0.0.1:8090'); const baseURL = 'https://ec-cube'; const url = baseURL + '/help/about'; -test.describe.serial('サイトについてのテストをします', () => { +test.describe.serial('当サイトについてのテストをします', () => { let page: Page; test.beforeAll(async () => { await zapClient.setMode(Mode.Protect); - await zapClient.newSession('/zap/wrk/sessions/front_about', true); + await zapClient.newSession('/zap/wrk/sessions/front_guest_about', true); await zapClient.importContext(ContextType.FrontGuest); const browser = await chromium.launch(); page = await browser.newPage(); await page.goto(url); }); - - test('お問い合わせページを表示します', async () => { + + test('当サイトについてのページを表示します', async () => { await expect(page).toHaveTitle(/当サイトについて/); }); test('タイトルを確認します', async () => { await expect(page.locator('.ec-pageHeader')).toContainText('当サイトについて'); }); - + test.describe('テストを実行します[GET] @attack', () => { let scanId: number; test('アクティブスキャンを実行します', async () => {