diff --git a/.github/workflows/playwright-test.yml b/.github/workflows/playwright-test.yml new file mode 100644 index 00000000..66752783 --- /dev/null +++ b/.github/workflows/playwright-test.yml @@ -0,0 +1,32 @@ +name : Playwright E2E Test +on: + pull_request: + branches: ['main'] + +jobs: + wait_for_vercel: + runs-on: ubuntu-latest + outputs: + preview_url: ${{ steps.waitForVercelPreviewDeployment.outputs.url }} + steps: + - name : Waiting for Vercel Preview Deployment to be ready + uses : patrickedqvist/wait-for-vercel-preview@v1.3.1 + with : + token: ${{ secrets.SECRET_GITHUB_TOKEN }} + max_timeout: 600 + playwright_test: + runs-on: ubuntu-latest + needs: wait_for_vercel + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '18' # 本番環境と同じバージョンを指定 + - name: Install dependencies + run: npm install + - name: Run Playwright tests + run: npx playwright test + env: + TEST_URL: ${{ needs.wait_for_vercel.outputs.preview_url }} \ No newline at end of file