Basic testing done with github actions #2
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: E2E (Cypress) | |
| on: | |
| push: | |
| branches: [main, master, feature/*] | |
| pull_request: | |
| branches: [main, master] | |
| jobs: | |
| cypress-run: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node 20 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Cache client deps | |
| uses: actions/cache@v4 | |
| with: | |
| path: client/trading-dashboard/node_modules | |
| key: ${{ runner.os }}-client-e2e-${{ hashFiles('client/trading-dashboard/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-client-e2e- | |
| - name: Install client deps & build | |
| working-directory: client/trading-dashboard | |
| run: | | |
| npm ci | |
| npm run build | |
| - name: Start client & run Cypress (no backend) | |
| uses: cypress-io/github-action@v6 | |
| with: | |
| start: npm --prefix client/trading-dashboard start | |
| wait-on: "http://localhost:3000" | |
| wait-on-timeout: 120 | |
| browser: chrome | |
| spec: client/trading-dashboard/cypress/e2e/**/*.cy.ts | |
| env: | |
| # Point to an unreachable host so fetch fails and client falls back to MOCK_TICKERS | |
| NEXT_PUBLIC_MARKET_TRADING_URL: http://127.0.0.1:59999 | |
| CYPRESS_BASE_URL: http://localhost:3000 | |
| - name: Upload Cypress videos/screenshots (if failed) | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cypress-artifacts | |
| path: | | |
| client/trading-dashboard/cypress/videos/** | |
| client/trading-dashboard/cypress/screenshots/** |