From 03d95775dd5d3bb57b48c3d7fdb08194cbde2b80 Mon Sep 17 00:00:00 2001 From: contradiction29 Date: Wed, 17 Apr 2024 18:40:56 +0900 Subject: [PATCH] Add workflow file to run playwright --- .github/workflows/playwright-test.yml | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/playwright-test.yml diff --git a/.github/workflows/playwright-test.yml b/.github/workflows/playwright-test.yml new file mode 100644 index 00000000..4e7cf788 --- /dev/null +++ b/.github/workflows/playwright-test.yml @@ -0,0 +1,45 @@ +name : Playwright E2E Test +on: + pull_request: + branches: ['main'] + +jobs: + playwright-e2e-test: + runs-on: ubuntu-latest + steps: + - name : Waiting for Vercel Preview Deployment to be ready + uses : patrickedqvist/wait-for-vercel-preview@v1.3.1 + id : waitFor200 + with : + token : ${{ secrets.SECRET_GITHUB_TOKEN }} + max_timeout: 600 + + - name : Check if the url is valid + run : echo "::set-output name=url::${{ steps.waitFor200.outputs.url }}" + + - 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 : Install Playwright with dependencies + run : npx playwright install --with-deps + + - name : Run Playwright tests + run : npx playwright test + env : + TEST_URL : ${{ steps.waitFor200.outputs.url }} + + - name : Upload Playwright report + uses : actions/upload-artifact@v3 + if : always() + with : + name : playwright-report + path : playwright-report/ + retention-days : 30 \ No newline at end of file