Vscuse scenario authoring

From OfficeDev/microsoft-365-agents-toolkit · View interactive version

Vscuse scenario authoring is an AI agent skill from the GitHub repository OfficeDev/microsoft-365-agents-toolkit. Use when: reading a docs scenario, PRD, mockup, or user flow and using vscuse-ui/noVNC as the primary authoring surface to record, generate, replace, or update vscuse test plans; decide existing coverage vs new case; validate product behavior against docs, then finish with vscuse CLI validation.

How to use this skill

Skill file

vscuse Scenario Authoring

Goal

Use docs, PRDs, scenarios, or mockups as the source of truth for vscuse coverage. Use vscuse-ui and noVNC as the primary authoring surface: execute the scenario in a real vscuse desktop, decide whether product behavior matches the docs, and then update existing test coverage or generate a new plan. Use vscuse execute afterward as the final CI-parity validation.

This workflow is for authoring or refreshing vscuse coverage. For diagnosing an already-failing case, use vscuse-case-diagnosis.

Required Inputs

Core Rules

Procedure

1. Extract the Scenario From Docs

Read the docs/mockup and write down the testable contract:

If the docs are ambiguous, ask for the intended scenario rather than inventing hidden product behavior.

2. Map Existing Coverage

Search existing vscuse assets under packages/tests/vscuse/vscode-test-cases for:

Decision rules:

2a. Define Independently Executable Cases

Map one approved product scenario to one or more validation cases. For a newly authored or materially refreshed case, record this authoring contract in existing plan_metadata.tags where a tag convention already exists and in the final authoring report for the remaining dimensions. Do not invent unsupported plan JSON fields. The contract includes:

Use these automation levels consistently:

Account requirements belong to the execution target. For example, local debug of a DA in Copilot requires an M365 account; do not infer account_profile:none from the word "local." An Entra SSO create case may stop at the generated admin handoff, while a separate scheduled integration uses a managed tenant fixture.

Source-of-Truth Override: DA Create With MCP Server

For SCN-DA-CREATE-WITH-MCP-SERVER, resolve the requested contract from Scenario ID, Status, and Proposal key; do not infer lifecycle from a directory name. The current dynamic-tool-discovery contract is docs/01-product/scenarios/da/create-da-with-mcp-server.md. With TEAMSFX_MCP_FOR_DA_DT=true, the create-flow case must not continue the legacy fetch-tools/static operation selection path:

3. Start vscuse-ui

From the repository root:

.\set-azure-env.ps1 -Env atk06
$env:TEMPLATE_VERSION = "local"
$env:VSCUSE_VSCODE_IMAGE = "vscuse-atk-local:latest"

$dockerCliDir = "C:\Program Files\Docker\Docker\resources\bin"
if (Test-Path (Join-Path $dockerCliDir "docker.exe")) {
   $env:PATH = "$dockerCliDir;$env:PATH"
}

# Apply scenario-specific flags from the docs before starting vscuse-ui.
$env:TEAMSFX_MCP_FOR_DA_DT = "true"
$env:TEAMSFX_MCP_FOR_DA_DCR = "true"

Push-Location packages/tests/vscuse/vscode-test-cases
$vscuseUi = Join-Path $env:APPDATA "Python\Python312\Scripts\vscuse-ui.exe"
& $vscuseUi --config-file .\config.yaml --project-path .\plans
Pop-Location

Replace the sample flag names with the docs scenario's actual flags. If a generated or updated plan depends on these flags, add matching metadata tags to the plan before review:

"tags": [
   "feature_flag:TEAMSFX_MCP_FOR_DA_DT=true",
   "feature_flag:TEAMSFX_MCP_FOR_DA_DCR=true"
]

If the flags or TEMPLATE_VERSION=local do not reach the VS Code container with the config used for recording, use a temporary vscuse config that injects only those scenario flags and local template routing under docker.environment before starting vscuse-ui. Do not classify docs/product behavior until the container env confirms the expected template version and flags.

Expected services:

Web UI / API:  http://127.0.0.1:6082
noVNC Viewer:  http://127.0.0.1:6080
Docker API:    http://127.0.0.1:6081

4. Execute the Docs Scenario in the Integrated Browser

Open http://localhost:6080/vnc.html in the integrated browser, connect, and perform the docs scenario in the real container desktop.

At each important state, compare the live UI against the docs/mockup:

5. Record, Edit, or Update Coverage in vscuse-ui

Use the UI workflow first when available. Do not hand-edit JSON first when the change is visual, order-dependent, or easier to observe in the live desktop.

  1. Load the existing plan or create a new recording.
  2. Use Run, Continue, or Next to reach the relevant state when an existing plan is close.
  3. Start recording before the scenario segment that changed, or add/edit a step manually in the UI when that is clearer.
  4. Perform the real interaction in noVNC.
  5. Stop recording.
  6. Generate executable steps or a draft plan.
  7. Merge only the useful steps into the target plan/group.
  8. Preserve or add the feature_flag:* plan tags that make the recording reproducible.

Use direct JSON edits only for changes that are easier to review as text, such as variable names, metadata tags, descriptions, or removing clearly exploratory generated files. After direct edits, reload the plan in vscuse-ui before relying on the UI state.

When cleaning recorded interactions:

For API-driven recording, the verified endpoints are:

POST /api/recording/start
POST /api/recording/stop/{recording_id}
POST /api/recording/{recording_id}/executable_plan
POST /api/recording/{recording_id}/extract_steps

6. Clean Generated Content

Before considering any generated plan reviewable:

7. Validate the Authored Plan

Parse changed JSON:

Get-Content packages/tests/vscuse/vscode-test-cases/plans/<plan-name>.json -Raw | ConvertFrom-Json | Out-Null

Then run the focused case with the complete repository-root artifact command under Execute a Local Test Plan in local-vscuse-validation. This final run is required even if the flow looked correct in vscuse-ui, because the CLI starts from a clean container and matches CI behavior. Confirm its unique run directory contains both run.log and test_report.html.

Final coverage is valid only after this executable run passes or after any failure is classified and reported.

Final Report

Report:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.