From 0c2b5a81336d534e580f2ae7eecc7027dc1896cc Mon Sep 17 00:00:00 2001 From: Hafizah Muhyideen <40233874+justfizah@users.noreply.github.com> Date: Sun, 12 Jan 2025 20:31:33 +0100 Subject: [PATCH] Chore: update --- .github/workflows/playwright.yml | 70 ++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 8b137891..7f12b91a 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -1 +1,71 @@ +name: E2E Tests + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + test: + timeout-minutes: 60 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Enable Corepack + run: corepack enable + + - name: Prepare Yarn + run: corepack prepare yarn@3.6.4 --activate + + - name: Install dependencies + run: yarn install + + - name: Install Playwright Browsers + run: yarn playwright install --with-deps + + - name: Verify GraphQL API availability + run: | + curl -X POST -H "Content-Type: application/json" \ + --data '{"query":"query { categories { id name } }"}' \ + https://api.kwekmarket.com/v1/kwekql || exit 1 + + - name: Update Browserslist DB + run: npx update-browserslist-db@latest + + - name: Install Sharp + run: yarn add sharp + + - name: Build the application + run: yarn build + env: + NEXT_PUBLIC_PUSHER_KEY: ${{ secrets.NEXT_PUBLIC_PUSHER_KEY }} + + - name: Start the application + run: yarn start & + env: + PORT: 3100 + NEXT_PUBLIC_PUSHER_KEY: ${{ secrets.NEXT_PUBLIC_PUSHER_KEY }} + + - name: Wait for the application to be ready + run: npx wait-on http://localhost:3100 + + - name: Run Playwright tests + env: + GRAPHQL_API_URL: https://api.kwekmarket.com/v1/kwekql + PORT: 3100 + run: yarn run test + + - uses: actions/upload-artifact@v4 + if: ${{ !cancelled() }} + with: + name: playwright-report + path: playwright-report/ + retention-days: 30