Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Heuristic:Nightwatchjs Nightwatch Safari Parallel Limitation

From Leeroopedia
Knowledge Sources
Domains Testing, Browser_Automation
Last Updated 2026-02-12 01:00 GMT

Overview

Safari's local WebDriver (SafariDriver) does not support parallel test execution; Nightwatch automatically falls back to serial mode when Safari is detected on localhost.

Description

SafariDriver on macOS is a single-instance driver that cannot run multiple browser sessions simultaneously. When Nightwatch detects that tests are configured to run in Safari with a local WebDriver (localhost), it automatically disables parallel execution and runs tests in serial mode. This is a known platform limitation of Safari's WebDriver implementation, not a Nightwatch bug. Similarly, mobile platforms (Android/iOS) without a remote WebDriver server also have parallelism disabled automatically.

Usage

Be aware of this limitation when planning cross-browser CI pipelines that include Safari. If your test suite relies on parallel execution for speed, Safari tests will be a bottleneck. Consider running Safari tests as a separate serial job in CI, or use BrowserStack/SauceLabs for parallel Safari testing (where the cloud provider manages multiple Safari instances).

The Insight (Rule of Thumb)

  • Action: Do not expect parallel execution when testing with Safari on localhost.
  • Value: Nightwatch logs a warning: `"Running tests in parallel is not supported in Safari. Tests will run in serial mode."`
  • Trade-off: Safari tests will be slower than Chrome/Firefox tests in parallel CI pipelines. Budget additional CI time or move Safari testing to a cloud provider.
  • Workaround: Use BrowserStack or Selenium Grid for parallel Safari testing, where the remote server manages session isolation.

Reasoning

SafariDriver is built into macOS and managed by Apple. Unlike ChromeDriver and GeckoDriver which can spawn multiple independent browser instances, SafariDriver only supports one active session at a time. Attempting to create multiple sessions causes conflicts and test failures.

Nightwatch proactively detects this constraint and silently switches to serial mode rather than letting tests fail with confusing driver errors.

Code evidence from `lib/runner/cli/cli.js:480-488`:

if (isSafari(desiredCapabilities) && isLocalhost(webdriver)) {
  this.isSafariEnvPresent = true;
  if (Concurrency.isMasterProcess()) {
    console.warn('Running tests in parallel is not supported in Safari. ' +
      'Tests will run in serial mode.');
  }
  return false;
}

Mobile platform parallel limitation from `lib/runner/cli/cli.js:471-478`:

if (isMobile(desiredCapabilities) && !this.usingServer(this.testEnvSettings[env])) {
  if (Concurrency.isWorker()) {
    Logger.info('Disabling parallelism while running tests on mobile platform');
  }
  return false;
}

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment