Prompt
How do I run end-to-end tests in a cloud browser grid?
Latest observation
Oct 26, 2026
OpenAI APIWeb search: off
To run end-to-end (E2E) tests in a cloud browser grid, you generally:
-
Choose a browser grid provider
- Examples: BrowserStack, Sauce Labs, LambdaTest, AWS Device Farm, etc.
- These services give you access to real browsers/devices in the cloud.
-
Set up your test framework
- Common tools: Playwright, Cypress, Selenium, WebdriverIO, Puppeteer.
- Make sure your tests can run non-interactively from the command line.
-
Configure remote browser connection
- Instead of launching a local browser, point your test runner to the provider’s remote endpoint.
- This usually means setting:
username/access key- a remote WebDriver URL or service-specific config
- browser/OS/device capabilities
-
Define the desired environments
- Choose combinations like:
- Chrome on Windows
- Safari on macOS
- Edge on Windows
- Mobile Safari on iPhone
- Chrome on Android
- Keep the matrix focused to reduce runtime and cost.
- Choose combinations like:
-
Run tests in CI/CD
- Add your test command to GitHub Actions, GitLab CI, Jenkins, CircleCI, etc.
- Use environment secrets for credentials.
- Parallelize tests if the grid supports it.
-
Capture artifacts
- Enable screenshots, video, logs, network traces, and console logs.
- These are very helpful when tests fail remotely.
-
Review results in the provider dashboard
- Most grids provide test session history, logs, and recordings.
Example patterns
Selenium
Configure RemoteWebDriver to connect to the grid:
const { Builder } = require('selenium-webdriver');
(async function run() {
const driver = await new Builder()
.usingServer('https://USERNAME:ACCESS_KEY@hub.example.com/wd/hub')
.forBrowser('chrome')
.build();
await driver.get('https://example.com');
// assertions...
await driver.quit();
})();
Playwright
Use a cloud provider’s Playwright integration or connect via their service-specific tunnel/endpoint. Many providers offer a config like:
use: {
connectOptions: {
wsEndpoint: process.env.CLOUD_WS_ENDPOINT
}
}
Cypress
Use the provider’s CI integration or a service plugin/config to send runs to the cloud grid, often via environment variables and their CLI.
Best practices
- Start with a small browser matrix.
- Run smoke tests on every PR; full matrix nightly.
- Use retries sparingly.
- Keep tests independent and deterministic.
- Use test IDs instead of brittle selectors.
- If your app is behind a firewall or localhost, use the provider’s tunnel or local testing feature.
If you tell me which test framework and cloud grid you’re using, I can give you exact setup steps and a config example.