Schedule icon
Check icon
Return icon
Switch icon
Log icon
SlackIncomingWebhook icon

Run synthetic page health checks with headless Playwright and alert on failure

Run synthetic web page health checks with headless Playwright. Validate page titles, capture screenshots, and fire Slack alerts on failure.

Categories
CoreInfrastructureinfrastructure

Diagram unavailable

We could not build the topology for this blueprint. The flow itself is valid, use the YAML on the left to run it.

Automate real end-to-end browser health monitoring directly inside Kestra using headless Playwright. While standard HTTP pingers only verify basic network connectivity, this blueprint connects to a Playwright server, renders full web pages, executes declarative title assertions, captures a page screenshot, and routes structured alerts to Slack. It provides automated synthetic testing for critical web paths without needing custom browser automation scripts or third-party SaaS services.

How it works

  1. A scheduled trigger daily_synthetic_check (io.kestra.plugin.core.trigger.Schedule, disabled by default) runs the workflow on a configured schedule or on demand.
  2. check_page_health (io.kestra.plugin.playwright.Check) connects to a remote Playwright WebSocket server (PLAYWRIGHT_SERVER_URL), sets actionTimeout: PT{{ inputs.timeout_seconds }}S, navigates to target_url, asserts that the page title matches expected_title, and captures a full-page screenshot (page_health.png). The task sets allowFailed: true so assertion or timeout failures can be evaluated downstream without crashing the execution. A page that does not finish navigation and title assertion within timeout_seconds fails the check.
  3. classify_outcome (io.kestra.plugin.core.debug.Return) evaluates the browser task output and returns a single-line outcome string (PASS or CHECK_FAILED).
  4. route_outcome (io.kestra.plugin.core.flow.Switch) routes execution based on the classified outcome:
    • On PASS, log_success (io.kestra.plugin.core.log.Log) records a success message.
    • On CHECK_FAILED, alert_check_failed (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) dispatches a plain-text JSON alert to Slack.
    • A defaults branch handles unclassified outcomes gracefully.
  5. A flow-level errors block dispatches a Slack alert if an unexpected infrastructure error occurs during flow execution.

What you get

  • Headless browser automation checking real DOM rendering and web page title health.
  • Full-page screenshots saved to Kestra internal storage ({{ outputs.check_page_health.screenshots["page_health.png"] }}).
  • Declarative Playwright assertions without writing Java or Node.js script code.
  • Automated outcome classification into exactly two states (PASS or CHECK_FAILED) with modular Switch routing.
  • Instant Slack alerts formatted with target URL, outcome, and timeout limit.

Who it's for

  • DevOps and SRE teams monitoring critical web applications and frontend landing pages.
  • QA and platform engineers needing automated synthetic probes co-located with workflow orchestration.
  • Teams looking to replace expensive third-party synthetic monitoring tools with self-hosted Playwright orchestration.

Why orchestrate this with Kestra

Standalone browser scripts lack durable state management, structured task retries, and centralized observability. Kestra turns Playwright checks into first-class observable workflows with execution history, captured artifacts, visual topology graphs, and automated Slack alerting. By combining declarative YAML actions with flow control, Kestra makes synthetic web testing reproducible, version-controlled, and observable across all environments.

Prerequisites

  • A running Kestra instance with network access to the Playwright server and target website.
  • A Playwright server instance running mcr.microsoft.com/playwright:v1.63.0-noble started with command: docker run -d --name playwright -p 3000:3000 mcr.microsoft.com/playwright:v1.63.0-noble npx -y playwright@1.63.0 run-server --port 3000 --host 0.0.0.0
  • If running Kestra via Docker Compose, connect the Playwright container to Kestra's Docker network: docker network connect YOUR_KESTRA_NETWORK playwright (Check your exact network name with: docker network ls)
  • Set PLAYWRIGHT_SERVER_URL to point to the Playwright WebSocket server (e.g. ws://playwright:3000).

Secrets

  • PLAYWRIGHT_SERVER_URL: ws:// or wss:// endpoint of the Playwright WebSocket server (e.g. ws://playwright:3000).
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL for alerting.

Note for Open Source Edition (OSS): Secrets can be set as base64-encoded environment variables on the Kestra worker: export SECRET_PLAYWRIGHT_SERVER_URL=$(echo -n "ws://playwright:3000" | base64) export SECRET_SLACK_WEBHOOK_URL=$(echo -n "https://hooks.slack.com/services/YOUR/WEBHOOK/URL" | base64)

Inputs

  • target_url (STRING, default https://example.com): Target URL to probe.
  • expected_title (STRING, default Example Domain): Expected page title.
  • timeout_seconds (SELECT, default "10", options: "5", "10", "30"): Maximum time in seconds allowed for page navigation and title assertion.

Outputs

  • {{ outputs.check_page_health.screenshots["page_health.png"] }}: URI of the full-page screenshot stored in Kestra internal storage.
  • {{ outputs.classify_outcome.value }}: Classified health outcome string (PASS or CHECK_FAILED).

Quick start

  1. Configure PLAYWRIGHT_SERVER_URL and SLACK_WEBHOOK_URL in Kestra secrets.
  2. Import this blueprint into your namespace (e.g. company.team).
  3. Run the flow manually with target_url: https://example.com and expected_title: Example Domain to verify a successful check.
  4. Test the failure alert branch by running with expected_title: NonExistentTitle.
  5. Enable the daily_synthetic_check trigger for automated recurring monitoring.

How to extend

  • Add authentication steps using FILL and CLICK actions prior to page title assertion.
  • Add multiple ASSERT_VISIBLE and ASSERT_TEXT actions to validate complex UI components.
  • Save additional screenshots per navigation step by adding SCREENSHOT actions.
  • Store probe execution outcomes into PostgreSQL or ClickHouse for long-term SLA reporting.

Links

Pitfalls

  • Playwright headless browser checks require sufficient memory allocated to the Playwright container.
  • Target pages behind complex multi-factor authentication (MFA) or CAPTCHA cannot be probed automatically.
  • Page load and navigation times depend on network latency to the target server; pages exceeding timeout_seconds fail the check.
  • This flow performs synthetic DOM and title verification; it does not perform visual pixel regression comparison.
  • The default target URL (https://example.com) is a third-party domain used for demonstration purposes.
See How

New to Kestra?

Use blueprints to kickstart your first workflows.