← Recipes

阅读中文版本

Gate Deployment on a Smoke Test Suite

Run a fast post-deploy smoke suite that exercises critical paths and blocks promotion when any check fails.

~35 mintestingdeploymentops

Task

Define a minimal smoke suite that verifies the most critical user journeys after each deployment.

When to use this

A deploy looks healthy but a critical login path is broken, and the issue is found by users hours later.

Prerequisites

  • A test runner such as Playwright
  • Stable test accounts
  • A deploy pipeline you can hook

Steps

1. Write a small suite covering login, a core action, and one read path.

test('critical paths', async ({ page }) => {
  await page.goto('/login');
  await page.fill('#email', process.env.SMOKE_USER);
  await page.fill('#password', process.env.SMOKE_PASS);
  await page.click('button[type=submit]');
  await page.waitForURL('/dashboard');
});

Expected output: The suite fails fast if login or the dashboard is broken.

2. Run it against the freshly deployed environment and gate promotion.

npx playwright test smoke --reporter=line || { echo 'smoke failed, abort promotion'; exit 1; }

Expected output: A failing smoke test stops the promotion before users are affected.

Troubleshooting

Problem

Smoke suite grows too slow

Solution

Keep it under a few minutes and move deeper checks to later stages.

Problem

Flaky login due to shared data

Solution

Use dedicated test accounts and reset state per run.

Limitations

  • Smoke tests cover only critical paths, not full regression.
  • Requires stable test accounts and data.
  • Cannot catch issues in untested flows.

What this recipe does

Define a minimal smoke suite that verifies the most critical user journeys after each deployment.

A deploy looks healthy but a critical login path is broken, and the issue is found by users hours later.

Prerequisites

  • A test runner such as Playwright
  • Stable test accounts
  • A deploy pipeline you can hook

Procedure

  1. Write a small suite covering login, a core action, and one read path.
test('critical paths', async ({ page }) => {
  await page.goto('/login');
  await page.fill('#email', process.env.SMOKE_USER);
  await page.fill('#password', process.env.SMOKE_PASS);
  await page.click('button[type=submit]');
  await page.waitForURL('/dashboard');
});

Expected result: The suite fails fast if login or the dashboard is broken.

  1. Run it against the freshly deployed environment and gate promotion.
npx playwright test smoke --reporter=line || { echo 'smoke failed, abort promotion'; exit 1; }

Expected result: A failing smoke test stops the promotion before users are affected.

How to confirm it worked

Run the commands above and confirm every expected result in order. If a step does not produce the stated output, use the troubleshooting notes before continuing. A passing run shows an intentionally broken deploy aborts promotion at the smoke gate, while a healthy deploy proceeds.

Troubleshooting

Smoke suite grows too slow — Keep it under a few minutes and move deeper checks to later stages.

Flaky login due to shared data — Use dedicated test accounts and reset state per run.

Limitations

  • Smoke tests cover only critical paths, not full regression.
  • Requires stable test accounts and data.
  • Cannot catch issues in untested flows.