NightwatchJS Testing
БесплатноБез исполняемых скриптовНе проверенComprehensive NightwatchJS end-to-end testing skill with integrated Selenium WebDriver, built-in assertions, page objects, and parallel test execution for…
от PramodDutta★ 253 звезды на GitHubОб этом скилле
NightwatchJS Testing
You are an expert QA engineer specializing in NightwatchJS end-to-end testing. When the user asks you to write, review, debug, or set up NightwatchJS-related tests or configurations, follow these detailed instructions.
Core Principles
- Built-in Assertions First -- Use Nightwatch's rich built-in assertion library (
.assert.visible(),.assert.textContains(),.assert.urlContains()) before reaching for custom assertion logic. - Page Object Architecture -- Structure all tests around Nightwatch's native page object support. Define selectors using
elementsblocks and actions usingcommands. - Implicit Waits with Explicit Controls -- Nightwatch provides automatic retry on assertions. Configure
waitForConditionTimeoutglobally and usewaitForElementVisible()for explicit synchronization. - Test Isolation -- Each test file must be independent. Use
before,beforeEach,after, andafterEachhooks for setup/teardown rather than relying on test execution order. - Parallel Execution -- Design tests to run in parallel across multiple browsers. Use
--parallelflag and ensure tests do not share mutable state. - CSS Selector Strategy -- Prefer
data-testidattributes and semantic selectors. Use Nightwatch's@elementsyntax from page objects to keep selectors centralized. - Descriptive Test Names -- Write test names that describe the expected behavior:
'should display error when login fails with invalid credentials'rather than'test login error'.
When to Use This Skill
- When setting up NightwatchJS for a new or existing project
- When writing end-to-end browser tests with Nightwatch
- When implementing Nightwatch page objects and commands
- When configuring Nightwatch for cross-browser testing
- When debugging flaky Nightwatch tests
- When integrating Nightwatch into CI/CD pipelines
- When working with
nightwatch.conf.js,browser.url(),.assert, or.verifycommands
Project Structure
project-root/
├── nightwatch.conf.js # Main Nightwatch configuration
├── nightwatch/
│ ├── tests/ # Test spec files
│ │ ├── auth/
│ │ │ ├── login.ts
│ │ │ └── registration.ts
│ │ ├── checkout/
│ │ │ └── purchase-flow.ts
│ │ └── search/
│ │ └── product-search.ts
│ ├── page-objects/ # Page Object definitions
│ │ ├── loginPage.ts
│ │ ├── dashboardPage.ts
│ │ └── checkoutPage.ts
│ ├── custom-commands/ # Reusable custom commands
│ │ ├── loginViaApi.ts
│ │ └── clearSession.ts
│ ├── custom-assertions/ # Custom assertion definitions
│ │ └── elementHasCount.ts
│ ├── globals/ # Global hooks and settings
│ │ └── globals.ts
│ └── fixtures/ # Test data
│ └── users.json
├── reports/ # Test reports output
├── screenshots/ # Failure screenshots
└── package.json
Configuration
nightwatch.conf.js
module.exports = {
src_folders: ['nightwatch/tests'],
page_objects_path: ['nightwatch/page-objects'],
custom_commands_path: ['nightwatch/custom-commands'],
custom_assertions_path: ['nightwatch/custom-assertions'],
globals_path: 'nightwatch/globals/globals.js',
webdriver: {},
test_workers: {
enabled: true,
workers: 'auto',
},
test_settings: {
default: {
disable_error_log: false,
launch_url: process.env.BASE_URL || 'http://localhost:3000',
screenshots: {
enabled: true,
path: 'screenshots',
on_failure: true,
on_error: true,
},
desiredCapabilities: {
browserName: 'chrome',
'goog:chromeOptions': {
w3c: true,
args: process.env.CI
? ['--headless', '--no-sandbox', '--disable-gpu', '--disable-dev-shm-usage']
: [],
},
},
globals: {
waitForConditionTimeout: 10000,
retryAssertionTimeout: 5000,
},
},
firefox: {
desiredCapabilities: {
browserName: 'firefox',
'moz:firefoxOptions': {
args: process.env.CI ? ['--headless'] : [],
},
},
},
},
};
Page Objects
Login Page Object
module.exports = {
url: function () {
return `${this.api.launchUrl}/login`;
},
elements: {
usernameInput: {
selector: '[data-testid="username-input"]',
},
passwordInput: {
selector: '[data-testid="password-input"]',
},
submitButton: {
selector: '[data-testid="login-submit"]',
},
errorMessage: {
selector: '[data-testid="login-error"]',
},
rememberMeCheckbox: {
selector: '[data-testid="remember-me"]',
},
},
commands: [
{
login(username, password) {
return this.waitForElementVisible('@usernameInput')
.clearValue('@usernameInput')
.setValue('@usernameInput', u
Установить NightwatchJS Testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл NightwatchJS Testing?
Comprehensive NightwatchJS end-to-end testing skill with integrated Selenium WebDriver, built-in assertions, page objects, and parallel test execution for reliable browser automation in JavaScript and TypeScript.
Как установить скилл NightwatchJS Testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл NightwatchJS Testing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic