diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 89afc312..746af483 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -57,8 +57,38 @@ jobs: - name: Install examples run: npm run install:examples + - name: Start servers + run: | + npm run start:api > api.log 2>&1 & + npm run start:cra > cra.log 2>&1 & + + - name: Wait for app to be reachable + run: | + echo "Waiting for CRA app to respond on port 3000..." + for i in {1..20}; do + if curl -s http://127.0.0.1:3000 > /dev/null; then + echo "App is up!" + break + fi + echo "Still waiting... ($i)" + sleep 3 + done + - name: Run integration test (CRA) - run: npm run test:cra + run: | + npx wait-on http://127.0.0.1:3000 + npx cypress run --spec 'cypress/e2e/smoke.cy.ts' --browser chrome --headless + env: + CI: true + + - name: Upload cypress screeshots (CRA) + if: failure() + uses: actions/upload-artifact@v4 + with: + name: cypress-screenshots-cra-${{ github.run_id }} + path: cypress/screenshots/** + retention-days: 30 + compression-level: 6 - name: Run integration test (NextJS) run: npm run test:nextjs diff --git a/cypress.config.js b/cypress.config.js index 0aa2749d..1c8c3252 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -11,7 +11,19 @@ module.exports = defineConfig({ mochaFile: 'test-results/cypress/junit-[hash].xml', }, e2e: { - setupNodeEvents(on, config) {}, + setupNodeEvents(on, config) { + on('before:browser:launch', (browser = {}, launchOptions) => { + if (browser.name === 'chrome' || browser.name === 'chromium') { + launchOptions.args.push('--no-sandbox') + launchOptions.args.push('--disable-gpu') + launchOptions.args.push('--disable-dev-shm-usage') + launchOptions.args.push('--disable-setuid-sandbox') + launchOptions.args.push('--disable-web-security') + } + return launchOptions + }) + return config + }, baseUrl: 'http://localhost:3000', supportFile: false, },