From f650453072042296148b6e1b84dd238615e1aa81 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Thu, 21 Nov 2024 23:57:39 +0530 Subject: [PATCH] fix the cypress yaml --- .github/workflows/cypress.yaml | 66 ++++++---------------------------- 1 file changed, 10 insertions(+), 56 deletions(-) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 506c2e56f66..dc12c3e0ff4 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -9,13 +9,8 @@ on: jobs: cypress-run: - permissions: write-all if: github.repository == 'ohcnetwork/care_fe' runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - containers: [1, 2, 3, 4] env: REACT_CARE_API_URL: http://localhost:9000 REACT_ENABLED_APPS: "ohcnetwork/care_hcx_fe@main" @@ -81,58 +76,17 @@ jobs: sudo wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo apt-get install ./google-chrome-stable_current_amd64.deb - - name: Cypress run for Non-Forked PRs 🥬 - if: steps.pr_origin.outputs.is_forked == 'false' - uses: cypress-io/github-action@v5 - with: - env: SKIP_PREFLIGHT_CHECK=true - install: false - start: "npx vite preview --host" - wait-on: "http://localhost:4000" - wait-on-timeout: 300 - browser: chrome - record: true - parallel: true - group: "UI-Chrome" - env: - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NODE_OPTIONS: --max_old_space_size=4096 - COMMIT_INFO_MESSAGE: ${{github.event.pull_request.title}} - COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha}} - - - name: Cypress run for Forked PRs 🥬 - if: steps.pr_origin.outputs.is_forked == 'true' - uses: cypress-io/github-action@v5 - with: - env: SKIP_PREFLIGHT_CHECK=true - install: false - start: "npx vite preview --host" - wait-on: "http://localhost:4000" - wait-on-timeout: 300 - browser: chrome - record: true - parallel: true - group: "UI-Chrome" - env: - CYPRESS_SPLIT_TESTS: "true" - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NODE_OPTIONS: --max_old_space_size=4096 - COMMIT_INFO_MESSAGE: ${{github.event.pull_request.title}} - COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha}} - SPLIT: ${{ strategy.job-total }} - SPLIT_INDEX: ${{ strategy.job-index }} + - name: Run Cypress Tests in Parallel 🥬 + run: | + mkdir -p results + TEST_FILES=$(find cypress/e2e -name "*.cy.ts") + COMMANDS=$(echo $TEST_FILES | xargs -n 1 -I {} echo "npx cypress run --spec {} > results/$(basename {}).log") + LABELS=$(echo $TEST_FILES | xargs -n 1 -I {} basename {} .cy.ts) + echo $COMMANDS | xargs npx concurrently -n $LABELS --kill-others-on-fail - - name: Upload cypress screenshots on failure 📸 + - name: Upload Cypress Artifacts 📸 uses: actions/upload-artifact@v3 if: failure() with: - name: cypress-screenshots - path: cypress/screenshots - - - name: Upload cypress videos 📹 - uses: actions/upload-artifact@v3 - if: ${{ failure() && steps.pr_origin.outputs.is_forked == 'true' }} - with: - name: cypress-videos - path: cypress/videos \ No newline at end of file + name: cypress-artifacts + path: cypress/{screenshots,videos} \ No newline at end of file