Nightwatch.js Tutorial Home / Video /

How to Write and Run Your First Nightwatch.js Test | Nightwatch.js Tutorial

How to Write and Run Your First Nightwatch.js Test | Nightwatch.js Tutorial

About The Video

In the third part of our Nightwatch.js tutorial series, ๐“๐š๐ฉ๐š๐ฌ ๐€๐๐ก๐ข๐ค๐š๐ซ๐ฒ demonstrates how to write your first automated tests using the Behavior Driven Development (BDD) approach with Nightwatch.js.

You'll learn how to structure test suites with describe blocks, write individual test cases using it functions, and implement setup/teardown hooks like before, after, beforeEach, and afterEach. Additionally, Tapas explains how to interact with web elements, make assertions, and organize your tests professionally for real-world e-commerce testing scenarios.

๐ŸŽฏ What You'll Learn:

โœ… BDD fundamentals and methodology

โœ… Essential test syntax (describe, it, expect, before, after)

โœ… Writing real test cases for e-commerce scenarios

โœ… Element interaction (setValue, click, waitForElementVisible)

โœ… Assertions and test validation techniques

โœ… Test execution and HTML report generation

By the end of this session, you'll be able to write, run, and debug your own Nightwatch.js test cases, setting the foundation for comprehensive web application testing.

Video Chapters

00:00 Introduction: What Will We Learn?

01:11 Understanding BDD

02:21 BDD Syntax Explained

10:10 Writing Your First Test

20:45 Extending to a Second Test

29:14 Running Tests and Reviewing Results

30:46 Whatโ€™s Next?

Key Topics Covered

In this episode of the NightwatchJS series, we dive into setting up NightwatchJS for your project. Youโ€™ll learn how to install and configure NightwatchJS for both new and existing projects, define your test folders, page objects, custom commands, and assertions, and understand the purpose of the nightwatch.conf.js configuration file.

We cover running tests on multiple browsers like Chrome, Safari, and Edge, including how to configure Safari for automation on Mac. The session also introduces globals for sharing data across test suites, and environment variables to securely manage sensitive information like API keys.

Finally, we explore single vs. parallel test execution using test workers to speed up your testing, and demonstrate how to run tests on one or multiple browsers in parallel. This session lays the foundation for writing effective NightwatchJS tests in the next episode.

Related Hubs

Nightwatch.js Tutorial For Test Automationโ€“Complete Guide With Examples

More Videos from Nightwatch.js Tutorial