Skip to content

Commit

Permalink
Merge pull request #5282 from nanasess/fix-http_proxy
Browse files Browse the repository at this point in the history
[OWASP ZAP] macOS で Playwright がエラーになるのを修正
  • Loading branch information
chihiro-adachi authored Jan 28, 2022
2 parents 4a8bbff + 7a6aa37 commit a446f03
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions zap/selenium/ci/TypeScript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ docker-compose exec -T ec-cube bin/console eccube:fixtures:generate --products=5
docker-compose exec -T ec-cube bin/console doctrine:query:sql "UPDATE dtb_customer SET email = '[email protected]' WHERE id = 1;"

## 環境変数 APP_ENV=prod に設定します
sed -i 's!APP_ENV: "dev"!APP_ENV: "prod"!g' docker-compose.yml
sed -i.bak 's!APP_ENV: "dev"!APP_ENV: "prod"!g' docker-compose.yml

## ec-cube コンテナを再起動し、設定を反映します。
docker-compose up -d ec-cube
Expand All @@ -45,7 +45,7 @@ yarn install && yarn playwright install # (初回のみ)
HTTP_PROXY=127.0.0.1:8090 HTTPS_PROXY=127.0.0.1:8090 yarn playwright test

## (Optional) 個別にテストする場合は、テストのファイル名を指定してください。
yarn playwright test test/front_guest/contact.test.ts
HTTP_PROXY=127.0.0.1:8090 HTTPS_PROXY=127.0.0.1:8090 yarn playwright test test/front_guest/contact.test.ts
```

#### 実行中に OWASP ZAP を操作したい場合
Expand All @@ -69,7 +69,7 @@ yarn playwright test test/front_guest/contact.test.ts
以下のように playwright に `--headed` オプションを付与することで Chrome が実際に起動し、実行状況を確認できます。

``` shell
yarn playwright test test/front_guest/contact.test.ts --headed
HTTP_PROXY=127.0.0.1:8090 HTTPS_PROXY=127.0.0.1:8090 yarn playwright test test/front_guest/contact.test.ts --headed
```

また、 [`page.pause()`](https://playwright.dev/docs/api/class-page#page-pause)をテストコードに埋め込めばステップ実行も可能です。
Expand Down
5 changes: 4 additions & 1 deletion zap/selenium/ci/TypeScript/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ const config: PlaywrightTestConfig = {

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
ignoreHTTPSErrors: true
ignoreHTTPSErrors: true,
proxy: {
server: process.env.HTTP_PROXY ? `http://${process.env.HTTP_PROXY}` : 'http://127.0.0.1:8090'
}
},

/* Configure projects for major browsers */
Expand Down

0 comments on commit a446f03

Please sign in to comment.