Skip to content

Commit

Permalink
fix the cypress yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 committed Nov 21, 2024
1 parent 10369c5 commit f650453
Showing 1 changed file with 10 additions and 56 deletions.
66 changes: 10 additions & 56 deletions .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
name: cypress-artifacts
path: cypress/{screenshots,videos}

0 comments on commit f650453

Please sign in to comment.