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 職業分類に基づく
Audit VS Code extensions against the current project stack and recommend keep/add/remove actions
Review a pull request using Lean waste categories and structured severity ratings
Configure and manage Model Context Protocol servers for external tool access
| 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.
Use Path A when the agent only needs to inspect or click through a page during a live session in VS Code. It is the cheapest option and keeps browser access local to the current conversation.
Use Path C when website navigation should become part of the repo's repeatable agent tooling. Prefer it for agents that need reliable page navigation, form automation, or structured browser actions across Copilot, MCP-aware subagents, and CLI sessions.
Do not use Path C as a replacement for committed regression tests. When the behavior needs CI coverage or long-term safety, add Path B as well.
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": [
"-y",
"@playwright/mcp@latest",
"--headless",
"--browser=chromium"
],
"disabled": true
}
}
}
Remove "disabled": true when you want the server to start. If the repo uses
agent-level mcp-servers allowlists, add playwright only to the agents that
should be allowed to drive websites.
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