diff --git a/.github/workflows/cypress-tests.yml b/.github/workflows/cypress-tests.yml index 205ba0b..1ff4a69 100644 --- a/.github/workflows/cypress-tests.yml +++ b/.github/workflows/cypress-tests.yml @@ -1,89 +1,42 @@ -name: Cypress Tests - -on: - push: - branches: - - "feature/*" - pull_request: - branches: - - main - +name: Test with Docker cypress/included +on: push jobs: - install: - runs-on: ubuntu-latest + cypress-run: + runs-on: ubuntu-22.04 container: - image: cypress/browsers:node-20.12.0-chrome-123.0.6312.86-1-ff-124.0.2-edge-123.0.2420.65-1 + image: cypress/included:cypress-13.15.1-node-20.18.0-chrome-130.0.6723.69-1-ff-131.0.3-edge-130.0.2849.52-1 options: --user 1001 - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Cypress install - uses: cypress-io/github-action@v6 - with: - runTests: false - # report machine parameters - - run: npx cypress info - - run: node --version - - run: node -p 'os.cpus()' - - run: npm run lint + services: + redis: + image: redis + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 6379:6379 - - name: Save build folder - uses: actions/upload-artifact@v4 - with: - name: build - if-no-files-found: error - path: build - - ui-chrome-tests: - timeout-minutes: 15 - runs-on: ubuntu-latest - container: - image: cypress/browsers:node-20.12.0-chrome-123.0.6312.86-1-ff-124.0.2-edge-123.0.2420.65-1 - options: --user 1001 - needs: install - strategy: - # when one test fails, DO NOT cancel the other - # containers, because this will kill Cypress processes - # leaving Cypress Cloud hanging ... - # https://github.com/cypress-io/github-action/issues/48 - fail-fast: false - matrix: - # run copies of the current job in parallel - containers: [1, 2, 3, 4, 5] steps: - name: Checkout uses: actions/checkout@v4 - - name: Download the build folders - uses: actions/download-artifact@v4 + - name: Build cache + uses: actions/cache@v4 with: - name: build - path: build - - - name: Node info - run: node -v - - - name: __e Dir - run: ls /__e - - - name: "E2E Tests - Chrome" + path: | + ~/.npm + ${{ github.workspace }}/.next/cache + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx') }} + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- + + - name: Cypress run uses: cypress-io/github-action@v6 with: - build: yarn cypress info - start: yarn start:ci - wait-on: "http://localhost:3000" - wait-on-timeout: 120 + build: npm run build + start: npm start browser: chrome - record: true - parallel: true - group: "E2E - Chrome" - spec: cypress/e2e/* - config-file: cypress.config.ts env: - CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }} - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - # Recommended: pass the GitHub token lets this action correctly - # determine the unique run id necessary to re-run the checks - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DEBUG: "cypress:server:args" + CYPRESS_INSTALL_BINARY: 0 + REDIS_URL: localhost:6379 \ No newline at end of file