Trying to fix the e2e tests #323
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Pull request checks | |
| on: [pull_request] | |
| env: | |
| NODE_VERSION: '20' | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-24.04 | |
| continue-on-error: true | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Run linter | |
| uses: ./.github/actions/lint | |
| e2e-tests: | |
| name: E2E Test - ${{ matrix.spec }} | |
| needs: ['lint'] | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false # Continue running other tests even if one fails | |
| matrix: | |
| spec: | |
| - login | |
| - users | |
| - roles | |
| - profiles | |
| - resetpassword | |
| - JSONEditor | |
| - chartView | |
| - formView | |
| - treeview | |
| - '404' | |
| - api-actions | |
| - collections | |
| - docs | |
| - environments | |
| - indexes | |
| - search | |
| - watch | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Start Kuzzle | |
| run: | | |
| docker compose up --wait | |
| docker ps | |
| curl -v http://localhost:7512/_healthcheck | |
| - name: Build | |
| run: npm run build | |
| - name: Start preview server | |
| run: | | |
| npx vite preview --host 0.0.0.0 --port 8080 & | |
| echo $! > preview.pid | |
| echo "Waiting for preview server..." | |
| timeout=30 | |
| until curl -s http://localhost:8080 > /dev/null; do | |
| sleep 1 | |
| timeout=$((timeout-1)) | |
| if [ $timeout -eq 0 ]; then | |
| echo "Preview server failed to start" | |
| exit 1 | |
| fi | |
| done | |
| echo "Preview server is ready!" | |
| - name: Run Cypress test | |
| run: | | |
| npx cypress run \ | |
| --spec "test/e2e/cypress/integration/single-backend/${{ matrix.spec }}.spec.js" \ | |
| --browser chrome \ | |
| --config baseUrl=http://localhost:8080,retries=2 | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| if [ -f preview.pid ]; then | |
| kill $(cat preview.pid) || true | |
| fi | |
| - name: Upload screenshots | |
| uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: cypress-snapshots-${{ matrix.spec }} | |
| path: test/e2e/failed-test | |
| test-summary: | |
| name: Tests Summary | |
| needs: [lint, e2e-tests] | |
| if: always() | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Check test results | |
| run: | | |
| if [ "${{ needs.e2e-tests.result }}" = "failure" ]; then | |
| echo "E2E tests failed" | |
| exit 1 | |
| elif [ "${{ needs.lint.result }}" = "failure" ]; then | |
| echo "Lint failed" | |
| exit 1 | |
| else | |
| echo "All tests passed!" | |
| fi |