From c6ca3d9521f56d7cd0bfa9273cc0fadd109411c4 Mon Sep 17 00:00:00 2001 From: kevkevinpal Date: Fri, 20 Sep 2024 15:10:01 -0400 Subject: [PATCH] test: run cypress tests individually --- .github/workflows/test.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 03c0720c87..fc274d5b4a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,8 +4,42 @@ on: branches: - master jobs: + get-cypress-tests: + runs-on: + ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + path: ./sphinx-nav-fiber + + - name: Debug test files + working-directory: ./sphinx-nav-fiber + run: | + find cypress/e2e -name '*.spec.js' -o -name '*.cy.ts' | jq -R -s -c 'split("\n") | map(select(. != ""))' + + + - name: List Cypress test files + id: list-tests + working-directory: ./sphinx-nav-fiber + run: | + tests=$(find cypress/e2e -name '*.spec.js' -o -name '*.cy.ts' | jq -R -s -c 'split("\n") | map(select(. != ""))') + if [ -z "$tests" ]; then + echo "No Cypress test files found." + tests="[]" + fi + echo "::set-output name=tests::$tests" + + outputs: + tests: ${{ steps.list-tests.outputs.tests }} + cypress-run: runs-on: ubuntu-latest + needs: get-cypress-tests + strategy: + fail-fast: false + matrix: + file: ${{ fromJson(needs.get-cypress-tests.outputs.tests) }} steps: - name: Enable docker.host.internal for Ubuntu run: | @@ -81,6 +115,7 @@ jobs: browser: chrome headless: true start: yarn run start-e2e + spec: ${{ matrix.file }} wait-on: 'http://localhost:3000' # Waits for above wait-on-timeout: 120 # Waits for 2 minutes # Records to Cypress Dashboard