cmd/sgai/skel/.sgai/skills/browser-bug-testing-workflow/SKILL.md
You must use this skill when debugging web UI bugs or testing interactive components that require multi-step browser interactions. Automates common UI testing patterns for debugging web applications - starting servers, navigating to pages, interacting with form elements, and verifying expected behaviors without manual step-by-step Playwright commands
npx skillsauth add sandgardenhq/sgai browser-bug-testing-workflowInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill provides a structured workflow for automated browser testing during UI bug investigation. It combines tmux session management for server processes with Playwright browser automation to create reproducible testing scenarios without manual intervention.
Use when:
Especially useful for:
| Step | Action | Example |
|------|--------|---------|
| Start Server | tmux new-session -d -s server "npm run dev" | tmux new-session -d -s webapp "python -m http.server 8000" |
| Navigate | playwright_browser_navigate | playwright_browser_navigate "http://localhost:8000" |
| Interact | playwright_browser_click/type/select | playwright_browser_click "checkbox" "ref" |
| Wait | playwright_browser_wait_for | playwright_browser_wait_for text="Loading complete" |
| Verify | playwright_browser_snapshot | playwright_browser_snapshot |
| Capture | playwright_browser_take_screenshot | playwright_browser_take_screenshot |
REQUIRED SUB-SKILL: Use skills:run-long-running-processes-in-tmux
# Start development server in detached tmux session
tmux new-session -d -s webserver "npm run dev"
# Verify server is running
tmux capture-pane -t webserver -S - -p | grep "Server running"
# Wait for server to be ready
sleep 3
// Navigate to the application
await playwright_browser_navigate("http://localhost:3000");
// Wait for page to load
await playwright_browser_wait_for(time: 2);
// Take initial snapshot for baseline
await playwright_browser_snapshot();
// Find and click checkbox
await playwright_browser_click("auto mode checkbox", "checkbox-ref");
// Verify state change
await playwright_browser_wait_for(text="Auto mode enabled");
// Click action button that depends on checkbox
await playwright_browser_click("start button", "start-ref");
// Fill form fields
await playwright_browser_fill_form({
fields: [
{ name: "username", type: "textbox", ref: "user-input", value: "testuser" },
{ name: "email", type: "textbox", ref: "email-input", value: "[email protected]" },
{ name: "remember", type: "checkbox", ref: "remember-check", value: true }
]
});
// Submit form
await playwright_browser_click("submit button", "submit-ref");
// Select dropdown option
await playwright_browser_select_option("country dropdown", "country-ref", ["United States"]);
// Verify selection was applied
await playwright_browser_wait_for(text="United States selected");
// Check for expected text/content
await playwright_browser_wait_for(text="Operation completed successfully");
// Take screenshot for documentation
await playwright_browser_take_screenshot(filename="test-result.png");
// Get current page state
await playwright_browser_snapshot();
// Trigger dialog
await playwright_browser_click("delete button", "delete-ref");
// Handle confirmation dialog
await playwright_browser_handle_dialog(accept: true);
// Verify dialog result
await playwright_browser_wait_for(textGone="Are you sure?");
// Trigger error condition
await playwright_browser_click("invalid action", "invalid-ref");
// Check for error message
await playwright_browser_wait_for(text="Error: Invalid input");
// Capture error state
await playwright_browser_take_screenshot(filename="error-state.png");
# Capture server logs for debugging
tmux capture-pane -t webserver -S - -p > server-logs.txt
# Clean up tmux session
tmux kill-session -t webserver
# Close browser
await playwright_browser_close();
// 1. Navigate to page
await playwright_browser_navigate("http://localhost:3000/settings");
// 2. Find auto-mode checkbox
await playwright_browser_snapshot(); // Initial state
// 3. Click checkbox
await playwright_browser_click("auto mode checkbox", "auto-checkbox");
// 4. Click start button
await playwright_browser_click("start button", "start-btn");
// 5. Wait for output
await playwright_browser_wait_for(text="Auto mode started");
// 6. Verify behavior
await playwright_browser_snapshot();
// 1. Navigate to form
await playwright_browser_navigate("http://localhost:3000/register");
// 2. Submit empty form
await playwright_browser_click("submit", "submit-btn");
// 3. Check validation errors
await playwright_browser_wait_for(text="Name is required");
// 4. Fill valid data
await playwright_browser_fill_form({
fields: [
{ name: "name", type: "textbox", ref: "name-input", value: "John Doe" },
{ name: "email", type: "textbox", ref: "email-input", value: "[email protected]" }
]
});
// 5. Submit again
await playwright_browser_click("submit", "submit-btn");
// 6. Verify success
await playwright_browser_wait_for(text="Registration successful");
// 1. Navigate to page
await playwright_browser_navigate("http://localhost:3000/dashboard");
// 2. Trigger data load
await playwright_browser_click("load data", "load-btn");
// 3. Wait for loading indicator
await playwright_browser_wait_for(text="Loading...");
// 4. Wait for content
await playwright_browser_wait_for(textGone="Loading...");
// 5. Verify data loaded
await playwright_browser_wait_for(text="Data loaded successfully");
REQUIRED: Always use tmux for server processes to enable:
This skill leverages these Playwright functions:
playwright_browser_navigate - Page navigationplaywright_browser_click - Element interactionplaywright_browser_type - Text inputplaywright_browser_fill_form - Form completionplaywright_browser_select_option - Dropdown selectionplaywright_browser_wait_for - Timing synchronizationplaywright_browser_snapshot - State verificationplaywright_browser_take_screenshot - Visual documentationplaywright_browser_handle_dialog - Dialog managementplaywright_browser_close - CleanupIMPORTANT: All screenshots must be stored in the retrospective's screenshots directory:
.sgai/retrospectives/<retrospective-id>/screenshots/
When taking screenshots:
.sgai/state.json (field: retrospectiveSession or from .sgai/PROJECT_MANAGEMENT.md header)Example:
// Create screenshots directory in the retrospective folder
await bash("mkdir -p .sgai/retrospectives/2025-01-15-09-30.abc1/screenshots");
// Take screenshot and save to the correct location
await playwright_browser_take_screenshot({
filename: ".sgai/retrospectives/2025-01-15-09-30.abc1/screenshots/before-fix.png"
});
// After making changes
await playwright_browser_take_screenshot({
filename: ".sgai/retrospectives/2025-01-15-09-30.abc1/screenshots/after-fix.png"
});
This ensures all visual evidence is properly organized and preserved with the retrospective session for future analysis.
CRITICAL: Always prefer taking Playwright screenshots over CSS evaluation for visual verification.
When verifying UI appearance:
playwright_browser_take_screenshotplaywright_browser_evaluate) for specific CSS property checksWhy screenshots are preferred:
Anti-pattern (DON'T):
// Checking CSS properties alone doesn't show visual reality
await playwright_browser_evaluate({
function: "() => getComputedStyle(document.querySelector('.button')).backgroundColor"
});
Preferred pattern (DO):
// Take screenshot to verify visual appearance
await playwright_browser_take_screenshot({
filename: ".sgai/retrospectives/<id>/screenshots/button-styling.png"
});
// Then examine the screenshot to verify colors, spacing, alignment are correct
When testing or implementing UI with button groups, ensure all buttons in the same group have consistent sizing and alignment:
When testing button groups:
// Take a screenshot of the button group
await playwright_browser_take_screenshot({
filename: ".sgai/retrospectives/<id>/screenshots/button-group.png"
});
// Visually verify in the screenshot:
// 1. All buttons have the same width
// 2. All buttons have the same height
// 3. Text inside buttons is consistently aligned
// 4. Buttons are properly aligned as a group
If implementing button groups, ensure:
/* All buttons in a group should use consistent sizing */
.button-group button {
min-width: 100px; /* Consistent minimum width */
height: 40px; /* Consistent height */
text-align: center; /* Consistent internal text alignment */
}
/* Use flexbox or grid for external alignment */
.button-group {
display: flex;
gap: 0.5rem;
align-items: center; /* Vertical alignment */
justify-content: flex-start; /* Horizontal alignment */
}
min-width)From actual debugging sessions:
// Complete auto-mode checkbox test
async function testAutoModeCheckbox() {
try {
// Phase 1: Start server (tmux)
await bash("tmux new-session -d -s testserver 'npm run dev'");
await bash("sleep 3");
// Phase 2: Navigate
await playwright_browser_navigate("http://localhost:3000");
await playwright_browser_wait_for(time: 2);
// Phase 3: Baseline
await playwright_browser_snapshot();
// Phase 4: Interact
await playwright_browser_click("auto mode checkbox", "auto-checkbox");
await playwright_browser_click("start button", "start-btn");
// Phase 5: Verify
await playwright_browser_wait_for(text="Auto mode activated");
await playwright_browser_snapshot();
await playwright_browser_take_screenshot("auto-mode-result.png");
// Phase 6: Cleanup
await bash("tmux capture-pane -t testserver -S - -p > test.log");
await bash("tmux kill-session -t testserver");
await playwright_browser_close();
console.log("Test completed successfully");
} catch (error) {
console.error("Test failed:", error);
// Capture debug info
await bash("tmux capture-pane -t testserver -S - -p > error.log");
await playwright_browser_take_screenshot("error-state.png");
}
}
This workflow transforms manual UI debugging into automated, reproducible test scenarios that can be run repeatedly during development.
documentation
Start, stop, and steer agentic sessions in sgai workspaces. Use when you need to launch AI agent sessions, halt running sessions, or inject steering instructions to guide the agent mid-execution without stopping it.
development
Monitor sgai workspace status, events, progress, diffs, and workflow diagrams. Use when you need to observe what agents are doing, track progress, get the current state of all workspaces, subscribe to real-time updates via SSE, or inspect code changes.
development
Access agents, skills, and code snippets available in sgai workspaces. Use when you need to discover what agents are defined in a workspace, browse available skills, get skill instructions, find code snippets by language, or retrieve snippet content for a specific task.
data-ai
Handle agent questions and work gates in sgai workspaces. Use when an agent is blocked waiting for human input, when you need to respond to multi-choice questions, approve work gates, or provide free-text answers to agent queries.