name: E2E Tests # This repo holds ONLY the automated test suite - it has no application code # and nothing to build or deploy. So unlike the app repo (where the workflow # derived ENV from github.ref_name), the environment under test is an explicit # input here: this repo's `main` branch tests whichever deployment you point # it at, not "the deployment matching this branch". on: workflow_dispatch: inputs: environment: description: 'Environment to test' required: true default: 'develop' type: choice options: - develop - staging - main schedule: # Nightly regression run against develop (02:00 UTC = 05:00 UTC+3). - cron: '0 2 * * *' push: branches: [main] pull_request: branches: [main] jobs: test: runs-on: ubuntu-latest timeout-minutes: 45 steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 18 cache: npm - run: npm ci - run: npx playwright install --with-deps chromium - name: Determine environment id: env run: | if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then ENV="${{ github.event.inputs.environment }}" else # Scheduled runs and pushes/PRs to this repo's main always # exercise develop - the test suite's own default target. ENV="develop" fi echo "ENVIRONMENT=$ENV" >> $GITHUB_OUTPUT echo "Testing on: $ENV" # Credential selection per environment (dev/staging/production) is # resolved centrally in tests/helpers/environment.ts, not here - all # secrets are just passed through and the code picks the right pair # based on ENV. This also means ENV=main correctly maps to production # credentials/URL. - run: npx playwright test --project=chromium --workers=1 env: ENV: ${{ steps.env.outputs.ENVIRONMENT }} DEV_URL: ${{ secrets.DEV_URL }} DEV_USERNAME: ${{ secrets.DEV_USERNAME }} DEV_PASSWORD: ${{ secrets.DEV_PASSWORD }} TEST_USERNAME: ${{ secrets.TEST_USERNAME }} TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }} STAGING_TEST_USERNAME: ${{ secrets.STAGING_TEST_USERNAME }} STAGING_TEST_PASSWORD: ${{ secrets.STAGING_TEST_PASSWORD }} PROD_TEST_USERNAME: ${{ secrets.PROD_TEST_USERNAME }} PROD_TEST_PASSWORD: ${{ secrets.PROD_TEST_PASSWORD }} # Reports are the whole point of a dedicated test repo, so keep them # as artifacts instead of deleting them the way the app repo did. - name: Upload Playwright report if: always() uses: actions/upload-artifact@v3 with: name: playwright-report-${{ steps.env.outputs.ENVIRONMENT }} path: playwright-report/ retention-days: 14 - name: Upload Allure results if: always() uses: actions/upload-artifact@v3 with: name: allure-results-${{ steps.env.outputs.ENVIRONMENT }} path: allure-results/ retention-days: 14