testing

Utilisez cette compétence lors de l’exécution ou de la rédaction de tests dans le monorepo FAST — exécution locale des tests, workflows CI, fixtures Playwright et tests d’intégration WebUI.

npx skills add https://github.com/microsoft/fast --skill testing

Testing Patterns for FAST

Use this guide when running or writing tests in the FAST monorepo. FAST uses Playwright for integration testing with a Vite dev server.

Running tests

Locally

First-time setup

After cloning and installing dependencies (npm ci), install Playwright browsers:

npx playwright install --with-deps

Commands

All commands are run from the monorepo root. Use -w to target a specific package.

TaskCommand
Run all tests (all browsers)npm run test
Run all tests (Chromium only)npm run test:chromium
Test a single package (all browsers)npm run test -w @microsoft/fast-element
Test a single package (Chromium only)npm run test:chromium -w @microsoft/fast-element
Test changed packages onlynpx lage test:node test:chromium --since origin/main

Interactive / debug workflows

For FAST declarative tests in @microsoft/fast-element, these additional scripts are available:

TaskCommand
Playwright UI modenpm run test:ui:declarative -w @microsoft/fast-element
Start declarative source servernpm run test-server:declarative -w @microsoft/fast-element
Rebuild fixturesnpm run build:fixtures -w @microsoft/fast-element
Build fixtures with webuinpm run build:fixtures:webui -w @microsoft/fast-element
Run webui integration testsnpm run test:webui-integration -w @microsoft/fast-element

Playwright UI mode (test:ui) starts a visual test runner where you can select and debug individual tests, view traces, and inspect DOM snapshots.

Declarative browser workflows resolve @microsoft/fast-element package imports directly to src and let Vite transpile TypeScript on demand. Vite does not type-check these modules; the package build remains responsible for type checking, while test:exports imports every emitted package export.

Through GitHub Actions

The repository uses several CI workflows to validate changes.

PR validation (ci-validate-pr.yml)

