Prompt
How do I run the same test suite on Chrome, Firefox, and Safari?
Latest observation
To run the same test suite across Chrome, Firefox, and Safari, the usual approach is to use a browser automation test runner that can launch multiple browsers with the same tests.
Common options
1. Playwright
Best modern choice for cross-browser testing.
- Supports Chromium (Chrome), Firefox, and WebKit (Safari-like)
- Same test code runs in all three
- Easy parallel execution
Example:
npx playwright install
Run tests in all browsers:
npx playwright test
In playwright.config.ts:
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
{ name: 'firefox', use: { ...devices['Desktop Firefox'] } },
{ name: 'webkit', use: { ...devices['Desktop Safari'] } },
],
});
2. Selenium
Good if you already use WebDriver-based testing.
- Run the same tests against different browser drivers
- More setup than Playwright
- Works well with existing Selenium stacks
You’d typically parameterize your tests and run them with ChromeDriver, GeckoDriver, and SafariDriver.
3. Cypress
Cypress can run in multiple browsers, but support is more limited than Playwright for true cross-browser parity.
Run with:
npx cypress run --browser chrome
npx cypress run --browser firefox
npx cypress run --browser safari
Safari support depends on your environment and Cypress version.
Recommended setup
If you want the simplest modern solution:
- Use Playwright
- Define three browser projects
- Run the suite once, and it executes in all browsers
One important note about Safari
Playwright uses WebKit for Safari-like testing, not the native Safari browser itself. If you need real Safari, Selenium with SafariDriver or a cloud testing service is better.
If you want CI/browser grid
For real devices/browsers, use:
- BrowserStack
- Sauce Labs
- LambdaTest
They let you run the same suite on actual Chrome, Firefox, and Safari versions in the cloud.
If you tell me your test framework (Jest, Mocha, Cypress, Playwright, Selenium, etc.), I can show you the exact setup.