テスト自動化のテスト #12
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
name: Playwright Tests | |
on: | |
push: | |
branches: [dev] | |
pull_request: | |
branches: [dev] | |
jobs: | |
test: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
services: | |
web: | |
image: node:lts | |
ports: | |
- 3001:3001 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
# 依存関係のインストール | |
- name: Install dependencies | |
run: npm install | |
working-directory: app/frontend | |
# サーバーをバックグラウンドで起動 | |
- name: Start server | |
run: npm start & | |
working-directory: app/frontend | |
# Playwrightブラウザのインストール | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
working-directory: app/frontend | |
# サーバーが起動するまで待機 | |
- name: Wait for server to be ready | |
run: sleep 15 # 必要に応じて調整 | |
# Playwrightテストの実行 | |
- name: Run Playwright tests | |
run: npx playwright test | |
working-directory: app/frontend | |
# レポートのアップロード | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ |