examples/integration-browser/existing-session/README.md
Test OAuth-authenticated applications by connecting to existing Chrome browser sessions.
You can run this example with:
npx promptfoo@latest init --example integration-browser/existing-session
cd integration-browser/existing-session
This example demonstrates two browser provider modes:
cd examples/integration-browser/existing-session
node server.js
# Start Chrome with debugging
chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-test
# Manually log into your application in that Chrome instance
# Run tests using the existing session
npx promptfoo eval --filter-providers existing-session
# Just run the tests (launches new browser)
npx promptfoo eval --filter-providers new-browser
The promptfooconfig.yaml includes both modes:
providers:
# Connect to existing session
- id: browser
label: existing-session
config:
connectOptions:
debuggingPort: 9222
# ... test steps
# Launch new browser
- id: browser
label: new-browser
config:
headless: true
# ... test steps
npm install playwright @playwright/browser-chromium playwright-extra puppeteer-extra-plugin-stealth
promptfooconfig.yaml - Example configuration showing both modesserver.js - Test web servertest-page.html - Mock authenticated chat interface