Trying to fix the e2e tests #313
Workflow file for this run
This file contains 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 Tests - ${{ matrix.group.name }} | |
needs: ['lint'] | |
runs-on: ubuntu-24.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
group: | |
- name: 'auth' | |
spec: 'e2e/cypress/integration/single-backend/{login,resetpassword,users,roles,profiles}.spec.js' | |
- name: 'views' | |
spec: 'e2e/cypress/integration/single-backend/{JSONEditor,chartView,formView,treeview}.spec.js' | |
- name: 'core' | |
spec: 'e2e/cypress/integration/single-backend/{404,api-actions,collections,docs,environments,indexes,search,watch}.spec.js' | |
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: Install dependencies | |
run: npm ci | |
- name: Start Kuzzle | |
run: docker compose up --wait | |
- name: Cypress run | |
uses: cypress-io/github-action@v6 | |
with: | |
build: npm run build | |
start: npm run preview | |
browser: chrome | |
spec: ${{ matrix.group.spec }} | |
# Add some retry attempts for potentially flaky tests | |
config: retries=2 | |
# We don't need to install again since we did it above | |
install: false | |
# Add this to cache the build folder between runs | |
working-directory: . | |
- name: Upload screenshots | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: cypress-snapshots-${{ matrix.group.name }} | |
path: test/e2e/failed-test | |
retention-days: 5 # Limit retention to save space | |
# Add a summary job that depends on all tests | |
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 |