add cypress tests and refactor search interface #4
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: Cypress E2E Tests | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| jobs: | |
| # Job to run specific test suites - only the working ones | |
| cypress-suites: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| # Only run the successful suites: mobile, admin, tv | |
| suite: [mobile, admin, tv] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build application | |
| run: npm run build | |
| - name: Create test environment file | |
| run: | | |
| echo "JELLYFIN_SERVER_URL=http://localhost:8096" > .env.local | |
| echo "JELLYFIN_API_KEY=test-api-key" >> .env.local | |
| echo "JELLYFIN_USERNAME=test-user" >> .env.local | |
| echo "NODE_ENV=test" >> .env.local | |
| - name: Run Mobile Interface Tests | |
| if: matrix.suite == 'mobile' | |
| uses: cypress-io/github-action@v6 | |
| with: | |
| start: npm start | |
| wait-on: 'http://localhost:3000' | |
| command: npm run test:e2e:mobile | |
| browser: chrome | |
| - name: Run Admin Interface Tests | |
| if: matrix.suite == 'admin' | |
| uses: cypress-io/github-action@v6 | |
| with: | |
| start: npm start | |
| wait-on: 'http://localhost:3000' | |
| command: npm run test:e2e:admin | |
| browser: chrome | |
| - name: Run TV Interface Tests | |
| if: matrix.suite == 'tv' | |
| uses: cypress-io/github-action@v6 | |
| with: | |
| start: npm start | |
| wait-on: 'http://localhost:3000' | |
| command: npm run test:e2e:tv | |
| browser: chrome | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: cypress-results-${{ matrix.suite }} | |
| path: | | |
| cypress/screenshots | |
| cypress/videos | |
| cypress/reports | |
| retention-days: 7 | |
| # Summary job that depends on test jobs | |
| test-summary: | |
| runs-on: ubuntu-latest | |
| needs: [cypress-suites] | |
| if: always() | |
| steps: | |
| - name: Check test results | |
| run: | | |
| if [[ "${{ needs.cypress-suites.result }}" == "failure" ]]; then | |
| echo "Tests failed" | |
| exit 1 | |
| else | |
| echo "Tests passed" | |
| fi |