diff --git a/.github/workflows/smoke-ui.yml b/.github/workflows/smoke-ui.yml new file mode 100644 index 0000000..c27cfd1 --- /dev/null +++ b/.github/workflows/smoke-ui.yml @@ -0,0 +1,51 @@ +name: UI Smoke Tests (Playwright) + +# Запускается автоматически после каждого успешного деплоя GitHub Pages. +# Можно запустить вручную: Actions → UI Smoke Tests → Run workflow +on: + workflow_run: + workflows: ["Deploy MiniApp to GitHub Pages"] + types: [completed] + workflow_dispatch: + inputs: + url: + description: "URL для тестирования (пусто = https://wasrusgen.github.io/zov-tech/)" + required: false + default: "" + +jobs: + smoke-ui: + name: UI Smoke (Playwright) + runs-on: ubuntu-latest + + # При автозапуске — только если деплой прошёл успешно + if: > + github.event_name == 'workflow_dispatch' || + github.event.workflow_run.conclusion == 'success' + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + + - name: Установка зависимостей + run: npm ci + + - name: Установка Playwright (Chromium) + run: npx playwright install chromium --with-deps + + - name: Запуск UI smoke-теста + env: + SMOKE_URL: ${{ inputs.url || 'https://wasrusgen.github.io/zov-tech/' }} + run: node tests/ui_smoke.js + + - name: Загрузить скриншот при провале + if: failure() + uses: actions/upload-artifact@v4 + with: + name: smoke-screenshot + path: tests/ui_last_run.png + retention-days: 7