Cloudflare Pages E2E tests

Run Monito browser tests against Cloudflare Pages preview and production deploys from GitHub Actions, using the deployment URL Wrangler returns.

Deployments · Checked 2026-11-18

Deploy to Cloudflare Pages from GitHub Actions, take the deployment URL Wrangler returns, and run your saved tests against it. The Monito CLI path works today; our team has not run this config on Cloudflare Pages.

How it works

  1. A GitHub Actions job deploys with cloudflare/wrangler-action@v4 and pages deploy. The wrangler-action README says a push to a non-production branch deploys as a preview. The action exposes the deployment URL as the deployment-url output.
  2. The next step authenticates with MONITO_TOKEN and runs the project's saved tests against that URL with --base-url.
  3. The CLI waits and exits nonzero for failed or errored tests, failing the job. Inspect browser evidence in Monito's run report.

Set it up

Pro or Team to create the API key used as MONITO_TOKEN. Browser runs use your credits. Plan details

  1. Create a Monito API key on Pro or Team. Store it as the GitHub Actions secret MONITO_TOKEN. Store the project ID as the GitHub Actions secret MONITO_PROJECT_ID.
  2. Store CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID as GitHub Actions secrets. The wrangler-action README passes those secrets as apiToken and accountId.
  3. Add the workflow below. It checks out the repository, deploys with pages deploy, then runs the saved tests.
  4. If a failed job should block merges, select Require status checks to pass before merging on the branch protection rule and choose the check this job reports.
.github/workflows/monito-cloudflare-pages.yml · yaml
name: Monito Cloudflare Pages
on:
  push:
permissions:
  contents: read
jobs:
  monito:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    env:
      MONITO_TOKEN: ${{ secrets.MONITO_TOKEN }}
      MONITO_PROJECT_ID: ${{ secrets.MONITO_PROJECT_ID }}
    steps:
      - uses: actions/checkout@v6
      - name: Deploy
        id: deploy
        uses: cloudflare/wrangler-action@v4
        with:
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          command: pages deploy dist --project-name=example
      - uses: actions/setup-node@v6
        with:
          node-version: 24
      - name: Run saved tests
        env:
          DEPLOY_URL: ${{ steps.deploy.outputs.deployment-url }}
        run: |
          test -n "$DEPLOY_URL" || { echo "DEPLOY_URL is empty"; exit 1; }
          npx -y @monitodev/cli@4 project run "$MONITO_PROJECT_ID" --wait --base-url "$DEPLOY_URL"

Example our team has not run on Cloudflare Pages. Replace dist with the built output directory and example with the Pages project name. cloudflare/wrangler-action@v4 is the major version in the wrangler-action README on 2026-11-18. That README documents deployment-url as the deployment URL and pages-deployment-alias-url as the alias. The guard fails the job when deployment-url is empty so the CLI cannot silently test the project's default environment. actions/setup-node uses Node 24. actions/checkout is the checkout step from that README.

Hosting on Vercel instead?

Hosting on Vercel instead? Vercel preview deployments can use the native webhook or a GitHub deployment_status workflow. That setup is separate from this Pages workflow.

Using Netlify?

Using Netlify? Deploy Previews use a different host. The Netlify page passes that URL from GitHub Actions or a deploySucceeded function.

Using GitHub Actions without deploying?

The GitHub Actions page runs saved tests with an OIDC binding and does not deploy your branch. Use it when the URL is already stable. This page deploys with Wrangler first, then passes deployment-url.

Cloudflare sources

Cloudflare and GitHub behavior on this page was checked against the following docs on 2026-11-18. The wrangler-action README that day documents cloudflare/wrangler-action@v4, and the action defaults to Wrangler v4. The benchmark reports below do not validate this workflow. Our team has not run this config on Cloudflare Pages.

Example result

Example result: field names from the CLI, values illustrative

Selected fields from project run --wait --json. Each runs entry has its own id, status and sessionId. Add --json to read the full result. Open /session/<sessionId> on Monito, or follow the run report from the dashboard or GitHub summary to inspect browser evidence.

Illustrative result · JSON
{
  "runs": [
    {
      "id": "run_example",
      "scenarioId": "scenario_example",
      "status": "failed",
      "sessionId": "session_example"
    }
  ]
}

Limits to account for

Cloudflare's preview deployments page gives a preview a unique hash-based address and a branch alias that maps to the latest commit on that branch. Branch aliases are lowercased, and non-alphanumeric characters are replaced with a hyphen. Custom domains and the production pages.dev host are not affected by preview deployments. Direct Upload documents production at <PROJECT_NAME>.pages.dev and a branch alias at <BRANCH_NAME>.<PROJECT_NAME>.pages.dev. The wrangler-action README documents deployment-url as the URL of the deployment. Its example is https://<your_pages_site>.pages.dev. It documents pages-deployment-alias-url as the alias, available since Wrangler v3.78.0, and its example for a branch other than main is https://new-feature.<your_pages_site>.pages.dev. This workflow reads deployment-url. The README says a push to a non-production branch deploys as a preview deployment.

Cloudflare Access can protect preview deployments. Those URLs are public by default. Enabling the access policy requires visitors to authenticate to view preview deployments and restricts viewing project deployments to your Cloudflare account. You can then allow other members of your team, your organization, or anyone else you specify via Access policies. The documented policy protects preview deployment URLs, for example a randomly generated preview link, and does not protect the *.pages.dev domain or a custom domain. This page has no bypass. The docs require authentication before a visitor can view that preview, so a browser that has not authenticated is not viewing the app.

With the exception of GITHUB_TOKEN, secrets are not passed to the runner when a workflow is triggered from a forked repository. This example stores MONITO_TOKEN, MONITO_PROJECT_ID, CLOUDFLARE_API_TOKEN, and CLOUDFLARE_ACCOUNT_ID as secrets, so a fork trigger cannot deploy or run the check.

A base-URL override preserves scenario paths and saved-login origin restrictions. It does not authorize credentials on a new preview origin.

Comparable benchmark runs

Our team published these runs in the reliability benchmark. They show comparable browser journeys, not executions of the configuration or illustrative result above. Run your own scenario before relying on this integration.

Benchmark method and limits

Questions

Is there a Monito Cloudflare app?

No. Monito does not publish a Cloudflare app. This page runs the Monito CLI with npx after the deploy step.

Which plan do I need?

Pro or Team. Creating the API key used as MONITO_TOKEN requires Pro ($79/mo) or Team ($199/mo). Browser runs use credits.

Can it test preview deployments?

Yes. Pass the preview deployment URL with --base-url. The override preserves scenario paths and saved-login origin restrictions. It does not authorize credentials on a new preview origin.

Read the full guide