Browserstack

Run tests on BrowserStack. Use when user mentions "browserstack", "cross-browser", "cloud testing", "browser matrix", "test on safari", "test on firefox", or "browser compatibility".

Published by @Alireza Rezvani·0 agent reads / 30d·0 saves·

BrowserStack Integration

Run Playwright tests on BrowserStack's cloud grid for cross-browser and cross-device testing.

Prerequisites

Environment variables must be set:

  • BROWSERSTACK_USERNAME — your BrowserStack username
  • BROWSERSTACK_ACCESS_KEY — your access key

If not set, inform the user how to get them from browserstack.com/accounts/settings and stop.

Capabilities

1. Configure for BrowserStack

/pw:browserstack setup

Steps:

  1. Check current playwright.config.ts
  2. Add BrowserStack connect options:
// Add to playwright.config.ts
import { defineConfig } from '@playwright/test';

const isBS = !!process.env.BROWSERSTACK_USERNAME;

export default defineConfig({
  // ... existing config
  projects: isBS ? [
    {
      name: "chromelatestwindows-11",
      use: {
        connectOptions: {
          wsEndpoint: `wss://cdp.browserstack.com/playwright?caps=${encodeURIComponent(JSON.stringify({
            'browser': 'chrome',
            'browser_version': 'latest',
            'os': 'Windows',
            'os_version': '11',
            'browserstack.username': process.env.BROWSERSTACK_USERNAME,
            'browserstack.accessKey': process.env.BROWSERSTACK_ACCESS_KEY,
          }))}`,
        },
      },
    },
    {
      name: "firefoxlatestwindows-11",
      use: {
        connectOptions: {
          wsEndpoint: `wss://cdp.browserstack.com/playwright?caps=${encodeURIComponent(JSON.stringify({
            'browser': 'playwright-firefox',
            'browser_version': 'latest',
            'os': 'Windows',
            'os_version': '11',
            'browserstack.username': process.env.BROWSERSTACK_USERNAME,
            'browserstack.accessKey': process.env.BROWSERSTACK_ACCESS_KEY,
          }))}`,
        },
      },
    },
    {
      name: "webkitlatestos-x-ventura",
      use: {
        connectOptions: {
          wsEndpoint: `wss://cdp.browserstack.com/playwright?caps=${encodeURIComponent(JSON.stringify({
            'browser': 'playwright-webkit',
            'browser_version': 'latest',
            'os': 'OS X',
            'os_version': 'Ventura',
            'browserstack.username': process.env.BROWSERSTACK_USERNAME,
            'browserstack.accessKey': process.env.BROWSERSTACK_ACCESS_KEY,
          }))}`,
        },
      },
    },
  ] : [
    // ... local projects fallback
  ],
});
  1. Add npm script: "test:e2e:cloud": "npx playwright test --project='chrome@*' --project='firefox@*' --project='webkit@*'"

2. Run Tests on BrowserStack

/pw:browserstack run

Steps:

  1. Verify credentials are set
  2. Run tests with BrowserStack projects:
    BROWSERSTACK_USERNAME=$BROWSERSTACK_USERNAME \
    BROWSERSTACK_ACCESS_KEY=$BROWSERSTACK_ACCESS_KEY \
    npx playwright test --project='chrome@*' --project='firefox@*'
    
  3. Monitor execution
  4. Report results per browser

3. Get Build Results

/pw:browserstack results

Steps:

  1. Call browserstack_get_builds MCP tool
  2. Get latest build's sessions
  3. For each session:
    • Status (pass/fail)
    • Browser and OS
    • Duration
    • Video URL
    • Log URLs
  4. Format as summary table

4. Check Available Browsers

/pw:browserstack browsers

Steps:

  1. Call browserstack_get_browsers MCP tool
  2. Filter for Playwright-compatible browsers
  3. Display available browser/OS combinations

5. Local Testing

/pw:browserstack local

For testing localhost or staging behind firewall:

  1. Install BrowserStack Local: npm install -D browserstack-local
  2. Add local tunnel to config
  3. Provide setup instructions

MCP Tools Used

ToolWhen
browserstack_get_planCheck account limits
browserstack_get_browsersList available browsers
browserstack_get_buildsList recent builds
browserstack_get_sessionsGet sessions in a build
browserstack_get_sessionGet session details (video, logs)
browserstack_update_sessionMark pass/fail
browserstack_get_logsGet text/network logs

Output

  • Cross-browser test results table
  • Per-browser pass/fail status
  • Links to BrowserStack dashboard for video/screenshots
  • Any browser-specific failures highlighted

Bundled with this artifact

2 files

Reference files that ship alongside this artifact. Agents pull these in only when the task needs them.

More on the bench

SKILL0

Google Cloud Waf Sustainability

Generates sustainability-focused guidance for Google Cloud workloads based on the design principles and recommendations in the Google Cloud Well-Architected Framework (WAF). Use this skill to evaluate a workload, identify environmental impact requirements, and provide actionable recommendations to build, deploy, and manage the workload sustainably in Google Cloud.

software-engineering+2
0
SKILL0

Google Cloud Waf Reliability

Generates reliability-focused guidance for Google Cloud workloads based on the design principles and recommendations in the Google Cloud Well-Architected Framework. Use this skill to evaluate a workload, identify reliability requirements, and provide actionable recommendations for build, deploy, and manage the workload reliably in Google Cloud.

software-engineering+2
0
SKILL0

Google Cloud Waf Performance Optimization

Generates performance-focused guidance for Google Cloud workloads based on the design principles and recommendations in the Performance Optimization pillar of the Google Cloud Well-Architected Framework (WAF). Use this skill to evaluate a workload, identify performance requirements, and provide actionable recommendations for resource allocation, modular design, and elasticity.

software-engineering+2
0