From e2b5f4f1713fc2eb7a9acdac8d31a7776d2e41e1 Mon Sep 17 00:00:00 2001 From: kevkevin Date: Fri, 20 Sep 2024 18:02:31 -0500 Subject: [PATCH] test: run cypress tests individually (#2186) --- .github/workflows/test.yml | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 03c0720c8..ed68ac4fa 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 @@ -100,8 +135,6 @@ jobs: name: cypress-logs path: cypress/videos - - name: Check the coverage value - run: yarn test-coverage - name: Stop Stack working-directory: ./stack