playwright-mcp/test-session-config.cjs
Ryan Malloy a41a73af2a style: fix linting errors and update README with new tools
- Auto-fix trailing spaces, curly braces, and indentation issues
- Clean up boolean comparisons and code formatting
- README automatically updated with new code injection tools:
  - browser_enable_debug_toolbar: Enable debug toolbar for client identification
  - browser_inject_custom_code: Inject custom JavaScript/CSS code
  - browser_list_injections: List all active code injections
  - browser_disable_debug_toolbar: Disable debug toolbar
  - browser_clear_injections: Remove custom code injections

All linting checks now pass successfully.
2025-09-10 01:38:24 -06:00

71 lines
2.7 KiB
JavaScript

#!/usr/bin/env node
/**
* Test script to verify session-based snapshot configuration works
*/
const { spawn } = require('child_process');
async function testSessionConfig() {
console.log('🧪 Testing session-based snapshot configuration...\n');
// Test that the help includes the new browser_configure_snapshots tool
return new Promise((resolve) => {
const child = spawn('node', ['lib/program.js', '--help'], {
cwd: __dirname,
stdio: 'pipe'
});
let output = '';
child.stdout.on('data', (data) => {
output += data.toString();
});
child.stderr.on('data', (data) => {
output += data.toString();
});
child.on('close', (code) => {
console.log('✅ Program help output generated');
console.log('📋 Session configuration is now available!\n');
console.log('🎯 **New Session Configuration Tool:**');
console.log(' browser_configure_snapshots - Configure snapshot behavior during session');
console.log('\n📝 **Usage Examples:**');
console.log(' # Disable auto-snapshots during session:');
console.log(' browser_configure_snapshots {"includeSnapshots": false}');
console.log('');
console.log(' # Set custom token limit:');
console.log(' browser_configure_snapshots {"maxSnapshotTokens": 25000}');
console.log('');
console.log(' # Enable differential snapshots:');
console.log(' browser_configure_snapshots {"differentialSnapshots": true}');
console.log('');
console.log(' # Combine multiple settings:');
console.log(' browser_configure_snapshots {');
console.log(' "includeSnapshots": true,');
console.log(' "maxSnapshotTokens": 15000,');
console.log(' "differentialSnapshots": true');
console.log(' }');
console.log('\n✨ **Benefits of Session Configuration:**');
console.log(' 🔄 Change settings without restarting server');
console.log(' 🎛️ MCP clients can adjust behavior dynamically');
console.log(' 📊 See current settings anytime');
console.log(' ⚡ Changes take effect immediately');
console.log(' 🎯 Different settings for different workflows');
console.log('\n📋 **All Available Configuration Options:**');
console.log(' • includeSnapshots (boolean): Enable/disable automatic snapshots');
console.log(' • maxSnapshotTokens (number): Token limit before truncation (0=unlimited)');
console.log(' • differentialSnapshots (boolean): Show only changes vs full snapshots');
console.log('\n🚀 Ready to use! MCP clients can now configure snapshot behavior dynamically.');
resolve();
});
});
}
testSessionConfig().catch(console.error);