name: "Run e2e Playwright" description: "Run e2e Playwright" inputs: options: description: 'Options' required: true test-runner: description: 'Test runner' required: false default: 'Playwright' artifact-name: description: Name of the artifact cache required: true suite-attempts: description: 'Maximum number of times to run the whole test suite (1 = no retry)' required: false default: '1' runs: using: "composite" steps: - name: Set PLAYWRIGHT_E2E_HOST if: inputs.url != '' shell: bash run: | # Construct the full URL with /aca path (without #/ as tests add that) if [[ "${{ inputs.url }}" != *"/aca"* ]]; then echo "PLAYWRIGHT_E2E_HOST=${{ inputs.url }}/aca" >> $GITHUB_ENV else echo "PLAYWRIGHT_E2E_HOST=${{ inputs.url }}" >> $GITHUB_ENV fi - name: Setup and run with options shell: bash env: OPTIONS: ${{ inputs.options }} PLAYWRIGHT_BROWSER: ${{ env.PLAYWRIGHT_BROWSER || 'chromium' }} SUITE_ATTEMPTS: ${{ inputs.suite-attempts }} run: | # Only start local server if using localhost if [[ "${PLAYWRIGHT_E2E_HOST}" == "http://localhost"* ]]; then npm start > /dev/null & fi printf "Waiting for the application to be ready..." while ! curl -sf ${PLAYWRIGHT_E2E_HOST} > /dev/null; do printf "." sleep 1 done printf "\nApplication is ready.\n" for attempt in $(seq 1 "${SUITE_ATTEMPTS:-1}"); do echo "Running playwright tests with options $OPTIONS on browser ${PLAYWRIGHT_BROWSER} (suite attempt $attempt/${SUITE_ATTEMPTS:-1})" # Clear any blob report from a previous attempt so only the final attempt is reported. if [ -n "${PLAYWRIGHT_BLOB_DIR:-}" ]; then rm -rf -- "${PLAYWRIGHT_BLOB_DIR}"; fi if E2E_TARGET=$OPTIONS npm run ci:e2e; then exit 0 fi if [ "$attempt" -lt "${SUITE_ATTEMPTS:-1}" ]; then echo "Suite failed, retrying the whole suite..." fi done echo "Suite failed after ${SUITE_ATTEMPTS:-1} attempt(s)." exit 1