Skip to content

feat(test): add legacy YAML migration command - #3087

Open
xiong35 wants to merge 1 commit into
mainfrom
feat/test-runner-yaml-migration
Open

feat(test): add legacy YAML migration command#3087
xiong35 wants to merge 1 commit into
mainfrom
feat/test-runner-yaml-migration

Conversation

@xiong35

@xiong35 xiong35 commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add a migration command for converting legacy Midscene Web YAML suites into the new @midscene/test project format.

midscene-test migrate <legacy-yaml-or-directory> \
  --output-dir <new-test-project>

What changed

  • Add the migrate CLI command.
  • Generate:
    • midscene.config.ts
    • cases/*.yaml
    • MIGRATION.md
  • Convert supported legacy actions:
    • ai / aiAction / aiActaiAct
    • aiAssertaiAssert
    • sleepwait
    • recordToReport / logScreenshotrecordToReport
  • Migrate Web target settings, concurrency, retry, bail, Agent options, and environment references.
  • Handle generated Project-name and filename collisions.
  • Preserve legacy step environment-variable fallback behavior.
  • Add atomic output generation:
    • legacy source files are never modified
    • existing output directories are never overwritten
    • no partial output is retained when migration fails
  • Report field-level blocking errors for behavior that cannot be migrated losslessly.
  • Emit migration warnings both in the CLI and generated MIGRATION.md.
  • Add migration documentation and CLI/unit test coverage.

Compatibility and limitations

The automatic path currently targets legacy Web YAML.

Unsupported or semantically different behavior fails closed and requires manual migration, including:

  • custom legacy actions such as javascript, query/wait/input actions, or Gherkin steps
  • setup / serve
  • shared browser context
  • cookie and download handling
  • Bridge/CDP configuration
  • non-Web platforms
  • typed environment references whose YAML parsing semantics cannot be preserved
  • keepWindow and unsafe continueOnError combinations

These cases should be implemented with defineProjectSetup, Playwright, or custom Test Runner Nodes after generating the supported portion.

describe-nodes remains an optional documentation and configuration-inspection command; it does not affect test execution.

Validation

  • pnpm run lint
  • pnpm exec nx test @midscene/test
    • 21 test files passed
    • 191 tests passed
  • pnpm --filter @midscene/test build

Additional demo validation covered 45 migration scenarios:

  • 10 expected successful migrations
  • 35 expected atomic rejections
  • 0 unexpected results

Real Chromium validation also passed for environment-variable compatibility and manually migrated lifecycle/custom-node scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant