diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a21f94..2f782ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,25 +18,15 @@ jobs: uses: actions/setup-node@v4 with: node-version: 20 - - - name: Get pnpm store diretory - id: pnpm-store - shell: bash - run: | - echo "store-path=$(pnpm store path)" >> $GITHUB_OUTPUT - - - name: Setup pnpm cache - uses: actions/cache@v4 - with: - path: ${{steps.pnpm-store.outputs.store_path}} - key: ${{runner.os}}-pnpm-store-${{hashFiles('**/pnpm-lock.yaml')}} - restore-keys: | - ${{runner.os}}-pnpm-store- + cache: npm - name: Install Dependencies - run: pnpm test + run: npm ci + + - name: Run Tests + run: npm test - - name: Run Unit Tests (Jest) + - name: Install Playwright Browsers run: npx playwright install --with-deps - name: Run End-to-End Tests (Playwright) diff --git a/playwright.config.ts b/playwright.config.ts index 79e9e09..4da4c74 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -18,4 +18,12 @@ export default defineConfig({ use: { ...devices["Desktop Chrome"] }, }, ], + + // Configuração do Servidor Automático para o CI/CD + webServer: { + command: "npm run dev", // Comando que inicia o Next.js + url: "http://localhost:3000", // URL que o Playwright vai aguardar responder + reuseExistingServer: !process.env.CI, // No PC ele usa o servidor aberto; no GitHub ele cria um novo + timeout: 120 * 1000, // Tempo limite de 2 minutos para o boot do app + }, });