Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Nightwatchjs Nightwatch Command Namespacing

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

Overview

An organizational pattern that uses directory structure to create namespaced groups of related custom commands under logical prefixes.

Description

Command Namespacing uses the file system hierarchy within the custom_commands_path to automatically group related commands under namespace prefixes. When a command file is placed in a subdirectory (e.g., custom-commands/angular/getElementsInList.js), it becomes accessible as browser.angular.getElementsInList() rather than browser.getElementsInList(). This prevents naming collisions and improves API organization for large command libraries.

Usage

Use namespacing when creating sets of related commands that belong to a logical group, such as framework-specific utilities (angular, react), domain-specific operations (checkout, auth), or utility categories (validation, navigation).

Theoretical Basis

Namespacing follows the filesystem-to-API mapping convention:

  1. Root directory commands → browser.commandName()
  2. Subdirectory commands → browser.directoryName.commandName()
  3. Nested subdirectories → deeper namespace nesting

Related Pages

Implemented By

Page Connections

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