name: Functional Testing Pipeline on: push: branches: [ main, develop ] pull_request: branches: [ main ] jobs: functional-tests: runs-on: ubuntu-latest steps: # 1. Check out the repository code - name: Checkout Code uses: actions/checkout@v4 # 2. Set up the runtime environment (Node.js example). cache: 'npm' - # Caching package dependencies speeds up subsequent pipeline runs. - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' # 3. Install application and testing dependencies - name: Install Dependencies run: npm ci # 4. Install test-specific binaries (Required for Playwright/Cypress browsers) - name: Install Playwright Browsers run: npx playwright install --with-deps # 5. Start application server in the background (using &) so the pipeline # can immediately move to the next step and execute tests against it. - name: Start Application Server run: npm run start & env: NODE_ENV: test # 6. Run the functional testing suite - name: Run Functional Tests run: npm run test:functional # 7. Upload HTML test reports if a failure occurs (Great for debugging # screenshots/videos). if: always() Condition: This ensures that even # if the tests fail, GitHub Actions will still upload the test report, # screenshots, or logs, helping developers diagnose what broke. - name: Upload Test Report if: always() uses: actions/artifacts/upload@v4 with: name: functional-test-report path: playwright-report/ retention-days: 7