English | 简体中文
Run Midscene Test tests in GitHub Actions, with reports you can download or share.
- Test results in the workflow summary.
- HTML reports and test data uploaded as artifacts.
- Optional report hosting on Cloudflare Workers, with a URL for each run.
- SIWC session preparation and parallel execution, with one refresh owner and access-only test jobs.
- Basic: submit a greeting form with AI and check the result.
- TodoMVC: manage todos with AI and verify the results with custom Nodes.
- ExternalAssets: generate an
html-and-external-assetsreport with a model-free test.
Add the Action to your workflow:
- uses: web-infra-dev/midscene-action@v1
with:
working-directory: tests/midsceneBy default, the Action runs npx midscene-test. Set command to use a different test command, such as npm test.
Install your test dependencies and browsers, configure your model, and start any application under test before running the Action.
For a Playwright project in tests/midscene:
name: Midscene E2E Tests
on:
push:
workflow_dispatch:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-24.04
timeout-minutes: 20
env:
MIDSCENE_MODEL_API_KEY: ${{ secrets.MIDSCENE_MODEL_API_KEY }}
MIDSCENE_MODEL_NAME: ${{ vars.MIDSCENE_MODEL_NAME }}
MIDSCENE_MODEL_FAMILY: ${{ vars.MIDSCENE_MODEL_FAMILY }}
MIDSCENE_MODEL_BASE_URL: ${{ vars.MIDSCENE_MODEL_BASE_URL }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '24'
- name: Install dependencies and browser
working-directory: tests/midscene
run: |
npm ci
npx playwright install --with-deps chromium
- name: Run Midscene tests
id: midscene
uses: web-infra-dev/midscene-action@v1
with:
working-directory: tests/midscene
command: npm testSet the model secret and variables used above in your repository's Settings → Secrets and variables → Actions.
See action.yml for the full definitions.
| Input | Required | Default | Description |
|---|---|---|---|
working-directory |
Yes | None | Test project directory, relative to the workspace. Use . for the repository root. |
command |
No | npx midscene-test |
Command to run Midscene tests in Bash. Override it with a project script such as npm test if needed. |
artifact-name |
No | midscene-results |
Artifact name. Must be unique within a workflow run. |
retention-days |
No | 14 |
Artifact retention period in days. |
publish-pages |
No | false |
Set to true to publish reports to Cloudflare Workers. |
cloudflare-api-token |
When publishing | None | Cloudflare API token, passed from a GitHub Actions secret. |
cloudflare-account-id |
When publishing | None | Cloudflare account ID. |
cloudflare-worker-name |
No | midscene-reports |
Worker name. Created automatically if needed and the token has permission. |
Set publish-pages: true to publish reports to Cloudflare Workers. Each run gets its own Preview URL in the workflow summary.
- Free hosting: no charge for static asset storage or requests. Billing details
- Retention: up to 100 Previews per Worker on the free plan. Cloudflare removes the least recently deployed Preview when the limit is reached. Preview limits
- Limits: up to 20,000 files per Worker version and 25 MiB per file on the free plan. Platform limits
Choose the token permissions for your Worker setup:
Save the API token and Account ID from the confirmation dialog. The token is shown only once.
In Settings → Secrets and variables → Actions, add:
CLOUDFLARE_API_TOKENas a repository secret.CLOUDFLARE_ACCOUNT_IDas a repository variable.
Then enable publishing:
- name: Run tests and publish reports
id: midscene
uses: web-infra-dev/midscene-action@v1
with:
working-directory: tests/midscene
command: npm test
publish-pages: true
cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
cloudflare-account-id: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}To use an existing Worker, set cloudflare-worker-name to its name. The default is midscene-reports.
Open the workflow run's Summary for test results and artifact downloads. Published reports also have an online preview link.
Results are collected from midscene_run/ by default. Set MIDSCENE_RUN_DIR to use another artifact root. Relative paths resolve from working-directory; absolute paths are also supported. An unset or empty value uses the default.
To save results under artifacts/, set the environment variable:
- uses: web-infra-dev/midscene-action@v1
with:
working-directory: tests/midscene
env:
MIDSCENE_RUN_DIR: artifactsNote
Using MIDSCENE_RUN_DIR for test outputs requires @midscene/test > 1.17.5.
Set id: midscene on the Action step to read its outputs with ${{ steps.midscene.outputs.<name> }}:
| Output | Description |
|---|---|
test-result |
Outcome of the test command. |
report-artifact-name |
Name of the uploaded artifact, or empty if no files were uploaded. |
artifact-url |
Download page for the uploaded artifact. |
page-url |
Published report URL, or empty if publishing did not succeed. |
publication-result |
Deployment outcome: success, failure, skipped, or cancelled. |
See the Contributing Guide.
MIT.
Built with Midscene and Cloudflare Workers.