Runs on every pull request targeting main, releases/*, or features/* branches. Tests run on Ubuntu with Chromium only for fast feedback.

Key steps:

  • Checks for change files (npm run checkchange)
  • Biome lint/format check
  • Builds affected packages (incremental with --since)
  • Runs test:node and test:chromium for affected packages

Cross-platform validation (ci-validate-platforms.yml)

Runs on pushes to main, PRs targeting main, and on a weekly schedule. Tests run on Ubuntu, Windows, and macOS with Chromium, Firefox, and Safari.

This ensures cross-platform and cross-browser compatibility.

WebUI integration testing (ci-webui-integration.yml)

A dedicated workflow for validating FAST's integration with @microsoft/webui. This workflow runs on:

  • Manual dispatch (workflow_dispatch)
  • Pushes to webui/* branches

Note: This workflow does not run on regular pull requests. It is scoped to webui/* branches to test integration changes in isolation before they land on main.

The workflow builds all packages, installs Playwright Chromium, and runs:

npm run test:webui-integration -w @microsoft/fast-element

This builds each fixture with webui build --plugin=fast, renders the protocol with the fixture's state.json, and runs the same Playwright specs against the webui-rendered output.

To trigger WebUI integration tests for your changes:

  1. Create a branch with the webui/ prefix (e.g., webui/my-integration-change).
  2. Push the branch — the workflow runs automatically.
  3. Alternatively, trigger the workflow manually from the Actions tab using workflow_dispatch.

Azure Pipelines (azure-pipelines-ci.yml)

The repository also has an Azure DevOps pipeline that runs on PRs to main. This pipeline runs in a 1ES-managed environment and includes SDL compliance checks in addition to building and testing.

Writing tests

FAST tests are Playwright integration tests that run against fixture pages served by Vite.

Test file conventions

  • Test files use the *.spec.ts suffix (specifically *.pw.spec.ts for package src/ tests).
  • Tests for developer-authored declarative markup and directives live in the matching test/declarative/fixtures/<category>/<feature>/<feature>.spec.ts fixture.
  • Tests for implementation APIs and lifecycle behavior are co-located with their source as src/<feature>/<feature>.pw.spec.ts.

Writing declarative fixture tests

Fixture tests in @microsoft/fast-element/test/declarative/fixtures are the primary way to verify declarative template features. Each fixture is a self-contained test case with its own HTML, state, templates, and component definitions.

When changing declarative syntax, directive parsing, template generation, hydration behavior, or other user-authored template behavior, add or update a declarative fixture and exercise it in browser. Source-level parser tests may supplement narrow parsing edge cases, but they should not be the only coverage for syntax that users write in entry.html or templates.html. Use the local README files under packages/fast-element/test/declarative/fixtures/ and each fixture category to choose the right fixture type and follow category-specific examples.

For a complete guide on creating fixtures — including how to write entry.html, state.json, templates.html, main.ts, and spec files — see:

📄 Writing Fixtures

Quick example

import { expect, test } from "@playwright/test";

test.describe("my-feature", async () => {
    test("renders correctly", async ({ page }) => {
        await page.goto("/fixtures/bindings/my-feature/");

        const element = page.locator("my-element");
        await expect(element).toHaveText("Hello");
    });
});

Plus de skills de microsoft

oss-growth
microsoft
Persona de growth hacker OSS
agent-framework-azure-ai-py
microsoft
Créez des agents Azure AI Foundry à l’aide du SDK Python Microsoft Agent Framework (agent-framework-azure-ai). À utiliser lors de la création d’agents persistants avec AzureAIAgentsProvider, de l’utilisation d’outils hébergés (interpréteur de code, recherche de fichiers, recherche web), de l’intégration de serveurs MCP, de la gestion de fils de conversation ou de l’implémentation de réponses en streaming. Couvre les outils de fonction, les sorties structurées et les agents multi-outils.
development
airunway-aks-setup
microsoft
Configurez AI Runway sur AKS — du cluster nu au modèle en cours d'exécution. Couvre la vérification du cluster, l'installation du contrôleur, l'évaluation GPU, la configuration du fournisseur et le premier déploiement. QUAND : « configurer AI Runway », « intégrer un cluster AKS », « installer AI Runway », « configuration airunway », « déployer un modèle sur AKS », « inférence GPU sur AKS », « configuration KAITO sur AKS », « exécuter LLM sur AKS », « vLLM sur AKS », « configurer le service de modèles sur AKS », « contrôleur AI Runway ».
devops
appinsights-instrumentation
microsoft
Conseils pour instrumenter les applications web avec Azure Application Insights. Fournit des modèles de télémétrie, la configuration du SDK et des références de configuration. QUAND : comment instrumenter une application, SDK App Insights, modèles de télémétrie, qu'est-ce qu'App Insights, conseils sur Application Insights, exemples d'instrumentation, bonnes pratiques APM.
devops
applicationinsights-web-ts
microsoft
Instrumentez les applications navigateur/web avec le SDK JavaScript Application Insights (@microsoft/applicationinsights-web). Utilisez-le pour la surveillance des utilisateurs réels (RUM) — vues de page, clics, dépendances AJAX/fetch, exceptions, événements personnalisés et traces d’agents GenAI côté navigateur corrélées aux traces OpenTelemetry backend. Couvre le script de chargement du SDK et la configuration npm, les extensions de framework (React, React Native, Angular), Click Analytics, les initialiseurs de télémétrie et les conventions sémantiques OTel GenAI pour les spans d’agents/outils/modèles émises depuis le navigateur.
devops
azure-ai-anomalydetector-java
microsoft
Créez des applications de détection d'anomalies avec le SDK Azure AI Anomaly Detector pour Java. Utilisez-le lors de l'implémentation de la détection d'anomalies univariées/multivariées, de l'analyse de séries temporelles ou de la surveillance basée sur l'IA.
development
azure-ai-language-conversations-py
microsoft
Implémentez la compréhension du langage conversationnel (CLU) à l’aide du SDK Python azure-ai-language-conversations. Utilisez-le lorsque vous travaillez avec ConversationAnalysisClient pour analyser l’intention et les entités d’une conversation, créer des fonctionnalités de NLP ou intégrer la compréhension du langage dans des applications.
development
azure-ai-ml-py
microsoft
SDK v2 d’Azure Machine Learning pour Python. Utiliser pour les espaces de travail ML, les tâches, les modèles, les jeux de données, le calcul et les pipelines. Déclencheurs : « azure-ai-ml », « MLClient », « espace de travail », « registre de modèles », « tâches d’entraînement », « jeux de données ».
development