Overview
Deprecation guide for legacy Nightwatch API members that have been superseded by modern equivalents across assertion methods, configuration options, and browser capabilities.
Description
Multiple Nightwatch type definition files contain `@deprecated` annotations on individual properties and methods. These items remain in the codebase for backward compatibility but should be avoided in new code. This heuristic consolidates all known deprecations into a single reference.
Usage
Consult this heuristic when encountering TypeScript deprecation warnings in Nightwatch test code, or when migrating legacy Nightwatch test suites to the current API.
The Insight (Rule of Thumb)
- Action: Replace deprecated assertion methods with their modern equivalents.
- Value: See migration tables below.
- Trade-off: None — the modern equivalents are functionally identical with better naming consistency.
Deprecated Assertion Methods (types/assertions.d.ts)
| Deprecated Method |
Replacement |
Rationale
|
| `elementNotPresent()` |
`assert.not.elementPresent()` |
Unified negation via `.not` prefix
|
| `cssClassNotPresent()` |
`assert.not.hasClass()` |
Renamed for clarity
|
| `cssClassPresent()` |
`assert.hasClass()` |
Renamed for clarity
|
| `containsText()` |
`assert.textContains()` |
Renamed for consistency
|
| `title()` |
`titleEquals()` |
Renamed for specificity
|
| `value()` |
`assert.valueEquals()` |
Renamed for specificity
|
| `hidden()` |
`assert.not.visible()` |
Unified negation via `.not` prefix
|
Deprecated Configuration Options (types/nightwatch-options.d.ts)
| Deprecated Option |
Replacement |
Rationale
|
| `selenium_host` |
`selenium.host` |
Moved to nested `selenium` object
|
| `selenium_port` |
`selenium.port` |
Moved to nested `selenium` object
|
| `use_ssl` |
`selenium.ssl` |
Moved to nested `selenium` object
|
| `unit_tests_mode` |
`unit_testing_mode` |
Renamed
|
Deprecated Capabilities (types/desired-capabilities.d.ts, types/chrome-options.d.ts)
| Deprecated Item |
Replacement |
Rationale
|
| `chromeOptions` (in desiredCapabilities) |
`'goog:chromeOptions'` |
W3C WebDriver standard vendor prefix
|
| `w3c: true` (in ChromeOptions) |
N/A (remove) |
ChromeDriver now only supports W3C protocol
|
Deprecated Core Types (types/index.d.ts)
| Deprecated Type |
Replacement |
Rationale
|
| `NightwatchClient` |
`NightwatchAPI` |
Renamed for clarity
|
| Legacy JSONWire Protocol commands |
W3C WebDriver equivalents |
JSONWire protocol sunset
|
Reasoning
Nightwatch has undergone significant API modernization since v2.0, aligning with W3C WebDriver standards and improving API naming consistency. The deprecated items remain for backward compatibility but will be removed in future major versions. New test code should exclusively use the modern equivalents to avoid migration effort later.
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.