webapp-testing
Set up browser testing — dual path with built-in browser tools (interactive) or Playwright (CI); detect framework, scaffold, verify
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Set up browser testing — dual path with built-in browser tools (interactive) or Playwright (CI); detect framework, scaffold, verify
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Set up and manage GitHub Actions workflows that use Copilot coding agents for automated PR handling and issue resolution
Inspect active GitHub Actions workflows before commit or push, run matching local checks for staged or unpushed files, ask which missing tools to install via askQuestions, and fix in-scope issues so the Commit agent can proceed.
Write a commit message following the Conventional Commits specification with scope and body
Create an Architectural Decision Record (ADR) to document a significant design or technology choice
Audit VS Code extensions against the current project stack and recommend keep/add/remove actions
Diagnose and fix a failing CI pipeline or GitHub Actions workflow
| name | webapp-testing |
| description | Set up browser testing — dual path with built-in browser tools (interactive) or Playwright (CI); detect framework, scaffold, verify |
| compatibility | >=2.0 |
Skill metadata: version "2.1"; license MIT; tags [testing, e2e, playwright, browser, ci, browser-tools, mcp]; compatibility ">=2.0"; recommended tools [codebase, editFiles, runCommands].
Set up browser testing for a web application. This skill offers three paths:
| Factor | Path A (Browser tools) | Path B (Playwright) | Path C (Playwright MCP) |
|---|---|---|---|
| Setup effort | Zero — built-in, no install | Moderate — install + configure | Low — add MCP server config |
| CI integration | No — interactive only | Yes — runs headless in CI | No — agent-driven only |
| Test persistence | No — conversational | Yes — test files committed to repo | No — on-demand via MCP tools |
| Browser coverage | Chromium only | Chromium + Firefox + WebKit | Chromium (default) |
| Best for | Quick verification, dev-time checks, debugging | Regression testing, PR gates, cross-browser | Agent-driven automation, scraping, form testing |
| Requires | workbench.browser.enableChatTools: true (Preview) | Node.js + Playwright package | @playwright/mcp package |
Recommendation: Use Path A for interactive verification during development, Path B for CI, Path C when you want Playwright browser control available as MCP tools to agents. They complement each other.
test-coverage-review skill identifies missing e2e coverageVS Code 1.110+ provides 10 agentic browser tools that allow Copilot to interact with web pages directly. These tools are experimental and require opt-in.
The user must enable the setting:
{
"workbench.browser.enableChatTools": true
}
Note: This is a Preview feature. It may change or be removed in future VS Code releases.
| Tool | Purpose |
|---|---|
openBrowserPage | Open a URL in a managed browser |
navigatePage | Navigate to a new URL |
readPage | Read page content (text, links, forms, structure) |
screenshotPage | Capture a screenshot for visual verification |
clickElement | Click a button, link, or interactive element |
hoverElement | Hover over an element |
dragElement | Drag and drop an element |
typeInPage | Type text into input fields |
handleDialog | Accept or dismiss browser dialogs |
runPlaywrightCode | Run custom Playwright code snippets in the browser context |
openBrowserPage to open the app URLreadPage to verify page content loads correctlyscreenshotPage for visual verificationclickElement / typeInPage to interact with forms, navigationreadPage after interactions to verify state changesUser: "Check if my login page works"
Agent:
1. openBrowserPage("http://localhost:3000/login")
2. readPage() → verify login form elements exist
3. typeInPage(selector: "#email", text: "test@example.com")
4. typeInPage(selector: "#password", text: "testpass")
5. clickElement(selector: "button[type=submit]")
6. readPage() → verify redirect or error message
7. screenshotPage() → capture visual state
Scan the project for framework signals:
| Signal | Framework | Dev server command |
|---|---|---|
next.config.*, "next" in deps | Next.js | npx next dev |
vite.config.*, "vite" in deps | Vite (React/Vue/Svelte) | npx vite |
nuxt.config.*, "nuxt" in deps | Nuxt | npx nuxt dev |
angular.json, "@angular/core" in deps | Angular | npx ng serve |
svelte.config.*, "@sveltejs/kit" in deps | SvelteKit | npx vite dev |
remix.config.*, "@remix-run/dev" in deps | Remix | npx remix dev |
astro.config.*, "astro" in deps | Astro | npx astro dev |
Also check package.json scripts for "dev", "start", or "serve" commands.
If no framework is detected, ask the user how to start the development server.
npm init playwright@latest -- --quiet
This creates:
playwright.config.ts — configuration filetests/ — test directorytests-examples/ — example tests (can be deleted)If the user prefers a different package manager:
# pnpm
pnpm create playwright --quiet
# yarn
yarn create playwright --quiet
# bun
bunx create-playwright --quiet
Update playwright.config.ts for the detected framework:
import { defineConfig, devices } from "@playwright/test";
export default defineConfig({
testDir: "./tests/e2e",
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: process.env.CI ? "github" : "html",
use: {
baseURL: "http://localhost:<PORT>",
trace: "on-first-retry",
screenshot: "only-on-failure",
},
projects: [
{ name: "chromium", use: { ...devices["Desktop Chrome"] } },
{ name: "firefox", use: { ...devices["Desktop Firefox"] } },
{ name: "webkit", use: { ...devices["Desktop Safari"] } },
],
webServer: {
command: "<DEV_SERVER_COMMAND>",
url: "http://localhost:<PORT>",
reuseExistingServer: !process.env.CI,
timeout: 120_000,
},
});
Replace <PORT> and <DEV_SERVER_COMMAND> with the detected values.
Create tests/e2e/smoke.spec.ts — a smoke test that verifies the app loads:
import { test, expect } from "@playwright/test";
test("home page loads successfully", async ({ page }) => {
await page.goto("/");
await expect(page).toHaveTitle(/.+/);
// Verify the page is not an error page
await expect(page.locator("body")).not.toContainText("500");
await expect(page.locator("body")).not.toContainText("Internal Server Error");
});
test("navigation is functional", async ({ page }) => {
await page.goto("/");
// Verify at least one link or navigation element exists
const links = page.locator("a[href]");
await expect(links.first()).toBeVisible();
});
If the project has a login page, authentication flow, or other critical paths identified in Step 1, write targeted tests for those too.
npx playwright test
Expected output:
npx playwright show-report)If tests fail:
baseURL matches the actual dev server portCreate .github/workflows/playwright.yml:
name: Playwright Tests
on:
push:
branches: [main]
pull_request:
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
Add to .gitignore:
# Playwright
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
Add convenience scripts to package.json:
{
"scripts": {
"test:e2e": "playwright test",
"test:e2e:ui": "playwright test --ui",
"test:e2e:report": "playwright show-report"
}
}
The @playwright/mcp package exposes Playwright browser automation as MCP tools, allowing agents to navigate pages, take screenshots, click elements, fill forms, and execute JavaScript — all through the MCP protocol.
Add to .vscode/mcp.json:
{
"servers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}
The server exposes tools including: browser_navigate, browser_screenshot, browser_click, browser_type, browser_select_option, browser_hover, browser_evaluate, browser_handle_dialog, browser_tab_list, browser_tab_create, browser_tab_close, browser_pdf_save, browser_console_messages.
workbench.browser.enableChatTools is enabled when using built-in toolsnpx playwright test passes on at least Chromiumactionlint .github/workflows/playwright.yml).gitignore excludes Playwright artifactspackage.json has test:e2e script@playwright/mcp entry exists in .vscode/mcp.jsonbrowser_navigate tool is available after server starts