From fa5906cee4295075ed3c7083a6e3739983fe7e06 Mon Sep 17 00:00:00 2001 From: w3bdesign <45217974+w3bdesign@users.noreply.github.com> Date: Wed, 23 Oct 2024 05:21:02 +0200 Subject: [PATCH] Update playwright.yml --- .github/workflows/playwright.yml | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 8cd4ac11c..e3700d201 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -17,14 +17,36 @@ jobs: run: npm ci - name: Install Playwright Browsers run: npx playwright install --with-deps + - name: Build the project + run: npm run build + env: + NEXT_PUBLIC_GRAPHQL_URL: ${{ secrets.NEXT_PUBLIC_GRAPHQL_URL }} + - name: Start the application + run: npm run start & + env: + NEXT_PUBLIC_GRAPHQL_URL: ${{ secrets.NEXT_PUBLIC_GRAPHQL_URL }} + - name: Wait for the application to be ready + run: | + echo "Waiting for the application to be ready..." + timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:3000)" != "200" ]]; do sleep 5; done' || false + echo "Application is ready!" - name: Run Playwright tests run: npx playwright test env: - CI: true - NEXT_PUBLIC_GRAPHQL_URL: ${{ secrets.NEXT_PUBLIC_GRAPHQL_URL }} - - uses: actions/upload-artifact@v4 + CI: true + NEXT_PUBLIC_GRAPHQL_URL: ${{ secrets.NEXT_PUBLIC_GRAPHQL_URL }} + DEBUG: pw:api + - name: Upload test results if: always() + uses: actions/upload-artifact@v4 with: name: playwright-report path: playwright-report/ retention-days: 30 + - name: Upload test traces + if: failure() + uses: actions/upload-artifact@v4 + with: + name: playwright-traces + path: test-results/ + retention-days: 30