nightwatch README

The project's README from github.com/nightwatchjs/nightwatch. As one markdown file: README.md.

Nightwatch.js

npm Node.js CI codecov Discord

Nightwatch.js Logo

Homepage • Developer Guide • API Reference • About • Blog

Nightwatch is an integrated testing framework powered by Node.js and using the W3C Webdriver API. It is a complete testing solution developed at BrowserStack and which can be used for:

☑️ end-to-end testing of web applications and websites

☑️ component testing in isolation (React / Vue / Storybook / Angular)

☑️ Node.js unit, visual regression testing, accessibility testing & API testing

☑️ Native mobile app testing on Android & iOS

🚀 Nightwatch v3

What's New | Release Notes | Discussions

Nightwatch v3 is an all new generation that has been built around these three pillars:

The Nightwatch v3 is not just a new version, it’s the result of months of engineering effort to reimagine test automation for the future. Try it out in 60 seconds and see it in action.

⚙️ Get started in 60 seconds

1. Install Nightwatch from NPM

From your existing project's root dir:

npm init nightwatch@latest

or, if you want to initialize a new project:

npm init nightwatch@latest ./path/to/new/project

nightwatch-cli-gif

2. Answer a few questions about your preferred setup:

Nightwatch will do the entire setup for you based on your answers.

3. Run a Demo Test:

Nightwatch comes with a few examples, which are automatically copied to your Nightwatch project during the setup and can also be used as boilerplate to write your own tests on top of them.

You can follow the instructions given at the end of the setup to run your first test with Nightwatch.

image

Nightwatch mobile app testing

Nightwatch enables automation testing of native mobile applications via Appium. It combines the robustness of Appium with the enhanced developer experience provided by Nightwatch. It enables end-to-end functional testing of native mobile apps on Android and iOS devices. Try it now

Go beyond E2E

Component testing

With Nightwatch you can test components in isolation by mounting them in the browser. Nightwatch 2 added support for component testing for popular web frameworks such as

  1. React
  2. VueJS
  3. Angular
  4. Storybook

Nightwatch unit tests

The tests for Nightwatch are written using Mocha.

  1. Clone the project

    git clone https://github.com/nightwatchjs/nightwatch.git
    
    # change directory
    cd nightwatch
    
    # install the dependencies
    npm install
    
  2. Run tests

    To run the complete test suite:

    npm test
    

    To check test coverage, run the command:

    npm run mocha-coverage
    

    and then open the generated coverage/index.html file in your browser.

See Unit testing guide for more details.

Other types of testing

Visual Regression Testing

Nightwatch v3 introduces visual regression testing as an in-house plugin. The plugin takes care of

  1. Capturing screenshots
  2. Comparison with baseline to highlight visual differences
  3. Report to review the differences
  4. Approve the changes

VRT can be done on real desktop & mobile browsers. Also, VRT can be run on components as part of component testing as well.

API Testing

API testing is now available with Nightwatch v3. The following functionality can be achieved with API testing

  1. Request assertions
  2. Response assertions
  3. Viewing API tests in the HTML report
  4. Mock server

Accessibility Testing

Nightwatch v3 packages the aXe-core package developed by Deque Systems as a plugin. It enables 90 different types of accessibility tests for WCAG compliance.

🦉 About Nightwatch

Nightwatch was initially built by @pineviewlabs - an independent software consultancy based in Oslo, Norway, with help from contributors. In mid 2021, Nightwatch has become a part of the @BrowserStack family and it is being developed further at the BrowserStack Open-source Program Office. Read more on our blog.

Contributing

We welcome any and all contributions from the community which can help improve Nightwatch. Please check out CONTRIBUTING.md for more extensive contributing guidelines.

Licence

MIT

nightwatch (nightwatchjs/nightwatch)

Searching Database…

Что это?Nightwatch.js — это интегрированный фреймворк для сквозного (end-to-end) тестирования на Node.js, построенный на основе W3C Webdriver API. С его помощью можно тестировать веб-приложения, компоненты, API и нативные мобильные приложения одним инструментом.
Это фреймворк для тестирования или просто обёртка над Selenium?Это полноценный самостоятельный фреймворк для тестирования, а не просто тонкая обёртка. В него входят средство запуска тестов, проверки и мастер настройки. Под капотом он при этом может использовать Selenium/WebDriver.
Как это запустить?Установите Nightwatch из NPM в существующий проект или используйте команду init, чтобы создать новый проект. Затем инструмент задаст несколько вопросов о настройке (язык и средство запуска тестов, где запускать e2e-тесты, расположение тестов, базовый URL) и создаст всё необходимое, включая демонстрационные тесты для запуска.
Нужно ли устанавливать Selenium или Appium отдельно?Для тестирования веб-приложений он управляет браузерами через W3C Webdriver API (например, ChromeDriver/Selenium Server). Для тестирования нативных мобильных приложений под капотом нужен Appium. Требуется Node.js >= 18.20.5.
Тестирование мобильных приложений встроено или требует дополнительной настройки?Тестирование мобильных приложений работает через интеграцию с Appium, поэтому Appium нужно настроить вместе с Nightwatch. Это не работает полностью из коробки, без каких-либо дополнительных инструментов.
Это только для фронтенд-команд?Инструмент подходит всем, кому нужна автоматизация браузера или мобильных приложений: тестировщикам веб-приложений и командам, которые используют React, Vue, Angular или Storybook для тестирования компонентов.
Тестирует только в браузере или ещё и на реальных устройствах?Он охватывает десктопные и мобильные браузеры, а также нативные приложения для Android и iOS. Запуск возможен на симуляторах, реальных устройствах или в облачной сетке, например BrowserStack.
Какие виды тестирования, помимо e2e, может выполнять Nightwatch?Он поддерживает модульные тесты, визуальное регрессионное тестирование, тестирование доступности (через aXe-core, охватывающий 90 проверок WCAG) и тестирование API (проверки запросов и ответов, а также мок-сервер). Всё это в одном фреймворке.
Что нового в Nightwatch v3?v3 делает акцент на удобстве для разработчиков (более быстрые и стабильные тесты, меньше нестабильных тестов), тестировании с приоритетом мобильных устройств и объединении модульного, компонентного, e2e, API, визуального тестирования и тестирования доступности в одном фреймворке.
Как запускаются собственные модульные тесты Nightwatch?Набор тестов написан на Mocha. Нужно клонировать репозиторий и запустить команду тестирования. Отчёты о покрытии генерируются через nyc и сохраняются в coverage/index.html.
Size
53.5 MB
Stars
11.9K
Age
14y
Commits · 90 Days