What's new in Nightwatch v3?
Nightwatch v3 brings in plenty of new features accross your testing workflow from authoring to executing to debugging tests.
New Features
Nightwatch inspector
Nightwatch v3 introduces a point and click tool that can help you easily find selectors. It will improve your productivity of authoring tests & help you find durable selectors for lower long term maintenance.
Angular Component testing
Nightwatch v3 has added support for Angular component testing to the component testing repertoire.s
Test doubles
With earlier versions, you could run unit & integration tests using Nightwatch. Nightwatch v3 introduces test doubles with in-build support for stubs, spies & mocks to achieve isolation in unit testing.
Brand new element APIs
With Nightwatch v3, we have revamped the element API to make test authoring simpler and more concise.
More rich & powerful selectors
New selectors are introduced as part of this latest versions
.findByText()
.findByPlaceholderText()
.findByAltText()
.findByRole()
You can also chain selectors to find elements that are more complex to find
Example:
browser.element.find('#selector').findByText('text').click();
Performance improvements
Nightwatch v3 has implemented worker threads for parallel runs and we have observed improvements of upto 25% between Nightwatch v2 & v3. Try it now
Breaking changes
We have tried to ensure that there are no breaking changes while upgrading to v3. However, in case you need migration assistance please reach out to us on our new Nightwatch v3 channel on Discord
Release notes
Please refer to the release notes section for information about the latest changes. Releases Notes.
Key highlights from Nightwatch v2
Run your tests on real & virtual mobile devices
Nightwatch v3 brings the mobile helper tool that will help you install everything needed to run web tests on mobile devices. Nightwatch supports real browsers on Android & iOS real & virtual devices.
Run mobile app tests on Android & iOS
Nightwatch uses Appium under the hood to enable native mobile app testing on Android & iOS devices. It has the following functionalities to simplify your mobile app testing workflow.
- Easy setup using the mobile-helper tool
- Native Nightwatch commands & assertions for authoring tests
- Integration with Appium debugger
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
Visual Regression Testing
Nightwatch v3 introduces visual regression testing as an in-house plugin. The plugin takes care of
- Capturing screenshots
- Comparison with baseline to highlight visual differences
- Report to review the differences
- 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
- Request assertions
- Response assertions
- Viewing API tests in the HTML report
- 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.
DOM history
Relive the test as it happened by enabling DOM history. When this functionaity is enabled, DOM snapshots are captured after every test and displayed in the HTML report for better debugging.