跳到正文
FunCoding

test-production

Runs bin/test-production.ps1 to acceptance-test a production (or prerelease) release of browser4-cli. Use when asked to run production tests, acceptance-test a release, or verify the published CLI.

Star
1,192
许可证
Apache-2.0
最近提交
2026年12月1日

coworker/skills/test-production/SKILL.md

在 GitHub 上查看

Test Production

Runs bin/test-production.ps1 — an acceptance test that simulates a real end user's journey with the published browser4-cli release. It downloads, installs, exercises, uninstalls, and re-installs the global CLI from the public OSS distribution channel.

This is a separate entrypoint from bin/test.ps1 (covered by the run-tests skill). test-production.ps1 tests the released artifact — not the in-repo source — and is designed to be run in CI or locally before tagging a release.

When to Use

  • "run production tests"
  • "run the production acceptance test"
  • "acceptance-test the latest release"
  • "test the published CLI"
  • "verify the release before tagging"
  • "test a prerelease candidate"
  • "run production acceptance with stress"

Safe Default

Running with no arguments prints a generated help page (options, examples, exit codes) and exits 0 — an accidental invocation never installs, uninstalls, or starts anything:

./bin/test-production.ps1           # help page
./bin/test-production.ps1 -Help      # same, explicitly
./bin/test-production.ps1 -Examples  # only the copy-paste-ready examples

To actually run the acceptance test, pass -Run (or any other option):

./bin/test-production.ps1 -Run

The help page is generated from the comment-based help block at the end of the script, so it always matches the parameter list, and it reports parameters that lack a .PARAMETER description or an .EXAMPLE.

Options

FlagDescription
-RunRun with all defaults (latest stable release, random temp working directory, no stress suite)
-WorkingDir <path>Working directory for temporary artifacts (default: random subdir under system temp)
-StressEnable the multi-scenario stress suite (opt-in)
-MultiScenariosIterations <n>Iterations for the multi-scenario suite (default: 1, only with -Stress)
-RemoveWorkingDirDelete the working directory on exit (default: preserved for review)
-Version <tag>Test a specific release version (e.g. v4.12.0-rc.1, v4.11.0). Default: latest stable
-HelpPrint the help page and exit 0
-ExamplesPrint only the examples and exit 0

What It Tests

  1. Release status report — queries GitHub Releases, npm registry, Aliyun OSS CDN, and custom mirrors to verify all distribution channels are reachable.
  2. Pre-clean — removes any existing global browser4-cli installation.
  3. Cycle 1 — Clean-room install (no pre-existing config):
    • Installs the CLI via the remote bootstrap script (unmodified — no patches).
    • Verifies the CLI is on PATH after install.
    • Smoke-tests: --help, --version, config --help, agent-run --help, invalid command.
    • Cold-starts the browser server (open), verifies health endpoint responds.
    • Shuts down the server (close-all, kill-all), verifies it's unreachable.
    • Uninstalls and verifies runtime data is removed.
  4. Cycle 2 — Re-install with config + timing:
    • Copies config (LLM keys, etc.) from the user's real ~/.browser4 into the test sandbox.
    • Repeats the install→exercise→uninstall cycle.
    • Measures warm-start latency vs cold-start.
  5. (With -Stress) Multi-scenarios stress test — runs browser4-tests/tests-production/multi-scenarios.ps1 against the global CLI.

Key Principle

The script acts like a real end user — it does not patch install scripts, create missing symlinks, or manually clean up after uninstall. If any of those are needed, the test fails because a real user would hit the same broken behavior.

Isolation

The test uses environment variables (BROWSER4_CLI_STATE_DIR, BROWSER4_RUNTIME_DIR) to route all state and runtime data into an isolated working directory. The user's real ~/.browser4 is never modified — it is only read to copy config into the test sandbox during Cycle 2.

Usage

Examples

# Show help (no arguments = safe default; -Help makes it explicit)
./bin/test-production.ps1 -Help

# Run the full acceptance test with all defaults (no stress suite)
./bin/test-production.ps1 -Run

# Run with the stress suite
./bin/test-production.ps1 -Stress

# Production CI: stress test with multiple iterations, clean up afterward
./bin/test-production.ps1 -Stress -MultiScenariosIterations 3 -RemoveWorkingDir

# Test a specific prerelease candidate
./bin/test-production.ps1 -Version v4.12.0-rc.1 -Stress

# Test a specific stable release
./bin/test-production.ps1 -Version v4.11.0

# Use a specific working directory (kept for review by default)
./bin/test-production.ps1 -WorkingDir /tmp/my-acceptance-test

Typical CI invocation

# Full acceptance gate for a release
./bin/test-production.ps1 -Stress -MultiScenariosIterations 3 -RemoveWorkingDir

Exit Codes

CodeMeaning
0All steps passed (or the help page / examples were printed)
1One or more steps failed (the failing steps are listed in the results table)

Working Directory

By default, a random subdirectory is created under the system temp directory (e.g. /tmp/.browser4-acceptance/20260720-143052-a3f2). The directory is preserved after the test for review unless -RemoveWorkingDir is passed.

Relationship to Other Skills

  • run-tests — covers bin/test.ps1 for in-repo unit, integration, E2E, CLI, and PowerShell tests. Use that skill for development-time testing.
  • test-production (this skill) — covers bin/test-production.ps1 for release-time acceptance testing of the published artifact.

相似的 Skill

reverse-engineer-anything

MOmorluto/rea485k近 7 天新增 7,690 个 star

reverse-engineer-anything

MOmorluto/rea485k近 7 天新增 7,690 个 star

test-driven-development

OBobra/superpowers331k近 7 天新增 5,030 个 star

agent-runtime-gateway-smoke-test

AFaffaan-m/ECC314k近 7 天新增 3,503 个 star

ai-regression-testing

AFaffaan-m/ECC314k近 7 天新增 3,503 个 star

精选

accessibility

审计 Web、iOS、Android 的无障碍合规,支持键盘导航与屏幕阅读器。

AFaffaan-m/ECC314k近 7 天新增 3,503 个 star